~ubuntu-branches/ubuntu/oneiric/mpqc/oneiric

« back to all changes in this revision

Viewing changes to src/lib/chemistry/qc/basis/gaussshell.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2005-11-27 11:41:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127114149-zgz9r3gk50w8ww2q
Tags: 2.3.0-1
* New upstream release.
* debian/rules (SONAME): Activate awk snippet for automatic so-name
  detection again, resulting in a bump to `7' and making a `c2a' for
  the C++ allocator change unnecessary; closes: #339232.
* debian/patches/00list (08_gcc-4.0_fixes): Removed, no longer needed.
* debian/rules (test): Remove workarounds, do not abort build if tests
  fail.
* debian/ref: Removed.
* debian/control.in (libsc): Added Conflict against libsc6c2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <math.h>
34
34
 
35
35
#include <util/misc/formio.h>
 
36
#include <util/misc/math.h>
36
37
#include <util/keyval/keyval.h>
37
38
#include <util/state/stateio.h>
38
39
 
53
54
// this GaussianShell ctor allocates and computes normalization constants
54
55
// and computes nfunc
55
56
GaussianShell::GaussianShell(
56
 
  int ncn,int nprm,double*e,int*am,int*pure,double**c,PrimitiveType pt
 
57
  int ncn,int nprm,double*e,int*am,int*pure,double**c,PrimitiveType pt,
 
58
  bool do_normalize_shell
57
59
  ):
58
60
nprim(nprm),
59
61
ncon(ncn),
70
72
  if (pt == Normalized) convert_coef();
71
73
 
72
74
  // Compute the normalization constants
73
 
  normalize_shell();
 
75
  if (do_normalize_shell) normalize_shell();
74
76
}
75
77
 
76
78
// this GaussianShell ctor is much like the above except the puream
317
319
  for (gc=0; gc<ncon; gc++) {
318
320
      for (i=0; i<nprim; i++) {
319
321
          c = 0.25/exp[i];
320
 
          ss = pow(3.141592653589793/(exp[i]+exp[i]),1.5);
 
322
          ss = pow(M_PI/(exp[i]+exp[i]),1.5);
321
323
          coef[gc][i]
322
324
            *= 1.0/sqrt(::norm(l[gc],l[gc],c,ss));
323
325
        }
327
329
double GaussianShell::coefficient_norm(int con,int prim) const
328
330
{
329
331
  double c = 0.25/exp[prim];
330
 
  double ss = pow(3.141592653589793/(exp[prim]+exp[prim]),1.5);
 
332
  double ss = pow(M_PI/(exp[prim]+exp[prim]),1.5);
331
333
  return coef[con][prim] * sqrt(::norm(l[con],l[con],c,ss));
332
334
}
333
335
 
347
349
  for (i=0; i<nprim; i++) {
348
350
    for (j=0; j<nprim; j++) {
349
351
      c = 0.50/(exp[i] + exp[j]);
350
 
      ss = pow(3.141592653589793/(exp[i]+exp[j]),1.5);
 
352
      ss = pow(M_PI/(exp[i]+exp[j]),1.5);
351
353
      result += coef[gc][i] * coef[gc][j] *
352
354
               ::norm(l[gc],l[gc],c,ss);
353
355
      }
511
513
  for (int i=0; i<ncon; i++) {
512
514
      if (l[i] != s->l[i]) return 0;
513
515
      if (puream[i] != s->puream[i]) return 0;
514
 
      if (exp[i] != s->exp[i]) return 0;
 
516
      if (fabs((exp[i] - s->exp[i])/exp[i]) > 1.0e-13) return 0;
515
517
      for (int j=0; j<nprim; j++) {
516
 
          if (coef[i][j] != s->coef[i][j]) return 0;
517
 
        }
 
518
        if (coef[i][j] != 0.0) { 
 
519
          if (fabs((coef[i][j] - s->coef[i][j])/coef[i][j]) > 1.0e-13) return 0;
 
520
        }
 
521
        else {
 
522
          if (fabs((coef[i][j] - s->coef[i][j])) > 1.0e-13) return 0;
 
523
        }
 
524
      }
518
525
    }
519
526
  return 1;
520
527
}