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

« back to all changes in this revision

Viewing changes to src/bin/ccenergy/mp2_energy.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 CCENERGY
 
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 "Params.h"
 
11
#define EXTERN
 
12
#include "globals.h"
 
13
#include "MOInfo.h"
 
14
 
 
15
namespace psi { namespace ccenergy {
 
16
 
 
17
double rhf_mp2_energy(void);
 
18
double uhf_mp2_energy(void);
 
19
 
 
20
double mp2_energy(void)
 
21
{
 
22
        /* Note that if we reach this point and ref=1 (ROHF), then we aren't using 
 
23
         * semicanonical orbitals and so we can't compute a non-iterative MBPT(2) 
 
24
         * energy */
 
25
  if(params.ref == 0) return(rhf_mp2_energy());
 
26
  else if(params.ref == 2) return(uhf_mp2_energy());
 
27
  else return 0.0;
 
28
  
 
29
}
 
30
 
 
31
double rhf_mp2_energy(void)
 
32
{
 
33
  double T2_energy, T1_energy;
 
34
  dpdfile2 F, T1, D1;
 
35
  dpdbuf4 T2, D;
 
36
  dpdbuf4 S;
 
37
  double os_energy, ss_energy, scs_energy;
 
38
  
 
39
  /* Initialize MP2 T1 Amps (zero for true HF references) */
 
40
  dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
 
41
  dpd_file2_copy(&F, CC_OEI, "tIA (MP2)");
 
42
  dpd_file2_close(&F);
 
43
  dpd_file2_init(&T1, CC_OEI, 0, 0, 1, "tIA (MP2)");
 
44
  dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "dIA");
 
45
  dpd_file2_dirprd(&D1, &T1);
 
46
  dpd_file2_close(&D1);  
 
47
  dpd_file2_close(&T1);
 
48
 
 
49
  dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
 
50
  dpd_file2_init(&T1, CC_OEI, 0, 0, 1, "tIA (MP2)");
 
51
  T1_energy = 2.0 * dpd_file2_dot(&F, &T1);
 
52
  dpd_file2_close(&F);
 
53
  dpd_file2_close(&T1);
 
54
 
 
55
  /* Initialize MP2 T2 Amps */
 
56
  dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
 
57
  dpd_buf4_copy(&D, CC_TAMPS, "tIjAb (MP2)");
 
58
  dpd_buf4_close(&D);
 
59
  dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb (MP2)");
 
60
  dpd_buf4_init(&D, CC_DENOM, 0, 0, 5, 0, 5, 0, "dIjAb");
 
61
  dpd_buf4_dirprd(&D, &T2);
 
62
  dpd_buf4_close(&D);
 
63
  dpd_buf4_close(&T2);
 
64
  
 
65
  dpd_buf4_init(&D, CC_DINTS, 0, 0, 5, 0, 5, 0, "D 2<ij|ab> - <ij|ba>");
 
66
  dpd_buf4_init(&T2, CC_TAMPS, 0, 0, 5, 0, 5, 0, "tIjAb (MP2)");
 
67
  T2_energy = dpd_buf4_dot(&D, &T2);
 
68
 
 
69
  dpd_buf4_init(&S, CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>");
 
70
  os_energy = dpd_buf4_dot(&S, &T2);
 
71
  dpd_buf4_close(&S);
 
72
  ss_energy = (T2_energy - os_energy);
 
73
 
 
74
  moinfo.emp2_ss = ss_energy;
 
75
  moinfo.emp2_os = os_energy;
 
76
 
 
77
  if (params.scs == 1) {
 
78
    os_energy = params.scsmp2_scale_os * os_energy;
 
79
    ss_energy = params.scsmp2_scale_ss * ss_energy;
 
80
  }
 
81
 
 
82
  else {
 
83
    os_energy = (6.0/5.6) * os_energy;
 
84
    ss_energy = (1.0/3.0) * ss_energy;
 
85
  }
 
86
 
 
87
  moinfo.escsmp2_ss = ss_energy;
 
88
  moinfo.escsmp2_os = os_energy;
 
89
 
 
90
  dpd_buf4_close(&T2);
 
91
  dpd_buf4_close(&D);
 
92
  
 
93
  return (T2_energy+T1_energy);
 
94
}
 
95
 
 
96
double uhf_mp2_energy(void)
 
97
{
 
98
  double E2AA, E2BB, E2AB, T1A, T1B;
 
99
  dpdbuf4 T2, D;
 
100
  dpdfile2 T1, F, D1;
 
101
  
 
102
  /* Initialize MP2 T1 Amps (zero for true HF references) */
 
103
  dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
 
104
  dpd_file2_copy(&F, CC_OEI, "tIA (MP2)");
 
105
  dpd_file2_close(&F);
 
106
  dpd_file2_init(&T1, CC_OEI, 0, 0, 1, "tIA (MP2)");
 
107
  dpd_file2_init(&D1, CC_OEI, 0, 0, 1, "dIA");
 
108
  dpd_file2_dirprd(&D1, &T1);
 
109
  dpd_file2_close(&D1);  
 
110
  dpd_file2_close(&T1);
 
111
  
 
112
  dpd_file2_init(&F, CC_OEI, 0, 2, 3, "fia");
 
113
  dpd_file2_copy(&F, CC_OEI, "tia (MP2)");
 
114
  dpd_file2_close(&F);
 
115
  dpd_file2_init(&T1, CC_OEI, 0, 2, 3, "tia (MP2)");
 
116
  dpd_file2_init(&D1, CC_OEI, 0, 2, 3, "dia");
 
117
  dpd_file2_dirprd(&D1, &T1);
 
118
  dpd_file2_close(&D1);  
 
119
  dpd_file2_close(&T1);
 
120
  
 
121
  dpd_file2_init(&F, CC_OEI, 0, 0, 1, "fIA");
 
122
  dpd_file2_init(&T1, CC_OEI, 0, 0, 1, "tIA (MP2)");
 
123
  T1A = dpd_file2_dot(&F, &T1);
 
124
  dpd_file2_close(&F);
 
125
  dpd_file2_close(&T1);
 
126
 
 
127
  dpd_file2_init(&F, CC_OEI, 0, 2, 3, "fia");
 
128
  dpd_file2_init(&T1, CC_OEI, 0, 2, 3, "tia (MP2)");
 
129
  T1B = dpd_file2_dot(&F, &T1);
 
130
  dpd_file2_close(&F);
 
131
  dpd_file2_close(&T1);
 
132
 
 
133
  dpd_buf4_init(&D, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <IJ||AB> (I>J,A>B)");
 
134
  dpd_buf4_copy(&D, CC_TAMPS, "tIJAB (MP2)");
 
135
  dpd_buf4_close(&D);
 
136
  dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB (MP2)");
 
137
  dpd_buf4_init(&D, CC_DENOM, 0, 2, 7, 2, 7, 0, "dIJAB");
 
138
  dpd_buf4_dirprd(&D, &T2);
 
139
  dpd_buf4_close(&D);
 
140
  dpd_buf4_close(&T2);
 
141
 
 
142
  dpd_buf4_init(&D, CC_DINTS, 0, 12, 17, 12, 17, 0, "D <ij||ab> (i>j,a>b)");
 
143
  dpd_buf4_copy(&D, CC_TAMPS, "tijab (MP2)");
 
144
  dpd_buf4_close(&D);
 
145
  dpd_buf4_init(&T2, CC_TAMPS, 0, 12, 17, 12, 17, 0, "tijab (MP2)");
 
146
  dpd_buf4_init(&D, CC_DENOM, 0, 12, 17, 12, 17, 0, "dijab");
 
147
  dpd_buf4_dirprd(&D, &T2);
 
148
  dpd_buf4_close(&D);
 
149
  dpd_buf4_close(&T2);
 
150
 
 
151
  dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
 
152
  dpd_buf4_copy(&D, CC_TAMPS, "tIjAb (MP2)");
 
153
  dpd_buf4_close(&D);
 
154
  dpd_buf4_init(&T2, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb (MP2)");
 
155
  dpd_buf4_init(&D, CC_DENOM, 0, 22, 28, 22, 28, 0, "dIjAb");
 
156
  dpd_buf4_dirprd(&D, &T2);
 
157
  dpd_buf4_close(&D);
 
158
  dpd_buf4_close(&T2);
 
159
 
 
160
  dpd_buf4_init(&T2, CC_TAMPS, 0, 2, 7, 2, 7, 0, "tIJAB (MP2)");
 
161
  dpd_buf4_init(&D, CC_DINTS, 0, 2, 7, 2, 7, 0, "D <IJ||AB> (I>J,A>B)");
 
162
  E2AA = dpd_buf4_dot(&D, &T2);
 
163
  dpd_buf4_close(&D);
 
164
  dpd_buf4_close(&T2);
 
165
 
 
166
  dpd_buf4_init(&T2, CC_TAMPS, 0, 12, 17, 12, 17, 0, "tijab (MP2)");
 
167
  dpd_buf4_init(&D, CC_DINTS, 0, 12, 17, 12, 17, 0, "D <ij||ab> (i>j,a>b)");
 
168
  E2BB = dpd_buf4_dot(&D, &T2);
 
169
  dpd_buf4_close(&D);
 
170
  dpd_buf4_close(&T2);
 
171
 
 
172
  dpd_buf4_init(&T2, CC_TAMPS, 0, 22, 28, 22, 28, 0, "tIjAb (MP2)");
 
173
  dpd_buf4_init(&D, CC_DINTS, 0, 22, 28, 22, 28, 0, "D <Ij|Ab>");
 
174
  E2AB = dpd_buf4_dot(&D, &T2);
 
175
  dpd_buf4_close(&D);
 
176
  dpd_buf4_close(&T2);
 
177
 
 
178
  return(T1A + T1B + E2AA + E2BB + E2AB);
 
179
}
 
180
}} // namespace psi::ccenergy