1
/*! \defgroup MP2 mp2: Canonical Evaluation of MP2 Energy and Gradients */
6
** \brief Canonical evaluation of MP2 energy and gradients
13
#include <libipv1/ip_lib.h>
14
#include <libciomr/libciomr.h>
15
#include <libdpd/dpd.h>
16
#include <libchkpt/chkpt.h>
18
#include <libiwl/iwl.h>
19
#include <physconst.h>
23
namespace psi{ namespace mp2{
25
void init_io(int argc, char *argv[]);
27
void get_moinfo(void);
28
void get_params(void);
30
int **cacheprep_rhf(int level, int *cachefiles);
31
int **cacheprep_uhf(int level, int *cachefiles);
32
void cachedone_rhf(int **cachelist);
43
void relax_opdm(void);
48
void write_data(void);
49
void check_energy(int);
50
void sort_twopdm(void);
54
}} /* End namespaces */
56
int main(int argc, char *argv[])
58
using namespace psi::mp2;
70
cachefiles = init_int_array(PSIO_MAXUNIT);
72
if(params.ref == 2) { /** UHF **/
73
cachelist = cacheprep_uhf(params.cachelev,cachefiles);
74
dpd_init(0,mo.nirreps,params.memory,params.cachetype,cachefiles,cachelist,
75
NULL,4,mo.aoccpi,mo.aocc_sym,mo.avirpi,mo.avir_sym,mo.boccpi,
76
mo.bocc_sym,mo.bvirpi,mo.bvir_sym);
78
else { /** RHF or ROHF **/
79
cachelist = cacheprep_rhf(params.cachelev,cachefiles);
80
dpd_init(0,mo.nirreps,params.memory,params.cachetype,cachefiles,cachelist,
81
NULL,2,mo.occpi,mo.occ_sym,mo.virpi,mo.vir_sym);
88
fprintf(outfile,"\n");
89
fprintf(outfile,"\tScaled_OS correlation energy = %20.15f\n",mo.escsmp2_os);
90
fprintf(outfile,"\tScaled_SS correlation energy = %20.15f\n",mo.escsmp2_ss);
91
fprintf(outfile,"\tSCS-MP2 correlation energy = %20.15f\n",mo.escsmp2_os+mo.escsmp2_ss);
92
fprintf(outfile," * SCS-MP2 total energy = %20.15f\n",mo.Escf+mo.escsmp2_os+mo.escsmp2_ss);
94
fprintf(outfile,"\n\tOpposite-spin correlation energy = %20.15f\n",mo.emp2_os);
95
fprintf(outfile,"\tSame-spin correlation energy = %20.15f\n",mo.emp2_ss);
96
fprintf(outfile,"\tMP2 correlation energy = %20.15f\n",mo.Emp2);
97
fprintf(outfile," * MP2 total energy = %20.15f\n\n",mo.Escf + mo.Emp2);
100
chkpt_init(PSIO_OPEN_OLD);
101
// Save MP2 contribution to Chkpt
102
chkpt_wt_emp2(mo.Emp2);
103
chkpt_wt_etot(mo.Escf+mo.Emp2);
109
if(params.relax_opdm) {
118
if(params.gradient) {
144
extern "C"{ const char *gprgid() { const char *prgid = "MP2"; return(prgid); } }
146
namespace psi{ namespace mp2{
148
void init_io(int argc, char *argv[])
151
int num_extra_args=0;
155
extra_args = (char **) malloc(argc*sizeof(char *));
156
progid = (char *) malloc(strlen(gprgid())+2);
157
sprintf(progid, ":%s", gprgid());
160
for(i=1; i<argc; i++) {
161
if(strcmp(argv[i], "--opdm") == 0) {
165
extra_args[num_extra_args++] = argv[i];
169
psi_start(&infile,&outfile,&psi_file_prefix,num_extra_args,extra_args,0);
174
psio_init(); psio_ipv1_config();
175
for(i=CC_MIN; i <= CC_MAX; i++)
183
fprintf(outfile, "\t\t\t*************************\n");
184
fprintf(outfile, "\t\t\t* *\n");
185
fprintf(outfile, "\t\t\t* MP2 *\n");
186
fprintf(outfile, "\t\t\t* *\n");
187
fprintf(outfile, "\t\t\t*************************\n");
195
ioff = init_int_array(MAXIOFF);
197
for(i=1; i < MAXIOFF; i++) {
198
ioff[i] = ioff[i-1] + i;
214
for(i=0; i < mo.nirreps; i++)
215
free(mo.irreplabels[i]);
216
free(mo.irreplabels);
219
if(params.ref == 2) {
255
psi_stop(infile,outfile,psi_file_prefix);
258
}} /* End namespaces */