[0b990d] | 1 |
|
---|
| 2 | namespace sc {
|
---|
| 3 |
|
---|
| 4 | class LocalHSOSKSContribution {
|
---|
| 5 | private:
|
---|
| 6 | double * const gmat;
|
---|
| 7 | double * const gmato;
|
---|
| 8 | double * const pmat;
|
---|
| 9 | double * const pmato;
|
---|
| 10 | double a0;
|
---|
| 11 |
|
---|
| 12 | public:
|
---|
| 13 | LocalHSOSKSContribution(double *g, double *p, double *go, double *po,
|
---|
| 14 | double _a0) :
|
---|
| 15 | gmat(g), gmato(go), pmat(p), pmato(po), a0(_a0) {}
|
---|
| 16 | ~LocalHSOSKSContribution() {}
|
---|
| 17 |
|
---|
| 18 | void set_bound(double, double) {}
|
---|
| 19 |
|
---|
| 20 | inline void cont1(int ij, int kl, double val) {
|
---|
| 21 | gmat[ij] += val*pmat[kl];
|
---|
| 22 | gmat[kl] += val*pmat[ij];
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | inline void cont2(int ij, int kl, double val) {
|
---|
| 26 | val *= 0.25*a0;
|
---|
| 27 | gmat[ij] -= val*pmat[kl];
|
---|
| 28 | gmat[kl] -= val*pmat[ij];
|
---|
| 29 |
|
---|
| 30 | gmato[ij] += val*pmato[kl];
|
---|
| 31 | gmato[kl] += val*pmato[ij];
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | inline void cont3(int ij, int kl, double val) {
|
---|
| 35 | val *= 0.5*a0;
|
---|
| 36 | gmat[ij] -= val*pmat[kl];
|
---|
| 37 | gmat[kl] -= val*pmat[ij];
|
---|
| 38 |
|
---|
| 39 | gmato[ij] += val*pmato[kl];
|
---|
| 40 | gmato[kl] += val*pmato[ij];
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | inline void cont4(int ij, int kl, double val) {
|
---|
| 44 | gmat[ij] += (1.0 - 0.25*a0)*val*pmat[kl];
|
---|
| 45 | gmat[kl] += (1.0 - 0.25*a0)*val*pmat[ij];
|
---|
| 46 |
|
---|
| 47 | gmato[ij] += a0*0.25*val*pmato[kl];
|
---|
| 48 | gmato[kl] += a0*0.25*val*pmato[ij];
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | inline void cont5(int ij, int kl, double val) {
|
---|
| 52 | gmat[ij] += (1.0 - 0.5*a0)*val*pmat[kl];
|
---|
| 53 | gmat[kl] += (1.0 - 0.5*a0)*val*pmat[ij];
|
---|
| 54 |
|
---|
| 55 | gmato[ij] += 0.5*a0*val*pmato[kl];
|
---|
| 56 | gmato[kl] += 0.5*a0*val*pmato[ij];
|
---|
| 57 | }
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | class LocalHSOSKSEnergyContribution {
|
---|
| 61 | private:
|
---|
| 62 | double * const pmat;
|
---|
| 63 | double * const pmato;
|
---|
| 64 | double a0;
|
---|
| 65 |
|
---|
| 66 | public:
|
---|
| 67 | double ec;
|
---|
| 68 | double ex;
|
---|
| 69 |
|
---|
| 70 | LocalHSOSKSEnergyContribution(double *p, double *po,
|
---|
| 71 | double _a0) : pmat(p), pmato(po), a0(_a0) {
|
---|
| 72 | ec=ex=0;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | ~LocalHSOSKSEnergyContribution() {}
|
---|
| 76 |
|
---|
| 77 | void set_bound(double, double) {}
|
---|
| 78 |
|
---|
| 79 | inline void cont1(int ij, int kl, double val) {
|
---|
| 80 | ec += val*pmat[ij]*pmat[kl];
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | inline void cont2(int ij, int kl, double val) {
|
---|
| 84 | ex -= a0*0.25*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]);
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | inline void cont3(int ij, int kl, double val) {
|
---|
| 88 | ex -= a0*0.5*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]);
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | inline void cont4(int ij, int kl, double val) {
|
---|
| 92 | ec += val*pmat[ij]*pmat[kl];
|
---|
| 93 | ex -= a0*0.25*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]);
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | inline void cont5(int ij, int kl, double val) {
|
---|
| 97 | ec += val*pmat[ij]*pmat[kl];
|
---|
| 98 | ex -= a0*0.5*val*(pmat[ij]*pmat[kl] + pmato[ij]*pmato[kl]);
|
---|
| 99 | }
|
---|
| 100 | };
|
---|
| 101 |
|
---|
| 102 | }
|
---|