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

« back to all changes in this revision

Viewing changes to src/bin/mp2/get_params.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 MP2
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <cstdlib>
 
7
#include <cstring>
 
8
#include <libipv1/ip_lib.h>
 
9
#include <libciomr/libciomr.h>
 
10
#include <libchkpt/chkpt.h>
 
11
#include <libpsio/psio.h>
 
12
#include <libqt/qt.h>
 
13
#include <psifiles.h>
 
14
#define EXTERN
 
15
#include "globals.h"
 
16
 
 
17
namespace psi{ namespace mp2{
 
18
 
 
19
void get_params()
 
20
{
 
21
  int errcod;
 
22
  char *cachetype = NULL;
 
23
  char *junk;
 
24
  
 
25
  errcod = ip_string("WFN", &(params.wfn), 0);
 
26
 
 
27
  errcod = ip_string("REFERENCE", &(junk),0);
 
28
 
 
29
  /* Default reference is RHF */
 
30
  params.ref = 0;
 
31
  params.semicanonical = 0;
 
32
  if(!strcmp(junk,"RHF")) params.ref = 0;
 
33
  else if(!strcmp(junk,"ROHF") && !strcmp(params.wfn,"MP2")) {
 
34
    params.ref = 2;
 
35
    params.semicanonical = 1;
 
36
  }
 
37
  else if(!strcmp(junk,"ROHF")) params.ref = 1;
 
38
  else if(!strcmp(junk,"UHF")) params.ref = 2;
 
39
  else {
 
40
    fprintf(outfile,"\nInvalid Reference: %s\n",junk);
 
41
    exit(PSI_RETURN_FAILURE);
 
42
  }
 
43
  free(junk);
 
44
  
 
45
  /* Default Jobtype */
 
46
  if(ip_exist("JOBTYPE",0)) {
 
47
    ip_string("JOBTYPE", &(params.jobtype),0);
 
48
  }
 
49
  else {
 
50
    params.jobtype = strdup("SP");
 
51
  }
 
52
    
 
53
  /* Default Dertype */
 
54
  if(ip_exist("DERTYPE",0)) {
 
55
    ip_string("DERTYPE", &(params.dertype),0);
 
56
  }
 
57
  else {
 
58
    params.dertype = strdup("NONE");
 
59
  }
 
60
 
 
61
  if(!strcmp(params.jobtype,"SP")) {
 
62
    params.opdm = 0;
 
63
    params.relax_opdm = 0;
 
64
    params.gradient = 0;
 
65
  }
 
66
  else if(!strcmp(params.jobtype,"OEPROP") && !strcmp(params.dertype,"NONE")) {
 
67
    params.opdm = 1;
 
68
    params.relax_opdm = 0;
 
69
    params.gradient = 0;
 
70
  }
 
71
  else if(!strcmp(params.jobtype,"OEPROP") && !strcmp(params.dertype,"FIRST")) {
 
72
    params.opdm = 1;
 
73
    params.relax_opdm = 1;
 
74
    params.gradient = 0;
 
75
  }
 
76
  else if(!strcmp(params.jobtype,"OPT") && !strcmp(params.dertype,"NONE")) {
 
77
    params.opdm = 0;
 
78
    params.relax_opdm = 0;
 
79
    params.gradient = 0;
 
80
  }
 
81
  else if(!strcmp(params.jobtype,"OPT") && !strcmp(params.dertype,"FIRST")) {
 
82
    params.opdm = 0;
 
83
    params.relax_opdm = 0;
 
84
    params.gradient = 1;
 
85
  }
 
86
  else if(!strcmp(params.jobtype,"SYMM_FC") && !strcmp(params.dertype,"FIRST")) {
 
87
    params.opdm = 0;
 
88
    params.relax_opdm = 0;
 
89
    params.gradient = 1;
 
90
  }
 
91
  else if(!strcmp(params.jobtype,"FREQ") && !strcmp(params.dertype,"NONE")) {
 
92
    params.opdm = 0;
 
93
    params.relax_opdm = 0;
 
94
    params.gradient = 0;
 
95
  }
 
96
  else if(!strcmp(params.jobtype,"FREQ") && !strcmp(params.dertype,"FIRST")) {
 
97
    params.opdm = 0;
 
98
    params.relax_opdm = 0;
 
99
    params.gradient = 1;
 
100
  }
 
101
  else {
 
102
    printf("Invalid combination of JOBTYPE and DERTYPE\n");
 
103
    exit(PSI_RETURN_FAILURE);
 
104
  }
 
105
 
 
106
  if((params.relax_opdm || params.gradient) && 
 
107
     (mo.nfzdocc != 0 || mo.nfzvirt != 0)) {
 
108
    fprintf(outfile,"\n\tThe Z-vector equations DO NOT work with frozen orbitals ... yet\n");
 
109
    exit(PSI_RETURN_FAILURE);
 
110
  }
 
111
 
 
112
  params.print = 0;
 
113
  ip_data("PRINT", "%d", &(params.print),0);
 
114
  
 
115
  params.cachelev = 2;
 
116
  ip_data("CACHELEV", "%d", &(params.cachelev),0);
 
117
  
 
118
  params.cachetype = 1;
 
119
  errcod = ip_string("CACHETYPE", &(cachetype),0);
 
120
  if (cachetype != NULL && strlen(cachetype)) {
 
121
    if (!strcmp(cachetype,"LOW")) 
 
122
      params.cachetype = 1;
 
123
    else if (!strcmp(cachetype,"LRU")) 
 
124
      params.cachetype = 0;
 
125
    else {
 
126
      fprintf(outfile, "Invalide CACHETYPE = %s\n",cachetype);
 
127
      abort();
 
128
    }
 
129
    free(cachetype);
 
130
  }
 
131
  
 
132
  /* get parameters related to SCS-MP2 or SCS-N-MP2 */
 
133
  /* see papers by S. Grimme or J. Platz */
 
134
  params.scs = 0;
 
135
  params.scs_scale_os = 6.0/5.0;
 
136
  params.scs_scale_ss = 1.0/3.0;
 
137
  errcod = ip_boolean("SCS_N",&(params.scs),0);
 
138
  if (params.scs == 1) {
 
139
    params.scs_scale_os = 0.0;
 
140
    params.scs_scale_ss = 1.76;
 
141
  }
 
142
  errcod = ip_boolean("SCS",&(params.scs),0);
 
143
  if (params.scs == 1) { 
 
144
    errcod = ip_data("SCALE_OS","%lf",&(params.scs_scale_os),0); 
 
145
    errcod = ip_data("SCALE_SS","%lf",&(params.scs_scale_ss),0); 
 
146
    }
 
147
 
 
148
  fndcor(&(params.memory),infile,outfile);
 
149
 
 
150
  fprintf(outfile, "\n");
 
151
  fprintf(outfile, "\tInput parameters:\n");
 
152
  fprintf(outfile, "\t-----------------\n");
 
153
  fprintf(outfile, "\tWave function \t=\t%s\n", params.wfn);
 
154
  if(params.semicanonical) {
 
155
  fprintf(outfile, "\tReference WFN \t=\tROHF changed to UHF for Semicanonical Orbitals\n");
 
156
  }
 
157
  else {
 
158
  fprintf(outfile, "\tReference WFN \t=\t%s\n", (params.ref==0)?"RHF":((params.ref==1)?"ROHF":"UHF"));
 
159
  } 
 
160
  fprintf(outfile, "\tDerivative    \t=\t%s\n", params.dertype);
 
161
  fprintf(outfile, "\tCache Level   \t=\t%d\n", params.cachelev);
 
162
  fprintf(outfile, "\tCache Type    \t=\t%s\n", params.cachetype ? "LOW":"LRU");
 
163
  fprintf(outfile, "\tMemory (MB)   \t=\t%.1f\n",params.memory/1e6);
 
164
  fprintf(outfile, "\tPrint Level   \t=\t%d\n", params.print);
 
165
  fprintf(outfile, "\tOPDM          \t=\t%s\n", params.opdm ? "YES":"NO");
 
166
  fprintf(outfile, "\tSCS           \t=\t%s\n", (params.scs == 1) ? "True" : "False");
 
167
  fprintf(outfile, "\tSCALE_OS      \t=\t%.6f\n",params.scs_scale_os);
 
168
  fprintf(outfile, "\tSCALE_SS      \t=\t%.6f\n",params.scs_scale_ss);
 
169
 
 
170
  if (params.scs && (strcmp(params.dertype,"NONE")!=0)) {
 
171
    fprintf(outfile,"\nWarning: SCS-MP2 computation requested but\n");
 
172
    fprintf(outfile,"derivative will be evaluated for standard MP2 energy.\n");
 
173
  }
 
174
 
 
175
}
 
176
 
 
177
}} /* End namespaces */