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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <string.h>
2
4
#include <math.h>
3
5
#include <libipv1/ip_lib.h>
4
6
#include <libciomr/libciomr.h>
9
11
void get_params()
10
12
{
11
13
  int errcod, tol;
 
14
  char *junk;
 
15
 
 
16
  errcod = ip_string("WFN", &(params.wfn), 0);
 
17
 
 
18
  if(!strcmp(params.wfn,"CC2") || !strcmp(params.wfn,"EOM_CC2")) {
 
19
    psio_read_entry(CC_INFO, "CC2 Energy", (char *) &(moinfo.ecc),
 
20
                    sizeof(double));
 
21
    fprintf(outfile,  "\tCC2 energy          (CC_INFO) = %20.15f\n",moinfo.ecc);
 
22
    fprintf(outfile,  "\tTotal CC2 energy    (CC_INFO) = %20.15f\n",
 
23
            moinfo.eref+moinfo.ecc);
 
24
  }
 
25
  else if(!strcmp(params.wfn,"CCSD") || !strcmp(params.wfn,"EOM_CCSD")) {
 
26
    psio_read_entry(CC_INFO, "CCSD Energy", (char *) &(moinfo.ecc),
 
27
                    sizeof(double));
 
28
    fprintf(outfile,  "\tCCSD energy         (CC_INFO) = %20.15f\n",moinfo.ecc);
 
29
    fprintf(outfile,  "\tTotal CCSD energy   (CC_INFO) = %20.15f\n",
 
30
            moinfo.eref+moinfo.ecc);
 
31
  }
 
32
  else if(!strcmp(params.wfn,"CC3") || !strcmp(params.wfn,"EOM_CC3")) {
 
33
    psio_read_entry(CC_INFO, "CC3 Energy", (char *) &(moinfo.ecc),
 
34
                    sizeof(double));
 
35
    fprintf(outfile,  "\tCC3 energy          (CC_INFO) = %20.15f\n",moinfo.ecc);
 
36
    fprintf(outfile,  "\tTotal CC3 energy    (CC_INFO) = %20.15f\n",
 
37
            moinfo.eref+moinfo.ecc);
 
38
  }
 
39
 
 
40
  fflush(outfile);
12
41
 
13
42
  params.tolerance = 1e-14;
14
43
  errcod = ip_data("TOLERANCE","%d",&(tol),0);
21
50
 
22
51
  params.aobasis = 0;
23
52
  errcod = ip_boolean("AO_BASIS", &(params.aobasis),0);
 
53
 
 
54
  params.ael = 0;
 
55
  errcod = ip_boolean("AEL", &(params.ael),0);
 
56
 
 
57
  if(ip_exist("GAUGE",0)) {
 
58
    ip_string("GAUGE",&(params.gauge), 0);
 
59
    if(strcmp(params.gauge,"LENGTH") && strcmp(params.gauge,"VELOCITY")) {
 
60
      printf("Invalid choice of gauge: %s\n", params.gauge);
 
61
      exit(PSI_RETURN_FAILURE);
 
62
    }
 
63
  }
 
64
  else params.gauge = strdup("LENGTH");
24
65
  
25
 
  params.relax_opdm = 1;
 
66
  /*** determine DERTYPE from input */
 
67
  params.dertype = 0;
 
68
  if(ip_exist("DERTYPE",0)) {
 
69
    errcod = ip_string("DERTYPE", &(junk),0);
 
70
    if(!strcmp(junk,"NONE")) params.dertype = 0;
 
71
    else if(!strcmp(junk,"FIRST")) params.dertype = 1;
 
72
    else if(!strcmp(junk,"RESPONSE")) params.dertype = 3; 
 
73
    else {
 
74
      printf("Invalid value of input keyword DERTYPE: %s\n", junk);
 
75
      exit(PSI_RETURN_FAILURE);
 
76
    }
 
77
    free(junk);
 
78
  }
 
79
  else { /* infer DERTYPE from JOBTYPE */
 
80
    errcod = ip_string("JOBTYPE", &(junk),0);
 
81
    if ( !strcmp(junk,"SP") ) params.dertype = 0;
 
82
    else if ( !strcmp(junk, "OEPROP") ) params.dertype = 0;
 
83
    else if ( !strcmp(junk, "OPT") ) params.dertype = 1;
 
84
    else {
 
85
      printf("Not sure what to do with missing DERTYPE and this JOBTYPE: %s\n", junk);
 
86
      exit(PSI_RETURN_FAILURE);
 
87
    }
 
88
    free(junk);
 
89
  }
 
90
 
 
91
  if (params.dertype == 1)
 
92
    params.relax_opdm = 1;  /* default for gradients, relax_opdm on */
 
93
  else
 
94
    params.relax_opdm = 0;  /* otherwise, default is relax_opdm off */
 
95
 
 
96
  if(params.transition) 
 
97
    params.relax_opdm = 0;
 
98
 
26
99
  errcod = ip_boolean("RELAX_OPDM", &(params.relax_opdm),0);
 
100
  if ( (params.onepdm) && (params.relax_opdm) ) { /* can't do relaxation without twopdm */
 
101
    fprintf(outfile,"\tTurning orbital relaxation off since only onepdm is requested.\n");
 
102
    params.relax_opdm = 0;
 
103
  }
 
104
 
 
105
  if ( (!strcmp(params.wfn,"EOM_CCSD")) && (params.dertype == 0) )
 
106
    params.connect_xi = 0;
 
107
  else
 
108
    params.connect_xi = 1;
 
109
  errcod = ip_boolean("CONNECT_XI",&(params.connect_xi),0);
 
110
 
27
111
  
28
112
  fprintf(outfile, "\n\tInput parameters:\n");
29
113
  fprintf(outfile, "\t-----------------\n");
30
 
  fprintf(outfile, "\tTolerance    = %3.1e\n", params.tolerance);
31
 
  fprintf(outfile, "\tCache Level  =    %1d\n", params.cachelev);
32
 
  fprintf(outfile, "\tAO Basis     =     %s\n", 
 
114
  fprintf(outfile, "\tTolerance        = %3.1e\n", params.tolerance);
 
115
  fprintf(outfile, "\tCache Level      = %1d\n", params.cachelev);
 
116
  fprintf(outfile, "\tAO Basis         = %s\n", 
33
117
          params.aobasis ? "Yes" : "No");
34
 
  fprintf(outfile, "\tRelax OPDM   =     %s\n", 
 
118
  fprintf(outfile, "\tOPDM Only        = %s\n", 
 
119
          params.onepdm ? "Yes" : "No");
 
120
  fprintf(outfile, "\tRelax OPDM       = %s\n", 
35
121
          params.relax_opdm ? "Yes" : "No");
36
 
  fprintf(outfile, "\n");
 
122
  fprintf(outfile, "\tExcited State    = %s\n", 
 
123
          (!params.ground) ? "Yes" : "No");
 
124
  fprintf(outfile, "\tCompute Xi       = %s\n", 
 
125
          (params.calc_xi) ? "Yes" : "No");
 
126
  fprintf(outfile, "\tUse Zeta         = %s\n", 
 
127
          (params.use_zeta) ? "Yes" : "No");
 
128
  fprintf(outfile, "\tXi connected     = %s\n", 
 
129
          (params.connect_xi) ? "Yes" : "No");
 
130
  fflush(outfile);
37
131
}
38
132