~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/cchbar/reference.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*! \file
 
2
    \ingroup CCHBAR
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <cstdlib>
 
7
#include <libciomr/libciomr.h>
 
8
#include <libdpd/dpd.h>
 
9
#include <libqt/qt.h>
 
10
#include "MOInfo.h"
 
11
#include "Params.h"
 
12
#define EXTERN
 
13
#include "globals.h"
 
14
 
 
15
namespace psi { namespace cchbar {
 
16
 
 
17
double rhf_energy(void);
 
18
double rohf_energy(void);
 
19
double uhf_energy(void);
 
20
 
 
21
void reference(void)
 
22
{
 
23
  double energy;
 
24
  if(params.ref == 0) energy = (rhf_energy());
 
25
  else if(params.ref == 1) energy = (rohf_energy());
 
26
  else if(params.ref == 2) energy = (uhf_energy());
 
27
 
 
28
  psio_write_entry(CC_HBAR, "Reference expectation value", (char *) &energy,
 
29
    sizeof(double));
 
30
  fprintf(outfile,"Reference expectation value computed: %20.15lf\n", energy);
 
31
}
 
32
 
 
33
double rhf_energy(void)
 
34
{
 
35
  double tauIjAb_energy, tIA_energy;
 
36
  dpdfile2 fIA, tIA;
 
37
  dpdbuf4 tauIjAb, D, E;
 
38
 
 
39
  dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
40
  dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
41
  tIA_energy = 2.0 * dpd_file2_dot(&fIA, &tIA);
 
42
  dpd_file2_close(&fIA);
 
43
  dpd_file2_close(&tIA);
 
44
 
 
45
  dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
 
46
  dpd_buf4_init(&tauIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tauIjAb");
 
47
  tauIjAb_energy = dpd_buf4_dot(&D, &tauIjAb);
 
48
  dpd_buf4_close(&tauIjAb);
 
49
  dpd_buf4_close(&D);
 
50
  
 
51
  /*
 
52
    fprintf(outfile, "Two AB Energy = %20.14f\n", tauIjAb_energy);
 
53
  */
 
54
 
 
55
  return (tauIjAb_energy+tIA_energy);
 
56
}
 
57
 
 
58
double rohf_energy(void)
 
59
{
 
60
  double tIA_energy, tia_energy, tauIJAB_energy, tauijab_energy, tauIjAb_energy;
 
61
  dpdfile2 tIA, tia, fIA, fia;
 
62
  dpdbuf4 tauIJAB, tauijab, tauIjAb, D;
 
63
 
 
64
  dpd_file2_init(&fIA, CC_OEI, 0, 0, 1, "fIA");
 
65
  dpd_file2_init(&tIA, CC_OEI, 0, 0, 1, "tIA");
 
66
  tIA_energy = dpd_file2_dot(&fIA, &tIA);
 
67
  dpd_file2_close(&fIA);
 
68
  dpd_file2_close(&tIA);
 
69
 
 
70
  dpd_file2_init(&fia, CC_OEI, 0, 0, 1, "fia");
 
71
  dpd_file2_init(&tia, CC_OEI, 0, 0, 1, "tia");
 
72
  tia_energy = dpd_file2_dot(&fia, &tia);
 
73
  dpd_file2_close(&fia);
 
74
  dpd_file2_close(&tia);
 
75
 
 
76
  dpd_buf4_init(&D, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <ij||ab> (i>j,a>b)");
 
77
  dpd_buf4_init(&tauIJAB, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tauIJAB");
 
78
  tauIJAB_energy = dpd_buf4_dot(&D, &tauIJAB);
 
79
  dpd_buf4_close(&tauIJAB);
 
80
  dpd_buf4_init(&tauijab, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tauijab");
 
81
  tauijab_energy = dpd_buf4_dot(&D, &tauijab);
 
82
  dpd_buf4_close(&tauijab);
 
83
  dpd_buf4_close(&D);
 
84
 
 
85
  dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
 
86
  dpd_buf4_init(&tauIjAb, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tauIjAb");
 
87
  tauIjAb_energy = dpd_buf4_dot(&D, &tauIjAb);
 
88
  dpd_buf4_close(&tauIjAb);
 
89
  dpd_buf4_close(&D);
 
90
 
 
91
  /*
 
92
  fprintf(outfile, "One A Energy = %20.14f\n", tIA_energy);
 
93
  fprintf(outfile, "One B Energy = %20.14f\n", tia_energy);
 
94
  fprintf(outfile, "Two AA Energy = %20.14f\n", tauIJAB_energy);
 
95
  fprintf(outfile, "Two BB Energy = %20.14f\n", tauijab_energy);
 
96
  fprintf(outfile, "Two AB Energy = %20.14f\n", tauIjAb_energy);
 
97
  */
 
98
 
 
99
  return (tIA_energy + tia_energy +
 
100
          tauIJAB_energy + tauijab_energy + tauIjAb_energy);
 
101
}
 
102
 
 
103
double uhf_energy(void)
 
104
{
 
105
  double E2AA, E2BB, E2AB, T1A, T1B;
 
106
  dpdbuf4 T2, D;
 
107
  dpdfile2 T1, F;
 
108
 
 
109
  dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
 
110
  dpd_file2_init(&T1, CC_OEI, 0, 0, 1, "tIA");
 
111
  T1A = dpd_file2_dot(&F, &T1);
 
112
  dpd_file2_close(&F);
 
113
  dpd_file2_close(&T1);
 
114
 
 
115
  dpd_file2_init(&F, CC_OEI, 0, 2, 3, "fia");
 
116
  dpd_file2_init(&T1, CC_OEI, 0, 2, 3, "tia");
 
117
  T1B = dpd_file2_dot(&F, &T1);
 
118
  dpd_file2_close(&F);
 
119
  dpd_file2_close(&T1);
 
120
 
 
121
  dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tauIJAB");
 
122
  dpd_buf4_init(&D, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <IJ||AB> (I>J,A>B)");
 
123
  E2AA = dpd_buf4_dot(&D, &T2);
 
124
  dpd_buf4_close(&D);
 
125
  dpd_buf4_close(&T2);
 
126
 
 
127
  dpd_buf4_init(&T2, CC_TAMPS, 0, 12, 17, 12, 17, 0, "tauijab");
 
128
  dpd_buf4_init(&D, CC_DINTS, 0, 12, 17, 12, 17, 0, "D <ij||ab> (i>j,a>b)");
 
129
  E2BB = dpd_buf4_dot(&D, &T2);
 
130
  dpd_buf4_close(&D);
 
131
  dpd_buf4_close(&T2);
 
132
 
 
133
  dpd_buf4_init(&T2, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tauIjAb");
 
134
  dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
 
135
  E2AB = dpd_buf4_dot(&D, &T2);
 
136
  dpd_buf4_close(&D);
 
137
  dpd_buf4_close(&T2);
 
138
 
 
139
  /*
 
140
  fprintf(outfile, "One A Energy = %20.14f\n", T1A);
 
141
  fprintf(outfile, "One B Energy = %20.14f\n", T1B);
 
142
  fprintf(outfile, "Two AA Energy = %20.14f\n", E2AA);
 
143
  fprintf(outfile, "Two BB Energy = %20.14f\n", E2BB);
 
144
  fprintf(outfile, "Two AB Energy = %20.14f\n", E2AB);
 
145
  */
 
146
 
 
147
  return(T1A + T1B + E2AA + E2BB + E2AB);
 
148
}
 
149
 
 
150
}} // namespace psi::cchbar