~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/dboc/overlap.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include <libqt/qt.h>
7
7
#include <psifiles.h>
8
8
}
 
9
#include "defines.h"
9
10
#include "params.h"
10
11
#include "mo_overlap.h"
11
12
 
13
14
extern FILE *outfile;
14
15
 
15
16
extern void done(const char *);
16
 
extern double eval_rhf_derwfn_overlap();
17
 
extern double eval_rohf_derwfn_overlap();
18
 
extern double eval_uhf_derwfn_overlap();
19
 
extern double eval_rccsd_derwfn_overlap();
20
 
extern double eval_rci_derwfn_overlap();
21
 
extern double eval_roci_derwfn_overlap();
 
17
extern double eval_rhf_derwfn_overlap(DisplacementIndex LDisp, DisplacementIndex RDisp);
 
18
extern double eval_rohf_derwfn_overlap(DisplacementIndex LDisp, DisplacementIndex RDisp);
 
19
extern double eval_uhf_derwfn_overlap(DisplacementIndex LDisp, DisplacementIndex RDisp);
 
20
extern double eval_rci_derwfn_overlap(DisplacementIndex LDisp, DisplacementIndex RDisp);
 
21
extern double eval_roci_derwfn_overlap(DisplacementIndex LDisp, DisplacementIndex RDisp);
22
22
 
23
 
double eval_derwfn_overlap()
 
23
double eval_derwfn_overlap(bool symm)
24
24
{
 
25
  // Pointer to the function that we need to use
 
26
  double (*eval_overlap)(DisplacementIndex, DisplacementIndex);
 
27
 
25
28
  double S;
26
29
 
27
30
  if (!strcmp(Params.wfn,"SCF")) {
28
31
    if (Params.reftype == Params_t::rhf) {
29
 
      S = eval_rhf_derwfn_overlap();
 
32
      eval_overlap = eval_rhf_derwfn_overlap;
30
33
    }
31
34
    else if (Params.reftype == Params_t::rohf) {
32
 
      S = eval_rohf_derwfn_overlap();
 
35
      eval_overlap = eval_rohf_derwfn_overlap;
33
36
    }
34
37
    else if (Params.reftype == Params_t::uhf) {
35
 
      S = eval_uhf_derwfn_overlap();
 
38
      eval_overlap = eval_uhf_derwfn_overlap;
36
39
    }
37
40
    else
38
41
      done("This HF SCF method is not supported at the moment");
39
42
  }
40
43
  else if (!strcmp(Params.wfn,"CCSD")) {
41
 
    if (Params.reftype == Params_t::rhf) {
42
 
      //      S = eval_rccsd_derwfn_overlap();
43
 
    }
44
 
    else
45
 
      done("CCSD method with this reference is not supported at the moment");
 
44
    done("CCSD method with this reference is not supported at the moment");
46
45
  }
47
46
  else if (!strcmp(Params.wfn,"DETCI") || !strcmp(Params.wfn,"DETCAS")) {
48
47
    if (Params.reftype == Params_t::rhf) {
49
 
      S = eval_rci_derwfn_overlap();
 
48
      eval_overlap = eval_rci_derwfn_overlap;
50
49
    }
51
50
    else if (Params.reftype == Params_t::rohf) {
52
 
      S = eval_roci_derwfn_overlap();
 
51
      eval_overlap = eval_roci_derwfn_overlap;
53
52
    }
54
53
    else
55
54
      done("CI method with this reference is not supported at the moment");
56
55
  }
57
56
 
 
57
  //
 
58
  // Only need (+Delta|-Delta) overlap if using a 2-point formula
 
59
  //
 
60
  if (Params.disp_per_coord == 2) {
 
61
    double S_P1_M1 = eval_overlap(PlusDelta,MinusDelta);
 
62
    if (Params.print_lvl >= PrintLevels::print_contrib) {
 
63
      fprintf(outfile,"  +1 -1 wave function overlap = %25.15lf\n",S_P1_M1);
 
64
    }
 
65
    S = (1.0-S_P1_M1)/(2.0*Params.delta*Params.delta);
 
66
  }
 
67
  //
 
68
  // Need up to 6 different overlaps if using a 4-point formula
 
69
  //
 
70
  else if (Params.disp_per_coord == 4) {
 
71
    double S_P1_M1 = eval_overlap(PlusDelta,MinusDelta);
 
72
    double S_P2_M2 = eval_overlap(Plus2Delta,Minus2Delta);
 
73
    double S_P2_M1 = eval_overlap(Plus2Delta,MinusDelta);
 
74
    double S_P2_P1 = eval_overlap(Plus2Delta,PlusDelta);
 
75
    double S_M2_P1, S_M2_M1;
 
76
    if (!symm) {
 
77
      S_M2_P1 = eval_overlap(Minus2Delta,PlusDelta);
 
78
      S_M2_M1 = eval_overlap(Minus2Delta,MinusDelta);
 
79
    }
 
80
    else {
 
81
      S_M2_P1 = S_P2_M1;
 
82
      S_M2_M1 = S_P2_P1;
 
83
    }
 
84
 
 
85
    if (Params.print_lvl >= PrintLevels::print_contrib) {
 
86
      fprintf(outfile,"  +1 -1 wave function overlap = %25.15lf\n",S_P1_M1);
 
87
      fprintf(outfile,"  +2 -2 wave function overlap = %25.15lf\n",S_P2_M2);
 
88
      fprintf(outfile,"  +2 -1 wave function overlap = %25.15lf\n",S_P2_M1);
 
89
      fprintf(outfile,"  -2 +1 wave function overlap = %25.15lf\n",S_M2_P1);
 
90
      fprintf(outfile,"  +2 +1 wave function overlap = %25.15lf\n",S_P2_P1);
 
91
      fprintf(outfile,"  -2 -1 wave function overlap = %25.15lf\n",S_M2_M1);
 
92
    }
 
93
 
 
94
    S = (128.0*(1.0-S_P1_M1) + 2.0*(1.0-S_P2_M2) + 16.0*((S_P2_M1 - S_P2_P1) + (S_M2_P1 - S_M2_M1)))/
 
95
        (144.0 * Params.delta*Params.delta);
 
96
  }
 
97
 
58
98
  return S;
59
99
}