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