~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/bin/cceom/write_Rs.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 CCEOM
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
/*
 
6
 *   write_Rs writes out all of the converged R's to RAMPS for the current irrep
 
7
 */
 
8
 
 
9
#include <cstdio>
 
10
#include <cstring>
 
11
#include <cmath>
 
12
#include <libchkpt/chkpt.h>
 
13
#include "MOInfo.h"
 
14
#include "Params.h"
 
15
#include "Local.h"
 
16
#define EXTERN
 
17
#include "globals.h"
 
18
 
 
19
namespace psi { namespace cceom {
 
20
 
 
21
void write_Rs(int C_irr, double *evals, int *converged) {
 
22
  int i;
 
23
  dpdfile2 CME, Cme;
 
24
  dpdbuf4 CMNEF, Cmnef, CMnEf;
 
25
  int R_index = -1;
 
26
  char C_lbl[32], R_lbl[32], E_lbl[32];
 
27
  double etot, expectation_val, C0;
 
28
 
 
29
  for (i=0; i<eom_params.cs_per_irrep[C_irr]; ++i) {
 
30
    if (!converged[i]) continue; /* this root did not converge */
 
31
    ++R_index;
 
32
 
 
33
    if (C_irr == eom_params.prop_sym) {
 
34
                  if (i == eom_params.prop_root) {
 
35
        chkpt_init(PSIO_OPEN_OLD);
 
36
        if (!params.full_matrix) {
 
37
                            etot = evals[eom_params.prop_root]+moinfo.ecc+moinfo.eref;
 
38
                    } else {
 
39
                            etot = evals[eom_params.prop_root]+moinfo.eref;
 
40
                          }
 
41
        chkpt_wt_etot(etot);
 
42
        fprintf(outfile,"Energy written to chkpt:Etot %15.10lf\n", etot);
 
43
        chkpt_close();
 
44
                        }
 
45
    }
 
46
    /* cclambda expects excitation energies */
 
47
    if (!params.full_matrix) {
 
48
      etot = evals[i];
 
49
    } 
 
50
    else {
 
51
      psio_read_entry(CC_HBAR, "Reference expectation value",
 
52
                      (char *) &(expectation_val), sizeof(double));
 
53
      etot = evals[i] - expectation_val;
 
54
    }
 
55
 
 
56
    if(!strcmp(params.wfn,"EOM_CC2")) {
 
57
      sprintf(E_lbl, "EOM CC2 Energy for root %d %d", C_irr, R_index);
 
58
      psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
 
59
    }
 
60
    else if(!strcmp(params.wfn,"EOM_CCSD")) {
 
61
      sprintf(E_lbl, "EOM CCSD Energy for root %d %d", C_irr, R_index);
 
62
      psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
 
63
    }
 
64
    else if(!strcmp(params.wfn,"EOM_CC3")) {
 
65
      sprintf(E_lbl, "EOM CC3 Energy for root %d %d", C_irr, R_index);
 
66
      psio_write_entry(CC_INFO, E_lbl, (char *) &etot, sizeof(double));
 
67
    }
 
68
 
 
69
    sprintf(C_lbl, "CME %d", i);
 
70
    sprintf(R_lbl, "RIA %d %d", C_irr, R_index);
 
71
 
 
72
    dpd_file2_init(&CME, EOM_CME, C_irr, 0, 1, C_lbl);
 
73
    dpd_file2_copy(&CME, CC_RAMPS, R_lbl);
 
74
    dpd_file2_close(&CME);
 
75
 
 
76
    if (params.full_matrix) {
 
77
      sprintf(C_lbl, "C0 %d", i);
 
78
      psio_read_entry(EOM_CME, C_lbl, (char *) &C0, sizeof(double));
 
79
      sprintf(R_lbl, "R0 %d %d", C_irr, R_index);
 
80
      psio_write_entry(CC_RAMPS, R_lbl, (char *) &C0, sizeof(double));
 
81
    }
 
82
 
 
83
    sprintf(C_lbl, "CMnEf %d", i);
 
84
    sprintf(R_lbl, "RIjAb %d %d", C_irr, R_index);
 
85
    if (params.eom_ref <= 1)
 
86
      dpd_buf4_init(&CMnEf, EOM_CMnEf, C_irr, 0, 5, 0, 5, 0, C_lbl);
 
87
    else if (params.eom_ref == 2)
 
88
      dpd_buf4_init(&CMnEf, EOM_CMnEf, C_irr, 22, 28, 22, 28, 0, C_lbl);
 
89
    dpd_buf4_copy(&CMnEf, CC_RAMPS, R_lbl);
 
90
    dpd_buf4_close(&CMnEf);
 
91
          
 
92
    if(params.eom_ref > 0) {
 
93
      sprintf(C_lbl, "Cme %d", i);
 
94
      sprintf(R_lbl, "Ria %d %d", C_irr, R_index);
 
95
      if (params.eom_ref == 1)
 
96
         dpd_file2_init(&Cme, EOM_Cme, C_irr, 0, 1, C_lbl);
 
97
      else if (params.eom_ref == 2)
 
98
         dpd_file2_init(&Cme, EOM_Cme, C_irr, 2, 3, C_lbl);
 
99
      dpd_file2_copy(&Cme, CC_RAMPS, R_lbl);
 
100
      dpd_file2_close(&Cme);
 
101
 
 
102
      sprintf(C_lbl, "CMNEF %d", i);
 
103
      sprintf(R_lbl, "RIJAB %d %d", C_irr, R_index);
 
104
 
 
105
      dpd_buf4_init(&CMNEF, EOM_CMNEF, C_irr, 2, 7, 2, 7, 0, C_lbl);
 
106
      dpd_buf4_copy(&CMNEF, CC_RAMPS, R_lbl);
 
107
      dpd_buf4_close(&CMNEF);
 
108
 
 
109
      sprintf(C_lbl, "Cmnef %d", i);
 
110
      sprintf(R_lbl, "Rijab %d %d", C_irr, R_index);
 
111
 
 
112
      if (params.eom_ref == 1)
 
113
        dpd_buf4_init(&Cmnef, EOM_Cmnef, C_irr, 2, 7, 2, 7, 0, C_lbl);
 
114
      else if (params.eom_ref ==2)
 
115
        dpd_buf4_init(&Cmnef, EOM_Cmnef, C_irr, 12, 17, 12, 17, 0, C_lbl);
 
116
        dpd_buf4_copy(&Cmnef, CC_RAMPS, R_lbl);
 
117
        dpd_buf4_close(&Cmnef);
 
118
    }
 
119
  }
 
120
}
 
121
 
 
122
}} // namespace psi::cceom