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

« back to all changes in this revision

Viewing changes to src/bin/response/response.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
**  RESPONSE: Program to compute various response properties.
 
3
*/
 
4
 
 
5
#include <stdio.h>
 
6
#include <stdlib.h>
 
7
#include <string.h>
 
8
#include <math.h>
 
9
#include <libipv1/ip_lib.h>
 
10
#include <libpsio/psio.h>
 
11
#include <libciomr/libciomr.h>
 
12
#include <libdpd/dpd.h>
 
13
#include <libchkpt/chkpt.h>
 
14
#include <psifiles.h>
 
15
#include "globals.h"
 
16
 
 
17
/* Max length of ioff array */
 
18
#define IOFF_MAX 32641
 
19
 
 
20
/* Function prototypes */
 
21
void init_io(int argc, char *argv[]);
 
22
void init_ioff(void);
 
23
void get_moinfo(void);
 
24
void get_params(void);
 
25
void cleanup(void);
 
26
void exit_io(void);
 
27
int **cacheprep_rhf(int level, int *cachefiles);
 
28
int **cacheprep_uhf(int level, int *cachefiles);
 
29
void build_A_RHF(void);
 
30
 
 
31
int main(int argc, char *argv[])
 
32
{
 
33
  int **cachelist, *cachefiles;
 
34
 
 
35
  init_io(argc, argv);
 
36
  init_ioff();
 
37
  get_moinfo();
 
38
  get_params();
 
39
 
 
40
  cachefiles = init_int_array(PSIO_MAXUNIT);
 
41
 
 
42
  if(params.ref == 2) { /*** UHF references ***/
 
43
    cachelist = cacheprep_uhf(params.cachelev, cachefiles);
 
44
 
 
45
    dpd_init(0, moinfo.nirreps, params.memory, 0, cachefiles, cachelist, 
 
46
             NULL, 4, moinfo.aoccpi, moinfo.aocc_sym, moinfo.avirtpi, moinfo.avir_sym,
 
47
             moinfo.boccpi, moinfo.bocc_sym, moinfo.bvirtpi, moinfo.bvir_sym);
 
48
  } 
 
49
  else { /*** RHF/ROHF references ***/
 
50
    cachelist = cacheprep_rhf(params.cachelev, cachefiles);
 
51
 
 
52
    dpd_init(0, moinfo.nirreps, params.memory, 0, cachefiles, cachelist, NULL,
 
53
             2, moinfo.occpi, moinfo.occ_sym, moinfo.virtpi, moinfo.vir_sym);
 
54
  }
 
55
 
 
56
  if(params.ref == 0) {
 
57
 
 
58
    /* transform mu integrals */
 
59
    trans_mu();
 
60
    build_A_RHF();
 
61
    build_B_RHF();
 
62
    /*    diag_RPA_RHF(); */
 
63
    invert_RPA_RHF();
 
64
  }
 
65
 
 
66
  dpd_close(0);
 
67
  cleanup();
 
68
  exit_io();
 
69
  exit(0);
 
70
}
 
71
 
 
72
void init_io(int argc, char *argv[])
 
73
{
 
74
  int i;
 
75
  extern char *gprgid();
 
76
  char *progid;
 
77
 
 
78
  progid = (char *) malloc(strlen(gprgid())+2);
 
79
  sprintf(progid, ":%s",gprgid());
 
80
 
 
81
  psi_start(argc-1,argv+1,0); /* this assumes no cmdline args except filenames */
 
82
  ip_cwk_add(progid);
 
83
  free(progid);
 
84
  tstart(outfile);
 
85
  psio_init();
 
86
 
 
87
  psio_open(PSIF_MO_HESS,0);
 
88
  psio_open(CC_INFO, PSIO_OPEN_OLD);
 
89
  psio_open(CC_OEI, PSIO_OPEN_OLD);
 
90
  psio_open(CC_CINTS, PSIO_OPEN_OLD);
 
91
  psio_open(CC_DINTS, PSIO_OPEN_OLD);
 
92
  psio_open(CC_TMP0, PSIO_OPEN_NEW);
 
93
}
 
94
 
 
95
void exit_io(void)
 
96
{
 
97
  int i;
 
98
 
 
99
  psio_close(PSIF_MO_HESS,1);
 
100
  psio_close(CC_INFO, 1);
 
101
  psio_close(CC_OEI, 1);
 
102
  psio_close(CC_CINTS, 1);
 
103
  psio_close(CC_DINTS, 1);
 
104
  psio_close(CC_TMP0, 1);
 
105
 
 
106
  psio_done();
 
107
  tstop(outfile);
 
108
  psi_stop();
 
109
}
 
110
 
 
111
char *gprgid()
 
112
{
 
113
   char *prgid = "STABLE";
 
114
 
 
115
   return(prgid);
 
116
}
 
117
 
 
118
void init_ioff(void)
 
119
{
 
120
  int i;
 
121
  ioff = init_int_array(IOFF_MAX);
 
122
  ioff[0] = 0;
 
123
  for(i=1; i < IOFF_MAX; i++) ioff[i] = ioff[i-1] + i;
 
124
}