3
\brief Enter brief description of file here
10
#include <libciomr/libciomr.h>
11
#include <libpsio/psio.h>
12
#include <libchkpt/chkpt.h>
19
namespace psi { namespace input {
21
/*-----------------------------------------------------------------------------------------------------------------
22
This function writes information out to checkpoint file
23
-----------------------------------------------------------------------------------------------------------------*/
25
void write_to_chkpt(double repulsion)
30
int atom,ua,shell,irr,symop,shell_first,shell_last,us;
37
double *cspd; /*Array of contraction coefficients in chkpt file format*/
38
char *atom_label, **tmp_atom_label;
43
int max_angmom_unique;
46
/* Check the max_angmom. If it's >= MAXANGMOM from chkpt_params.h - die */
47
if (max_angmom >= MAXANGMOM)
48
punt("Angular momentum is too high to be handled by your version of Psi (chkpt file)");
51
/*----------------------------------
52
Write out the label then 80 zeros
53
----------------------------------*/
54
calc_label = init_char_array(80);
55
strncpy(calc_label,label,80);
57
/*----------------------------------
58
Write out basic info to chkpt
59
----------------------------------*/
60
chkpt_init(keep_chkpt ? PSIO_OPEN_OLD : PSIO_OPEN_NEW);
61
chkpt_wt_label(calc_label);
62
chkpt_wt_num_unique_atom(num_uniques);
63
chkpt_wt_num_unique_shell(num_unique_shells);
64
chkpt_wt_rottype(rotor);
65
chkpt_wt_max_am(max_angmom);
66
chkpt_wt_puream(puream);
69
chkpt_wt_nshell(num_shells);
70
chkpt_wt_nirreps(nirreps);
71
chkpt_wt_nprim(num_prims);
72
chkpt_wt_natom(num_atoms);
73
chkpt_wt_nallatom(num_allatoms);
76
chkpt_wt_nfragment(nfragments);
78
chkpt_wt_natom_per_fragment(frag_num_atoms);
79
chkpt_wt_nallatom_per_fragment(frag_num_allatoms);
80
chkpt_wt_nref_per_fragment(nref_per_fragment);
81
chkpt_wt_fragment_coeff(ref_pts_lc);
86
/*-----------------------------------
87
Start writing data to the file
88
-----------------------------------*/
91
chkpt_wt_zvals(nuclear_charges);
93
/* Transformation table for atoms - just atom_orbit transposed */
94
ict = init_int_array(num_atoms);
95
ict_tmp = init_int_matrix(nirreps, num_atoms);
96
for(i=0;i<nirreps;i++) {
97
for(j=0;j<num_atoms;j++) {
98
ict[j] = atom_orbit[j][i]+1;
99
ict_tmp[i][j] = ict[j];
102
chkpt_wt_ict(ict_tmp);
103
free_int_matrix(ict_tmp);
106
/* Exponents of primitive gaussians */
107
chkpt_wt_exps(exponents);
109
/* Contraction coefficients */
110
/*------This piece of code is for segmented contractions ONLY------*/
111
cspd = init_array(num_prims*MAXANGMOM);
112
for(j=0;j<num_shells;j++)
113
for(k=0;k<nprim_in_shell[j];k++)
115
Pitzer normalization of Psi 2 is NOT used - cc's for d-functions used to be
116
multiplied by sqrt(3), f - by sqrt(15), g - sqrt(105), etc
118
cspd[shell_ang_mom[j]*num_prims+first_prim_shell[j]+k] = contr_coeff[first_prim_shell[j]+k];
119
chkpt_wt_contr(cspd);
122
/* Pointer to primitives for a shell */
123
arr_int = init_int_array(num_shells);
124
for(i=0;i<num_shells;i++)
125
arr_int[i] = first_prim_shell[i]+1;
126
chkpt_wt_sprim(arr_int);
128
/* Atom on which nth shell is centered */
129
for(i=0;i<num_shells;i++)
130
arr_int[i] = shell_nucleus[i]+1;
131
chkpt_wt_snuc(arr_int);
133
/* Angular momentum of a shell */
134
for(i=0;i<num_shells;i++)
135
arr_int[i] = shell_ang_mom[i]+1;
136
chkpt_wt_stype(arr_int);
138
/* Number of contracted functions (primitives) in a shell */
139
chkpt_wt_snumg(nprim_in_shell);
141
/* Pointer to the first AO in shell */
142
for(i=0;i<num_shells;i++)
143
arr_int[i] = first_ao_shell[i]+1;
144
chkpt_wt_sloc(arr_int);
147
/* Labels of irreps */
148
chkpt_wt_irr_labs(irr_labels);
150
/* Transformation matrices for coordinates (or p-functions) */
151
mat_double = block_matrix(nirreps,9);
152
for(symop=0;symop<nirreps;symop++) {
153
mat_double[symop][0] = ao_type_transmat[1][symop][0];
154
mat_double[symop][4] = ao_type_transmat[1][symop][1];
155
mat_double[symop][8] = ao_type_transmat[1][symop][2];
157
chkpt_wt_cartrep(mat_double);
160
/* Transformation matrix for shells */
161
shell_transm = init_int_matrix(num_shells,nirreps);;
162
for(atom=0;atom<num_atoms;atom++)
163
for(symop=0;symop<nirreps;symop++) {
164
eq_atom = atom_orbit[atom][symop];
165
for(i=0;i<nshells_per_atom[atom];i++)
166
shell_transm[first_shell_on_atom[atom]+i][symop] = first_shell_on_atom[eq_atom] + i + 1;
168
chkpt_wt_shell_transm(shell_transm);
169
free_int_matrix(shell_transm);
171
/* Labels of atoms including dummy atoms */
172
tmp_atom_label = (char **) malloc(num_allatoms*sizeof(char *));
173
for(atom=0; atom<num_allatoms; atom++) {
174
tmp_atom_label[atom] = init_char_array(MAX_ELEMNAME);
176
if(strlen(full_element[atom]) > MAX_ELEMNAME)
177
punt("Element name exceeds limit, MAX_ELEMNAME.\n");
179
strncpy(tmp_atom_label[atom],full_element[atom],strlen(full_element[atom])+1);
181
chkpt_wt_felement(tmp_atom_label);
182
for(atom=0; atom<num_allatoms; atom++) {
183
free(tmp_atom_label[atom]);
185
free(tmp_atom_label);
187
/* Orbitals per irrep */
188
chkpt_wt_sopi(num_so_per_irrep);
191
chkpt_wt_sym_label(symmetry);
193
/* Symmetry positions of atoms - for more info see count_uniques.c */
194
chkpt_wt_atom_position(atom_position);
196
/* Unique shell number to full shell number mapping array */
197
arr_int = init_int_array(num_unique_shells);
199
for(ua=0;ua<num_uniques;ua++) {
201
shell = first_shell_on_atom[atom];
202
for(i=0;i<nshells_per_atom[atom];i++,shell++,us++)
205
chkpt_wt_us2s(arr_int);
208
/* SO to AO transformation matrix */
209
chkpt_wt_usotao(usotao);
211
/* SO to basis functions transformation matrix */
213
chkpt_wt_usotbf(usotbf);
216
/* Pointers to first basis functions from shells */
217
arr_int = init_int_array(num_shells);
218
for(i=0;i<num_shells;i++)
219
arr_int[i] = first_basisfn_shell[i]+1;
220
chkpt_wt_sloc_new(arr_int);
223
/* Unique atom number to full atom number mapping array */
226
/* Mapping between canonical Cotton ordering of symmetry operations
227
in the point group to the symmetry.h-defined ordering */
228
chkpt_wt_symoper(sym_oper);
230
/* write z_mat if it exists, see global.h for info about z_entry structure */
232
chkpt_wt_zmat(z_geom);
235
/* Number of shells in each angmom block */
236
chkpt_wt_shells_per_am(shells_per_am);
238
/* Mapping array from the am-blocked to the canonical (in the order of
239
appearance) ordering of shells */
240
chkpt_wt_am2canon_shell_order(am2canon_shell_order);
242
/* Matrix representation of rotation back to the reference frame */
245
/* write full_geom, cartesian geometry with dummy atoms included */
246
chkpt_wt_fgeom(full_geom);
248
/* write array of flags that indicate whether atoms in full_geom are dummy or not */
249
chkpt_wt_atom_dummy(atom_dummy);
251
/* nuclear repulsion energy */
252
chkpt_wt_enuc(repulsion);
254
/* Cartesian displacement SALCs */
255
chkpt_wt_cdsalc2cd(const_cast<const double**>(cdsalc2cd));
257
/* cartdisp SALCs per irrep */
258
chkpt_wt_cdsalcpi(cdsalc_pi);
264
}} // namespace psi::input