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

« back to all changes in this revision

Viewing changes to src/bin/cceom/cceom.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
 
/*
2
 
**  CCEOM: Program to calculate the EOM CCSD right-hand eigenvector and  energy
3
 
*/
4
 
#include <stdio.h>
5
 
#include <stdlib.h>
6
 
#include <string.h>
7
 
#include <libipv1/ip_lib.h>
8
 
#include <libciomr/libciomr.h>
9
 
#include <libpsio/psio.h>
10
 
#include <libqt/qt.h>
11
 
#include "globals.h"
12
 
 
13
 
void init_io(int argc, char *argv[]);
14
 
void get_moinfo(void);
15
 
void cleanup(void);
16
 
void exit_io(void);
17
 
void diag(void);
18
 
void get_params(void);
19
 
void get_eom_params(void);
20
 
void form_dpd_dp(void);
21
 
int **cacheprep_uhf(int level, int *cachefiles);
22
 
int **cacheprep_rhf(int level, int *cachefiles);
23
 
void sort_amps(void);
24
 
void hbar_norms(void);
25
 
 
26
 
/* local correlation functions */
27
 
void local_init(void);
28
 
void local_done(void);
29
 
 
30
 
int main(int argc, char *argv[])
31
 
{
32
 
  int i, h, done=0, *cachefiles, **cachelist;
33
 
  init_io(argc, argv);
34
 
  fprintf(outfile,"\n\t**********************************************************\n");
35
 
  fprintf(outfile,"\t*  CCEOM: An Equation of Motion Coupled Cluster Program  *\n");
36
 
  fprintf(outfile,"\t**********************************************************\n");
37
 
 
38
 
  get_moinfo();
39
 
  fflush(outfile);
40
 
  get_params();
41
 
  get_eom_params();
42
 
#ifdef TIME_CCEOM
43
 
  timer_init();
44
 
  timer_on("CCEOM");
45
 
#endif
46
 
 
47
 
  form_dpd_dp();
48
 
 
49
 
  cachefiles = init_int_array(PSIO_MAXUNIT);
50
 
  
51
 
  if (params.ref == 2) { /* UHF */ 
52
 
    cachelist = cacheprep_uhf(params.cachelev, cachefiles);
53
 
    /* cachelist = init_int_matrix(32,32); */
54
 
 
55
 
    dpd_init(0, moinfo.nirreps, params.memory, 0, cachefiles,
56
 
    cachelist, NULL, 4, moinfo.aoccpi, moinfo.aocc_sym, moinfo.avirtpi,
57
 
    moinfo.avir_sym, moinfo.boccpi, moinfo.bocc_sym, moinfo.bvirtpi, moinfo.bvir_sym);
58
 
  }
59
 
  else { /* RHF or ROHF */
60
 
    cachelist = cacheprep_rhf(params.cachelev, cachefiles);
61
 
    /* cachelist = init_int_matrix(12,12); */
62
 
 
63
 
    dpd_init(0, moinfo.nirreps, params.memory, 0, cachefiles,
64
 
           cachelist, NULL, 2, moinfo.occpi, moinfo.occ_sym,
65
 
           moinfo.virtpi, moinfo.vir_sym);
66
 
  }
67
 
 
68
 
  if(params.local) local_init();
69
 
 
70
 
  diag();
71
 
 
72
 
  dpd_close(0);
73
 
  if(params.local) local_done();
74
 
  cleanup(); 
75
 
#ifdef TIME_CCEOM
76
 
  timer_off("CCEOM");
77
 
  timer_done();
78
 
#endif
79
 
  exit_io();
80
 
  exit(0);
81
 
}
82
 
 
83
 
void init_io(int argc, char *argv[])
84
 
{
85
 
  int i, num_unparsed;
86
 
  extern char *gprgid();
87
 
  char *progid, *argv_unparsed[100];
88
 
 
89
 
  eom_params.dot_with_L = 0;
90
 
  eom_params.guess = NULL;
91
 
  for (i=1, num_unparsed=0; i<argc; ++i) {
92
 
    if (!strcmp(argv[i],"--dot_with_L"))
93
 
      eom_params.dot_with_L = 1;
94
 
    else if(!strcmp(argv[i], "--reuse"))
95
 
      eom_params.guess = strdup("DISK");
96
 
    else
97
 
      argv_unparsed[num_unparsed++] = argv[i];
98
 
  }
99
 
 
100
 
  progid = (char *) malloc(strlen(gprgid())+2);
101
 
  sprintf(progid, ":%s",gprgid());
102
 
 
103
 
  psi_start(num_unparsed, argv_unparsed, 0);
104
 
  ip_cwk_add(":INPUT");
105
 
  ip_cwk_add(progid);
106
 
  free(progid);
107
 
  tstart(outfile);
108
 
  psio_init();
109
 
 
110
 
  for(i=CC_MIN; i <= CC_MAX; i++) psio_open(i,1);
111
 
  /*
112
 
  for(i=CC_MIN; i <= CC_MISC; i++) psio_open(i,1);
113
 
  for(i=CC_TMP; i <= EOM_D; i++) psio_open(i,0);
114
 
  for(i=EOM_Cme; i <= CC_MAX; i++) psio_open(i,0);
115
 
  */
116
 
 
117
 
  /* it will read it anyway if its there ?
118
 
  if(eom_params.guess != NULL) {
119
 
    if(!strcmp(eom_params.guess,"DISK"))
120
 
      psio_open(EOM_CME,1);
121
 
  }
122
 
  else
123
 
    psio_open(EOM_CME,0);
124
 
    */
125
 
 
126
 
  if (eom_params.dot_with_L) {
127
 
    psio_read_entry(CC_INFO,"EOM L0",(char *) &eom_params.L0, sizeof(double));
128
 
    psio_read_entry(CC_INFO,"EOM L Irrep",(char *) &eom_params.L_irr, sizeof(int));
129
 
  }
130
 
}
131
 
 
132
 
void exit_io(void)
133
 
{
134
 
  int i;
135
 
  /* for(i=CC_MIN; i <= CC_MISC; i++) psio_close(i,1);
136
 
  for(i=CC_TMP; i <= CC_MAX; i++) psio_close(i,1);
137
 
  */
138
 
  for(i=CC_MIN; i <= CC_DIIS_AMP; i++) psio_close(i,1);
139
 
  for(i=CC_TMP; i <= CC_TMP11; i++) psio_close(i,0);
140
 
  for(i=CC_TMP11+1; i <= CC_MAX; i++) psio_close(i,1);
141
 
 
142
 
  psio_done();
143
 
  tstop(outfile);
144
 
  psi_stop();
145
 
}
146
 
 
147
 
char *gprgid()
148
 
{
149
 
   char *prgid = "CCEOM";
150
 
   return(prgid);
151
 
}
152
 
 
153
 
void form_dpd_dp(void) {
154
 
  int h, h0, h1, cnt, nirreps;
155
 
  nirreps = moinfo.nirreps;
156
 
 
157
 
  dpd_dp = (int ***) malloc(nirreps * sizeof(int **));
158
 
  for(h=0; h < nirreps; h++) {
159
 
      dpd_dp[h] = init_int_matrix(nirreps,2);
160
 
      cnt=0;
161
 
      for(h0=0; h0 < nirreps; h0++) {
162
 
          for(h1=0; h1 < nirreps; h1++) {
163
 
              if((h0^h1)==h) {
164
 
                  dpd_dp[h][cnt][0] = h0;
165
 
                  dpd_dp[h][cnt++][1] = h1;
166
 
                }
167
 
            }
168
 
        }
169
 
    }
170
 
}
171