~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

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