3
#include <libpsio/psio.h>
4
#include <libciomr/libciomr.h>
5
#include <libchkpt/chkpt.h>
20
/*--- initialize the old checkpoint file ---*/
21
chkpt_init(PSIO_OPEN_OLD);
23
/*--- check if the symmetry is the same ---*/
24
Oldcalc.symmetry = chkpt_rd_sym_label();
25
if (strncmp(Oldcalc.symmetry,symmetry,3)) {
26
fprintf(outfile," Old chkpt file uses different point group from the current one\n");
27
fprintf(outfile," Will continue without the MO projection\n");
28
fprintf(stderr," Old chkpt file uses different point group from the current one\n");
29
fprintf(stderr," Will continue without the MO projection\n");
34
Oldcalc.nirreps = chkpt_rd_nirreps();
36
/*--- read the old geometry ---*/
37
Oldcalc.natom = chkpt_rd_natom();
38
Oldcalc.geometry = chkpt_rd_geom();
39
Oldcalc.Rref = chkpt_rd_rref();
41
/*--- read the old basis ---*/
42
Oldcalc.num_ao = chkpt_rd_nao();
43
Oldcalc.num_so = chkpt_rd_nso();
44
Oldcalc.sopi = chkpt_rd_sopi();
45
Oldcalc.num_shells = chkpt_rd_nshell();
46
Oldcalc.num_prims = chkpt_rd_nprim();
47
Oldcalc.exponents = chkpt_rd_exps();
48
Oldcalc.contr_coeff = chkpt_rd_contr_full();
49
Oldcalc.shell_nucleus = chkpt_rd_snuc();
50
Oldcalc.first_prim_shell = chkpt_rd_sprim();
51
Oldcalc.shell_ang_mom = chkpt_rd_stype();
52
Oldcalc.nprim_in_shell = chkpt_rd_snumg();
53
Oldcalc.first_ao_shell = chkpt_rd_sloc();
54
Oldcalc.usotao = chkpt_rd_usotao();
56
/*--- Convert to C-numbering ---*/
57
Oldcalc.max_angmom = 0;
58
for(s=0;s<Oldcalc.num_shells;s++) {
59
Oldcalc.shell_nucleus[s]--;
60
Oldcalc.shell_ang_mom[s]--;
61
Oldcalc.first_ao_shell[s]--;
62
Oldcalc.first_prim_shell[s]--;
63
if (Oldcalc.shell_ang_mom[s] > Oldcalc.max_angmom)
64
Oldcalc.max_angmom = Oldcalc.shell_ang_mom[s];
67
/*--- read the old SCF eigenvector, RHF case so far ---*/
68
Oldcalc.ref = chkpt_rd_ref();
69
if (Oldcalc.ref == ref_rhf ||
70
Oldcalc.ref == ref_rohf ||
71
Oldcalc.ref == ref_tcscf ||
72
Oldcalc.ref == ref_rks)
73
Oldcalc.spinrestr_ref = 1;
74
else if (Oldcalc.ref == ref_uhf ||
75
Oldcalc.ref == ref_uks)
76
Oldcalc.spinrestr_ref = 0;
78
fprintf(outfile," Input is not aware of reference type %d\n",Oldcalc.ref);
79
fprintf(outfile," Will continue without the MO projection\n");
85
Oldcalc.iopen = chkpt_rd_iopen();
86
Oldcalc.num_mo = chkpt_rd_nmo();
87
Oldcalc.orbspi = chkpt_rd_orbspi();
88
Oldcalc.clsdpi = chkpt_rd_clsdpi();
89
Oldcalc.openpi = chkpt_rd_openpi();
90
Oldcalc.escf = chkpt_rd_escf();
91
if (Oldcalc.spinrestr_ref) { /* Spin-restricted case */
92
Oldcalc.scf_evect_so = chkpt_rd_scf();
94
else { /* Spin-unrestricted case */
95
Oldcalc.scf_evect_so_alpha = chkpt_rd_alpha_scf();
96
Oldcalc.scf_evect_so_beta = chkpt_rd_beta_scf();
99
/*--- Done with the checkpoint file ---*/
102
if (print_lvl >= DEBUGPRINT) {
103
if (Oldcalc.spinrestr_ref) {
104
fprintf(outfile," -Old eigenvector (in SO basis):\n");
105
print_mat(Oldcalc.scf_evect_so,Oldcalc.num_so,Oldcalc.num_mo,outfile);
108
fprintf(outfile," -Old alpha eigenvector (in SO basis):\n");
109
print_mat(Oldcalc.scf_evect_so_alpha,Oldcalc.num_so,Oldcalc.num_mo,outfile);
110
fprintf(outfile," -Old beta eigenvector (in SO basis):\n");
111
print_mat(Oldcalc.scf_evect_so_beta,Oldcalc.num_so,Oldcalc.num_mo,outfile);
119
void cleanup_oldcalc()
121
free_block(Oldcalc.geometry);
122
free_block(Oldcalc.Rref);
123
free(Oldcalc.exponents);
124
free_block(Oldcalc.contr_coeff);
125
free(Oldcalc.shell_nucleus);
126
free(Oldcalc.first_prim_shell);
127
free(Oldcalc.shell_ang_mom);
128
free(Oldcalc.nprim_in_shell);
129
free(Oldcalc.first_ao_shell);
130
free_block(Oldcalc.usotao);
132
free(Oldcalc.orbspi);
133
free(Oldcalc.clsdpi);
134
free(Oldcalc.openpi);
135
if (Oldcalc.spinrestr_ref)
136
free(Oldcalc.scf_evect_so);
138
free(Oldcalc.scf_evect_so_alpha);
139
free(Oldcalc.scf_evect_so_beta);
150
if (max_angmom > Oldcalc.max_angmom)
151
init_gto(max_angmom);
153
init_gto(Oldcalc.max_angmom);
155
S12 = overlap_new_old_float();
157
/*--- write things out ---*/
158
psio_open(PSIF_OLD_CHKPT, PSIO_OPEN_NEW);
159
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Num. atoms", (char*) &Oldcalc.natom,
161
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Geometry", (char*) Oldcalc.geometry[0],
162
Oldcalc.natom*3*sizeof(double));
163
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Transmat to reference frame", (char*) Oldcalc.Rref[0],
165
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Num. irreps", (char*) &Oldcalc.nirreps,
167
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:SO's per irrep", (char*) Oldcalc.sopi,
168
Oldcalc.nirreps*sizeof(int));
169
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Reference", (char*) &Oldcalc.ref,
171
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Num. SO", (char*) &Oldcalc.num_so,
173
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Num. MO", (char*) &Oldcalc.num_mo,
175
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:MO's per irrep", (char*) Oldcalc.orbspi,
176
Oldcalc.nirreps*sizeof(int));
177
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Closed shells per irrep", (char*) Oldcalc.clsdpi,
178
Oldcalc.nirreps*sizeof(int));
179
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:Open shells per irrep", (char*) Oldcalc.openpi,
180
Oldcalc.nirreps*sizeof(int));
181
if (Oldcalc.spinrestr_ref) { /* Spin-restricted case */
182
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:MOs alpha", (char*) Oldcalc.scf_evect_so[0],
183
Oldcalc.num_so*Oldcalc.num_mo*sizeof(double));
185
else { /* Spin-unrestricted case */
186
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:MOs alpha", (char*) Oldcalc.scf_evect_so_alpha[0],
187
Oldcalc.num_so*Oldcalc.num_mo*sizeof(double));
188
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:MOs beta", (char*) Oldcalc.scf_evect_so_beta[0],
189
Oldcalc.num_so*Oldcalc.num_mo*sizeof(double));
191
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:AO->SO", (char *) Oldcalc.usotao[0],
192
Oldcalc.num_ao*Oldcalc.num_so*sizeof(double));
193
psio_write_entry(PSIF_OLD_CHKPT, ":PrevCalc:New-Old basis overlap", (char*) S12[0],
194
num_so*Oldcalc.num_so*sizeof(FLOAT));
195
psio_close(PSIF_OLD_CHKPT, 1);