17 m_basisFunction(basisFunction)
19 cout << setprecision(20);
36 void HartreeSolver::setuph() {
41 for(uint p = 0; p < n; p++) {
42 for(uint q = 0; q < n; q++) {
49 void HartreeSolver::setupS() {
54 for(uint p = 0; p < n; p++) {
55 for(uint q = 0; q < n; q++) {
61 void HartreeSolver::allocateQMemory() {
65 QData =
new double[n*n*n*n];
67 for(uint p = 0; p < n; p++) {
68 Q[p] =
new double**[n];
69 for(uint r = 0; r < n; r++) {
70 Q[p][r] =
new double *[n];
71 for(uint q = 0; q < n; q++) {
72 Q[p][r][q] = &QData[n*n*n*p + n*n*r + n*q];
73 for(uint s = 0; s < n; s++) {
83 void HartreeSolver::cleanUpQMemory() {
87 for (uint i = 0; i < n; ++i) {
88 for (uint j = 0; j < n; ++j){
98 void HartreeSolver::setupQ() {
101 for(uint p = 0; p < n; p++) {
102 for(uint r = 0; r < n; r++) {
103 for(uint q = 0; q < n; q++) {
104 for(uint s = 0; s < n; s++) {
112 void HartreeSolver::resetC() {
120 normalizeCwithRegardsToS();
127 mat V = U*diagmat(1.0/sqrt(s));
133 eig_sym(eps, Cmat, F);
136 normalizeCwithRegardsToS();
143 for(uint p = 0; p < n; p++) {
144 for(uint q = 0; q < n; q++) {
145 energy += 2 * C(p) * C(q) * h(p,q);
149 for(uint p = 0; p < n; p++) {
150 for(uint q = 0; q < n; q++) {
151 for(uint r = 0; r < n; r++) {
152 for(uint s = 0; s < n; s++) {
153 energy += Q[p][r][q][s] * C(p) * C(q) * C(r) * C(s);
161 void HartreeSolver::normalizeCwithRegardsToS(){
164 for(uint i= 0; i < C.n_elem; i++){
165 for(uint j= 0; j < C.n_elem; j++){
166 factor += C(i)*S(i,j)*C(j);
173 void HartreeSolver::setupF() {
177 for(uint p = 0; p < n; p++) {
178 for(uint q = 0; q < n; q++) {
179 for(uint r = 0; r < n; r++) {
180 for(uint s = 0; s < n; s++) {
181 F(p,q) += Q[p][r][q][s] * C(r) * C(s);