3
#include <libmints/gshell.h>
5
#include <libmints/wavefunction.h>
13
double norm(int x1, int x2,double c,double ss)
16
return norm(x2,x1,c,ss);
25
return c * ( (x1-1) * norm(x1-2,x2,c,ss) + (x2 * norm(x1-1,x2-1,c,ss)));
29
GaussianShell::GaussianShell(int ncn, int nprm, double* e, int* am, GaussianType pure,
30
double** c, int nc, Vector3& center, int start, PrimitiveType pt):
31
nprimitives_(nprm), ncontractions_(ncn), nc_(nc), center_(center), start_(start), sym_transfrom_(0)
33
puream_ = new int[ncontraction()];
34
for (int i=0; i<ncontraction(); ++i) {
35
puream_[i] = (pure == Pure);
39
// Compute the number of basis functions in this shell
42
// Convert the coefficients to coefficients for unnormalized primitives, if needed
43
// if (pt == Normalized)
44
// convert_coefficients();
46
// Compute the normalization constants
47
if (pt == Unnormalized)
51
GaussianShell::~GaussianShell()
57
for (int i=0; i<ncontractions_; ++i)
63
delete[] sym_transfrom_;
66
// expects coef to be in primitive x contraction format. the data is transposed here
67
void GaussianShell::copy_data(int *l, double *exp, double **coef)
69
l_ = new int[ncontraction()];
70
for (int c=0; c<ncontraction(); ++c)
73
exp_ = new double[nprimitive()];
74
coef_ = new double*[ncontraction()];
75
for (int p=0; p<nprimitive(); ++p) {
78
for (int c=0; c<ncontraction(); ++c) {
79
coef_[c] = new double[nprimitive()];
80
for (int p=0; p<nprimitive(); ++p) {
81
// Yes, I want it stored c x p, but it came in from chkpt as p x c
82
coef_[c][p] = coef[p][c];
87
void GaussianShell::convert_coefficients()
92
// Convert the contraction coefficients from coefficients over
93
// normalized primitives to coefficients over unnormalized primitives
94
for (gc=0; gc<ncontractions_; gc++) {
95
for (i=0; i<nprimitives_; i++) {
97
ss = pow(M_PI/(exp_[i]+exp_[i]),1.5);
98
coef_[gc][i] *= 1.0/sqrt(::norm(l_[gc],l_[gc],c,ss));
103
double GaussianShell::shell_normalization(int gs)
109
for (i=0; i<nprimitives_; i++) {
110
for (j=0; j<nprimitives_; j++) {
111
c = 0.50/(exp_[i] + exp_[j]);
112
ss = pow(M_PI/(exp_[i]+exp_[j]),1.5);
113
result += coef_[gs][i] * coef_[gs][j] *
114
::norm(l_[gs],l_[gs],c,ss);
118
return 1.0/sqrt(result);
121
void GaussianShell::normalize_shell()
125
for (gs = 0; gs < ncontractions_; ++gs) {
126
double normalization = shell_normalization(gs);
127
for (i = 0; i < nprimitives_; ++i) {
128
coef_[gs][i] *= normalization;
130
fprintf(outfile, "New c = %20.16f for %20.16f\n", coef_[gs][i], exp_[i]);
136
int GaussianShell::nfunction(int c) const
138
return INT_NFUNC(puream_[c], l_[c]);
141
void GaussianShell::init_data()
149
for (int i=0; i<ncontraction(); ++i) {
155
if (min > mini || i == 0)
171
void GaussianShell::print(FILE *out) const
173
fprintf(out, " Number of contractions: %d\n", ncontraction());
174
fprintf(out, " Number of primitives: %d\n", nprimitive());
175
fprintf(out, " Number of Cartesian Gaussians: %d\n", ncartesian());
176
fprintf(out, " Spherical Harmonics?: %s\n", has_pure() ? "true" : "false");
177
if (max_am() == min_am())
178
fprintf(out, " Angular momentum: %d\n", max_am());
180
fprintf(out, " Max angular momentum: %d\n", max_am());
181
fprintf(out, " Min angular momentum: %d\n", min_am());
183
fprintf(out, " Exponent ");
184
for(int c=0; c<ncontraction(); c++)
185
fprintf(out, " Contr. %3d ",c);
187
for(int p=0; p<nprimitive(); p++) {
188
fprintf(out, " %15.10f",exp_[p]);
189
for(int c=0; c<ncontraction(); c++)
190
fprintf(out, " %12.9f",coef_[c][p]);
196
double GaussianShell::normalize(int l, int m, int n)
198
static int use_cca_integrals_standard = (PSI_INTEGRALS_STANDARD == 1);
199
if (use_cca_integrals_standard) {
202
double numer = df[2*l_[0]];
203
double denom = df[2*l] * df[2*m] * df[2*n];
204
// printf("l_=%d, l=%d, m=%d, n=%d, norm=%15.10f\n", l_[0], l, m, n, sqrt(numer/denom));
205
return sqrt(numer/denom);
209
void GaussianShell::set_sym_transform(int nirreps, int *vec)
212
delete[] sym_transfrom_;
214
sym_transfrom_ = new int[nirreps];
215
for (int i=0; i<nirreps; ++i)
216
sym_transfrom_[i] = vec[0];