~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/cceom/get_params.c

  • 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
 
#include <stdio.h>
2
 
#include <stdlib.h>
3
 
#include <string.h>
4
 
#include <math.h>
5
 
#include <libipv1/ip_lib.h>
6
 
#include <libciomr/libciomr.h>
7
 
#define EXTERN
8
 
#include "globals.h"
9
 
 
10
 
void get_params(void)
11
 
{
12
 
  int errcod, iconv;
13
 
  char *cachetype = NULL;
14
 
  char *read_ref, *read_eom_ref;
15
 
 
16
 
  errcod = ip_string("WFN", &(params.wfn), 0);
17
 
 
18
 
  if(!strcmp(params.wfn,"EOM_CC2")) {
19
 
    psio_read_entry(CC_INFO, "CC2 Energy", (char *) &(moinfo.ecc),
20
 
                    sizeof(double));
21
 
    fprintf(outfile,"\tCC2 energy          (file100) = %20.15f\n",moinfo.ecc);
22
 
  }
23
 
  else if(!strcmp(params.wfn,"EOM_CCSD")) {
24
 
    psio_read_entry(CC_INFO, "CCSD Energy", (char *) &(moinfo.ecc),
25
 
                    sizeof(double));
26
 
    fprintf(outfile,"\tCCSD energy         (file100) = %20.15f\n",moinfo.ecc);
27
 
  }
28
 
  else if(!strcmp(params.wfn,"EOM_CC3")) {
29
 
    psio_read_entry(CC_INFO, "CC3 Energy", (char *) &(moinfo.ecc),
30
 
                    sizeof(double));
31
 
    fprintf(outfile,"\tCC3 energy          (file100) = %20.15f\n",moinfo.ecc);
32
 
  }
33
 
 
34
 
  params.semicanonical = 0;
35
 
  errcod = ip_string("REFERENCE", &(read_ref),0);
36
 
  if(!strcmp(read_ref, "RHF")) params.ref = 0;
37
 
  else if(!strcmp(read_ref,"ROHF") && (!strcmp(params.wfn,"EOM_CC3"))) {
38
 
    params.ref = 2;
39
 
    params.semicanonical = 1;
40
 
  }
41
 
  else if(!strcmp(read_ref, "ROHF")) params.ref = 1;
42
 
  else if(!strcmp(read_ref, "UHF")) params.ref = 2;
43
 
  else { 
44
 
    fprintf(outfile,
45
 
            "\nInvalid value of input keyword REFERENCE: %s\n", read_ref);
46
 
    exit(2); 
47
 
  }
48
 
 
49
 
  if (params.ref == 0) { /* for RHF refs, allow CCEOM to do RHF, ROHF, UHF modes */
50
 
    errcod = ip_string("EOM_REFERENCE", &(read_eom_ref),0);
51
 
    if (errcod == IPE_OK) {
52
 
      if(!strcmp(read_eom_ref, "RHF")) params.eom_ref = 0;
53
 
      else if(!strcmp(read_eom_ref, "ROHF")) params.eom_ref = 1;
54
 
      else if(!strcmp(read_eom_ref, "UHF")) params.eom_ref = 2;
55
 
      else { 
56
 
        fprintf(outfile,
57
 
                "\nInvalid value of input keyword EOM_REFERENCE: %s\n", read_eom_ref);
58
 
        exit(2); 
59
 
      }
60
 
    }
61
 
    else {
62
 
      params.eom_ref = 0;
63
 
      read_eom_ref = (char *) malloc(10*sizeof(char));
64
 
      sprintf(read_eom_ref,"%s","RHF"); /* just for printing below */
65
 
    }
66
 
  }
67
 
  else if (params.ref == 1) { /* for ROHF refs, allow CCEOM to do ROHF & UHF modes */
68
 
    errcod = ip_string("EOM_REFERENCE", &(read_eom_ref),0);
69
 
    if (errcod == IPE_OK) {
70
 
      if(!strcmp(read_eom_ref, "ROHF")) params.eom_ref = 1;
71
 
      else if(!strcmp(read_eom_ref, "UHF")) params.eom_ref = 2;
72
 
      else { 
73
 
        fprintf(outfile,
74
 
                "\nInvalid value of input keyword EOM_REFERENCE: %s\n", read_eom_ref);
75
 
        exit(2); 
76
 
      }
77
 
    }
78
 
    else {
79
 
      params.eom_ref = 1;
80
 
      read_eom_ref = (char *) malloc(10*sizeof(char));
81
 
      sprintf(read_eom_ref,"%s","ROHF"); /* just for printing below */
82
 
    }
83
 
  }
84
 
  else { /* run in UHF mode - ignore EOM_REFERENCE */
85
 
    params.eom_ref = 2;
86
 
    read_eom_ref = (char *) malloc(10*sizeof(char));
87
 
    sprintf(read_eom_ref,"%s","UHF"); /* just for printing below */
88
 
  }
89
 
 
90
 
  /*  fprintf(outfile, "\nCCEOM not yet UHF capable\n"); */
91
 
 
92
 
  fndcor(&(params.memory),infile,outfile);
93
 
 
94
 
  params.aobasis = 0;
95
 
  errcod = ip_boolean("AO_BASIS", &(params.aobasis),0);
96
 
 
97
 
  params.full_matrix = 0;
98
 
  errcod = ip_boolean("FULL_MATRIX", &(params.full_matrix),0);
99
 
 
100
 
  params.cachelev = 2;
101
 
  errcod = ip_data("CACHELEV", "%d", &(params.cachelev),0);
102
 
 
103
 
  params.cachetype = 0;
104
 
 
105
 
  errcod = ip_string("CACHETYPE", &(cachetype),0);
106
 
  if(cachetype != NULL && strlen(cachetype)) {
107
 
    if(!strcmp(cachetype,"LOW")) params.cachetype = 1;
108
 
    else if(!strcmp(cachetype,"LRU")) params.cachetype = 0;
109
 
    else {
110
 
      fprintf(outfile, "Error in input: invalid CACHETYPE = %s\n",
111
 
              cachetype);
112
 
      exit(1);
113
 
    }
114
 
    free(cachetype);
115
 
  }
116
 
  if(params.ref == 2) /* No LRU cacheing yet for UHF references */
117
 
    params.cachetype = 0;
118
 
 
119
 
  params.cachetype = 0;
120
 
 
121
 
  if(ip_exist("ABCD",0)) {
122
 
    errcod = ip_string("ABCD", &(params.abcd), 0);
123
 
    if(strcmp(params.abcd,"NEW") && strcmp(params.abcd,"OLD")) {
124
 
      fprintf(outfile, "Invalid ABCD algorithm: %s\n", params.abcd);
125
 
      exit(PSI_RETURN_FAILURE);
126
 
    }
127
 
  }
128
 
  else params.abcd = strdup("NEW");
129
 
 
130
 
  params.t3_Ws_incore = 0;
131
 
  errcod = ip_boolean("T3_WS_INCORE", &(params.t3_Ws_incore),0);
132
 
 
133
 
  params.local = 0;
134
 
  errcod = ip_boolean("LOCAL", &(params.local),0);
135
 
 
136
 
  local.cutoff = 0.02;
137
 
  errcod = ip_data("LOCAL_CUTOFF", "%lf", &(local.cutoff), 0);
138
 
 
139
 
  if(ip_exist("LOCAL_METHOD",0)) {
140
 
    errcod = ip_string("LOCAL_METHOD", &(local.method), 0);
141
 
    if(strcmp(local.method,"AOBASIS") && strcmp(local.method,"WERNER")) {
142
 
      fprintf(outfile, "\nInvalid local correlation method: %s\n", local.method);
143
 
      exit(2);
144
 
    }
145
 
  }
146
 
  else if(params.local) {
147
 
    local.method = (char *) malloc(7 * sizeof(char));
148
 
    sprintf(local.method, "%s", "WERNER");
149
 
  }
150
 
 
151
 
  if(ip_exist("LOCAL_WEAKP",0)) {
152
 
    errcod = ip_string("LOCAL_WEAKP", &(local.weakp), 0);
153
 
    if(strcmp(local.weakp,"MP2") && strcmp(local.weakp,"NEGLECT") && strcmp(local.weakp,"NONE")) {
154
 
      fprintf(outfile, "Invalid method for treating local pairs: %s\n", local.weakp);
155
 
      exit(2);
156
 
    }
157
 
  }
158
 
  else if(params.local) {
159
 
    local.weakp = (char *) malloc(5 * sizeof(char));
160
 
    sprintf(local.weakp, "%s", "NONE");
161
 
  }
162
 
 
163
 
  if(ip_exist("LOCAL_PRECONDITIONER",0) && params.local) {
164
 
    errcod = ip_string("LOCAL_PRECONDITIONER", &(local.precon), 0);
165
 
    if(strcmp(local.precon,"FOCK") && strcmp(local.precon,"HBAR")) {
166
 
      fprintf(outfile, "Invalid choice of local-pair preconditioner: %s\n", local.precon);
167
 
      exit(2);
168
 
    }
169
 
  }
170
 
  else if(params.local){
171
 
    local.precon = (char *) malloc(5 * sizeof(char));
172
 
    sprintf(local.precon, "%s", "HBAR");
173
 
  }
174
 
 
175
 
  local.ghost = -1;
176
 
  if(ip_exist("LOCAL_GHOST",0))
177
 
    errcod = ip_data("LOCAL_GHOST", "%d", &(local.ghost), 0);
178
 
 
179
 
  local.do_singles = 1;
180
 
  errcod = ip_boolean("LOCAL_DO_SINGLES", &(local.do_singles), 0);
181
 
 
182
 
  local.filter_singles = 1;
183
 
  ip_boolean("LOCAL_FILTER_SINGLES", &(local.filter_singles), 0);
184
 
 
185
 
  fprintf(outfile, "\n\tInput parameters:\n");
186
 
  fprintf(outfile, "\t-----------------\n");
187
 
  if(params.semicanonical)
188
 
    fprintf(outfile, "\tReference wfn   = ROHF changed to UHF for Semicanonical Orbitals\n");
189
 
  else 
190
 
    fprintf(outfile, "\tReference wfn   =    %4s\n", read_ref);
191
 
  fprintf(outfile, "\tReference EOM wfn=    %4s\n", read_eom_ref);
192
 
  fprintf(outfile, "\tMemory (Mbytes) =  %5.1f\n",params.memory/1e6);
193
 
  fprintf(outfile, "\tAO Basis        =     %s\n", 
194
 
          params.aobasis ? "Yes" : "No");
195
 
  fprintf(outfile, "\tABCD            =     %s\n", params.abcd);
196
 
  fprintf(outfile, "\tCache Level     =    %1d\n", 
197
 
          params.cachelev);
198
 
  fprintf(outfile, "\tCache Type      =    %4s\n", 
199
 
          params.cachetype ? "LOW" : "LRU");
200
 
  if ( !strcmp(params.wfn,"EOM_CC3") )
201
 
    fprintf(outfile, "\tT3 Ws incore    =    %4s\n", params.t3_Ws_incore ? "Yes" : "No");
202
 
  fprintf(outfile, "\tLocal CC        =     %s\n", params.local ? "Yes" : "No");
203
 
  if(params.local) {
204
 
    fprintf(outfile, "\tLocal Cutoff    = %3.1e\n", local.cutoff);
205
 
    fprintf(outfile, "\tLocal Method    =    %s\n", local.method);
206
 
    fprintf(outfile, "\tWeak pairs      =    %s\n", local.weakp);
207
 
    fprintf(outfile, "\tLocal precon.   =    %s\n", local.precon);
208
 
    fprintf(outfile, "\tGhost atom      =    %d\n", local.ghost);
209
 
    fprintf(outfile, "\tLocal guess     =    %s\n", 
210
 
            local.do_singles ? "HBAR_SS" : "UNIT VECTORS" );
211
 
    fprintf(outfile, "\tFilter singles  =    %s\n", local.filter_singles ? "Yes" : "No");
212
 
  }
213
 
  fprintf(outfile, "\n");
214
 
 
215
 
  free(read_ref);
216
 
  free(read_eom_ref);
217
 
}
218