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

« back to all changes in this revision

Viewing changes to src/bin/oeprop/parsing.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 OEPROP
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#define EXTERN
 
6
#include <stdexcept>
 
7
#include "includes.h"
 
8
#include "globals.h"
 
9
#include "prototypes.h"
 
10
 
 
11
namespace psi { namespace oeprop {
 
12
 
 
13
void parsing()
 
14
{
 
15
  int i,errcod;
 
16
  double xmin,xmax,ymin,ymax,zmin,zmax;
 
17
 
 
18
  /* Set some defaults for certain wavefunctions */
 
19
  update_energy_with_MVD = 0;
 
20
 
 
21
  errcod = ip_string("WFN", &wfn, 0);
 
22
 
 
23
  if (errcod == IPE_OK) {
 
24
    if (!strcmp(wfn, "CI") || !strcmp(wfn, "DETCI") ||
 
25
        !strcmp(wfn, "CCSD") || !strcmp(wfn, "DETCAS") ||
 
26
        !strcmp(wfn, "CASSCF") || !strcmp(wfn, "RASSCF") ||
 
27
        !strcmp(wfn, "MP2") || !strcmp(wfn, "EOM_CCSD") ||
 
28
        !strcmp(wfn, "CC2") || !strcmp(wfn, "EOM_CC2") ||
 
29
        !strcmp(wfn, "CCSD_MVD"))  {
 
30
      read_opdm = 1;
 
31
      opdm_file = PSIF_MO_OPDM;
 
32
      corr = 0;
 
33
      opdm_basis = (char *) malloc(3*sizeof(char));
 
34
      strcpy(opdm_basis,"MO");
 
35
      opdm_format = (char *) malloc(7*sizeof(char));
 
36
      strcpy(opdm_format,"SQUARE");
 
37
    }
 
38
    if (!strcmp(wfn, "SCF_MVD") || !strcmp(wfn, "CCSD_MVD"))
 
39
      update_energy_with_MVD = 1;
 
40
  }
 
41
  else {
 
42
    fprintf(outfile,"Incorrect wave function type!\n");
 
43
    abort();
 
44
  }
 
45
 
 
46
  transdens = 0;
 
47
  errcod = ip_boolean("TRANSITION_DENSITY", &transdens, 0);
 
48
  if (transdens)
 
49
    asymm_opdm = 1;
 
50
  else
 
51
    asymm_opdm = 0;
 
52
 
 
53
  errcod = ip_string("REFERENCE", &ref, 0);
 
54
  
 
55
  if (errcod != IPE_OK) {
 
56
    fprintf(outfile,"Incorrect reference!\n");
 
57
    abort();
 
58
  }
 
59
    
 
60
  /* Parsing section */
 
61
 
 
62
  errcod = ip_boolean("READ_OPDM",&read_opdm,0);
 
63
  if (read_opdm) {
 
64
    errcod = ip_data("OPDM_FILE","%d",&opdm_file,0);
 
65
    if ((opdm_file >= PSIO_MAXUNIT) || (opdm_file <= 0))
 
66
      punt("OPDM_FILE out of range");
 
67
    if ((opdm_file != 40) && (opdm_file != 79) && 
 
68
        (opdm_file != PSIF_MO_OPDM)) {
 
69
      errcod = ip_string("OPDM_BASIS",&opdm_basis,0);
 
70
      if ((errcod == IPE_KEY_NOT_FOUND) || (errcod != IPE_OK)) {
 
71
        opdm_basis = (char *) malloc(3*sizeof(char));
 
72
        strcpy(opdm_basis,"AO");
 
73
      }
 
74
      errcod = ip_string("OPDM_FORMAT",&opdm_format,0);
 
75
      if ((errcod == IPE_KEY_NOT_FOUND) || (errcod != IPE_OK)) { 
 
76
        opdm_format = (char *) malloc(7*sizeof(char));
 
77
        strcpy(opdm_format,"TRIANG");
 
78
      }
 
79
    }
 
80
 
 
81
    errcod = ip_boolean("WRTNOS",&wrtnos,0);
 
82
    errcod = ip_boolean("ASYMM_OPDM",&asymm_opdm,0);
 
83
  }
 
84
 
 
85
  errcod = ip_boolean("SPIN_PROP",&spin_prop,0);
 
86
  if (spin_prop && read_opdm)
 
87
    spin_prop = 0;
 
88
  if (iopen == 0)
 
89
    spin_prop = 0;
 
90
 
 
91
  errcod = ip_data("PRINT","%d",&print_lvl,0);
 
92
  if (print_lvl < 0)
 
93
    print_lvl = 1;
 
94
  errcod = ip_boolean("PRINT_NOS",&print_nos,0);
 
95
 
 
96
  errcod = ip_boolean("CORREL_CORR",&corr,0);
 
97
  /*--- corr should be zero since we are not using Psi2 any longer ---*/
 
98
  corr = 0;
 
99
  if (corr) {
 
100
    errcod = ip_data("ZVEC_FILE","%d",&zvec_file,0);
 
101
    if ((zvec_file >= PSIO_MAXUNIT) || (zvec_file <= 0))
 
102
      punt("ZVEC_FILE out of range");
 
103
    errcod = ip_boolean("DELETE_ZVEC",&delete_zvec,0);
 
104
  }
 
105
 
 
106
  errcod = ip_data("MPMAX","%d",&mpmax,0);
 
107
  if (mpmax < 1)
 
108
    mpmax = 1;
 
109
  else if (mpmax > 3)
 
110
    mpmax = 3;
 
111
 
 
112
 
 
113
  if (ip_exist("MP_REF_XYZ",0)) {
 
114
    ip_count("MP_REF_XYZ",&i,0);
 
115
    if (i != 3)
 
116
      punt("MP_REF_XYZ must have 3 components");
 
117
    for (i=0;i<3;i++) {
 
118
      errcod = ip_data("MP_REF_XYZ","%lf",&mp_ref_xyz[i],1,i);
 
119
      if (errcod != IPE_OK)
 
120
        punt("Error in the definition of MP_REF_XYZ");
 
121
    }
 
122
    mp_ref = -1;         /* mp_ref = -1 means that mp_ref_xyz specified by user */
 
123
  }
 
124
  else {
 
125
    errcod = ip_data("MP_REF","%d",&mp_ref,0);
 
126
    if (mp_ref <= 0)             /* Default is COM */
 
127
      mp_ref = 1;
 
128
  }
 
129
 
 
130
  if (ip_exist("LM_REF_XYZ",0)) {
 
131
    ip_count("LM_REF_XYZ",&i,0);
 
132
    if (i != 3)
 
133
      punt("LM_REF_XYZ must have 3 components");
 
134
    for (i=0;i<3;i++) {
 
135
      errcod = ip_data("LM_REF_XYZ","%lf",&Lm_ref_xyz[i],1,i);
 
136
      if (errcod != IPE_OK)
 
137
        punt("Error in the definition of LM_REF_XYZ");
 
138
    }
 
139
  }
 
140
  else {
 
141
    Lm_ref_xyz[0] = Lm_ref_xyz[1] = Lm_ref_xyz[2] = 0.0;
 
142
  }
 
143
 
 
144
  errcod = ip_boolean("NUC_ESP",&nuc_esp,0);
 
145
  if (spin_prop)
 
146
    nuc_esp = 1;
 
147
 
 
148
  fine_structure_alpha = 1.0;
 
149
  errcod = ip_data("FINE_STRUCTURE_ALPHA","%lf",&fine_structure_alpha,0);
 
150
}
 
151
 
 
152
}} // namespace psi::oeprop