3
\brief Enter brief description of file here
6
** CPHF: Program to solve the Coupled Perturbed Hartree-Fock equations
7
** for nuclear and electric field perturbations and to compute
8
** electric polarizabilities, harmonic vibrational frequencies, and IR
11
** Limitations of and future plans for this code:
13
** (1) Spin-restricted closed-shell Hartree-Fock (RHF) wave functions
14
** only. Extension to ROHF and UHF cases is needed.
16
** (2) All two-electron integrals are held in core and used in the MO
17
** basis. Out-of-core and AO-based algorithms are needed in mohess.c,
18
** cphf_X.c, and build_hessian.c in order to handle larger basis sets
19
** and to avoid the two-electron integral transformation.
21
** (3) Symmetry-blocking is used in most of the loops, but is not
22
** actually used to improve storage or computational order. I've put
23
** this off because the nuclear perturbations (x, y, and z on each
24
** nucleus) are not yet symmetry-adapted. Some effort in this area is
27
** (4) Thermodynamic functions, including enthalpies, entropies, heat
28
** capacities, free energies, and partition functions can be computed,
29
** given the vibrational data computed in vibration.c.
31
** TDC, December 2001 and October 2002
37
#include <libipv1/ip_lib.h>
38
#include <libciomr/libciomr.h>
39
#include <libpsio/psio.h>
40
#include <libiwl/iwl.h>
41
#include <libchkpt/chkpt.h>
46
namespace psi { namespace cphf {
48
void init_io(int argc, char *argv[]);
56
void out_of_core(double ***, double ***, double ***, double **);
57
void sort_B(double ***, double **);
58
void sort_A(double **, double **);
59
void mohess(double **);
60
void cphf_X(double ***, double **, double **, double ***);
61
void cphf_F(double **, double ***);
62
void polarize(double ***);
63
void build_hessian(double ***, double ***, double **, double ***, double **);
64
void build_dipder(double ***);
65
void vibration(double **, double **);
66
void cphf_B(double ***, double **);
68
}} // namespace psi::cphf
70
int main(int argc, char *argv[])
72
using namespace psi::cphf;
91
timer_on("CPHF Main");
94
errcod = ip_data("PRINT", "%d", &(print_lvl), 0);
98
F = (double ***) malloc(natom*3 * sizeof(double **));
99
S = (double ***) malloc(natom*3 * sizeof(double **));
100
B = (double ***) malloc(natom*3 * sizeof(double **));
101
for(coord=0; coord < natom*3; coord++) {
102
F[coord] = block_matrix(nmo, nmo);
103
S[coord] = block_matrix(nmo, nmo);
104
B[coord] = block_matrix(nmo, nmo);
107
A = block_matrix(num_pq,num_pq);
109
out_of_core(F, S, B, A);
111
Baijk = block_matrix(natom*3, num_ai);
115
for(coord=0; coord < natom*3; coord++) {
116
free_block(B[coord]);
120
Aaibj = block_matrix(num_ai,num_ai);
126
UX = (double ***) malloc(natom*3 * sizeof(double **));
127
for(coord=0; coord < natom*3; coord++) {
128
UX[coord] = block_matrix(nmo,nmo);
131
cphf_X(S, Baijk, Aaibj, UX);
133
if (X_only) { /* only compute cphf coefficients, then quit */
138
for(coord=0; coord < natom*3; coord++) {
139
free_block(UX[coord]);
140
free_block(F[coord]);
141
free_block(S[coord]);
143
free(UX); free(F); free(S);
144
timer_off("CPHF Main");
147
exit(PSI_RETURN_SUCCESS);
150
UF = (double ***) malloc(3 * sizeof(double **));
151
for(coord=0; coord < 3; coord++)
152
UF[coord] = block_matrix(nmo,nmo);
158
hessian = block_matrix(natom*3, natom*3);
159
build_hessian(F, S, A, UX, hessian);
161
dipder = block_matrix(3, natom*3);
162
dipder_q = block_matrix(3, natom*3);
165
L = block_matrix(natom*3, natom*3);
166
vibration(hessian,L);
176
for(coord=0; coord < natom*3; coord++) {
177
free_block(UX[coord]);
178
free_block(F[coord]);
179
free_block(S[coord]);
181
for(coord=0; coord < 3; coord++) {
182
free_block(UF[coord]);
184
free(UX); free(UF); free(F); free(S);
189
timer_off("CPHF Main");
193
exit(PSI_RETURN_SUCCESS);
196
namespace psi { namespace cphf {
199
extern const char *gprgid(void);
202
void init_io(int argc, char *argv[])
205
char *progid, *argv_unparsed[100];
207
progid = (char *) malloc(strlen(gprgid())+2);
208
sprintf(progid, ":%s",gprgid());
211
for (i=1, num_unparsed=0; i<argc; ++i) {
212
if (!strcmp(argv[i],"--X_only")) /* only compute cphf coefficients, then quit */
215
argv_unparsed[num_unparsed++] = argv[i];
218
psi_start(&infile,&outfile,&psi_file_prefix,num_unparsed,argv_unparsed,0);
223
psio_init(); psio_ipv1_config();
228
fprintf(outfile, "\t\t\t**************************\n");
229
fprintf(outfile, "\t\t\t* *\n");
230
fprintf(outfile, "\t\t\t* CPHF *\n");
231
fprintf(outfile, "\t\t\t* *\n");
232
fprintf(outfile, "\t\t\t**************************\n");
240
psi_stop(infile,outfile,psi_file_prefix);
243
extern "C" const char *gprgid(void)
245
const char *prgid = "CPHF";
253
ioff = (int *) malloc(IOFF_MAX * sizeof(int));
255
for(i=1; i < IOFF_MAX; i++) {
256
ioff[i] = ioff[i-1] + i;
260
}} // namespace psi::cphf