3
\brief Enter brief description of file here
9
#include <libciomr/libciomr.h>
15
namespace psi { namespace input {
17
/*-----------------------------------------------------------------------------------------------------------------
18
This function builds SALCs of cartesian displacements
19
-----------------------------------------------------------------------------------------------------------------*/
21
void build_cartdisp_salcs()
23
int num_cd = 3*num_atoms;
24
int i, j, u, xyz, irrep, G, cd;
25
/* salc_symblk[i][j] is the pointer to j-th SALC in irrep i. Each SALC is an array of num_cd coefficients */
26
double*** salc_symblk = (double***) malloc(sizeof(double**)*nirreps);
27
for(i=0; i<nirreps; i++)
28
salc_symblk[i] = (double**) malloc(sizeof(double*)*num_cd);
31
double* salc = init_array(num_cd);
33
cdsalc_pi = init_int_array(nirreps);
34
cdsalc2cd = block_matrix(num_cd,num_cd);
37
for(u=0; u<num_uniques; u++) {
39
/* project each displacement */
40
for(xyz=0; xyz<3; xyz++) {
41
int cd = 3*atom + xyz;
43
for(irrep=0; irrep<nirreps; irrep++) {
44
memset((void*)salc,0,sizeof(double)*num_cd);
46
/* this is the order of the atom stabilizer (subgroup which preserves atom's position unchanged) */
48
/* apply the projector: */
49
for(G=0; G<nirreps; G++) {
50
int Gatom = atom_orbit[atom][G];
53
int Gcd = 3*Gatom + xyz;
54
double coeff = ao_type_transmat[1][G][xyz] * irr_char[irrep][G];
57
/* normalize this SALC -- this is why stab_order was needed */
58
for(cd=0; cd<num_cd; cd++)
59
salc[cd] /= sqrt((double)nirreps*stab_order);
61
/* if result is non-zero then add this salc to salc_symblk and increment salc counter */
62
for(i=0; i<num_cd; i++) {
63
if (fabs(salc[i])>1e-10 ) {
64
salc_symblk[irrep][cdsalc_pi[irrep]] = init_array(num_cd);
65
memcpy(salc_symblk[irrep][cdsalc_pi[irrep]],salc,sizeof(double)*num_cd);
74
/* copy salc_symblk to cdsalc2cd */
77
for(irrep=0; irrep<nirreps; irrep++) {
78
int num_per_irrep = cdsalc_pi[irrep];
79
for(i=0; i<num_per_irrep; i++,c++) {
80
for(j=0; j<num_cd; j++) {
81
cdsalc2cd[j][c] = salc_symblk[irrep][i][j];
83
free(salc_symblk[irrep][i]);
85
free(salc_symblk[irrep]);
91
if (print_lvl >= PRINTUSOTAO) {
92
fprintf(outfile," -Cartesian displacement SALCs per irrep:\n");
93
fprintf(outfile," Irrep #SALCs\n");
94
fprintf(outfile," ----- ------\n");
95
for(irrep=0;irrep<nirreps;irrep++) {
96
fprintf(outfile," %3d %4d\n",irrep,cdsalc_pi[irrep]);
98
fprintf(outfile,"\n");
100
fprintf(outfile," -Cartesian displacement SALCs:\n");
101
print_mat(cdsalc2cd,num_cd,num_cd,outfile);
102
fprintf(outfile,"\n");
107
}} // namespace psi::input