31 long i, n(0), nmg, nm;
35 double invunit = 0.5*Kmap/map->
sampling(0)[0];
38 for ( Emg=0, nmg=0, mg = molgroup; mg; mg = mg->
next ) {
39 for ( Em=0, nm=0, mol = mg->
mol; mol; mol = mol->
next ) {
40 for( res = mol->
res; res; res = res->
next ) {
41 for ( atom = res->
atom; atom; atom = atom->
next ) {
45 if ( x>0 && x<map->sizeX()-1 && y>0 && y<map->
sizeY()-1 && z>0 && z<map->
sizeZ()-1 ) {
46 i = map->
index(0, x, y, z, 0);
48 (*map)[i+slicesize] - (*map)[i-slicesize]);
50 atom->
F += F * invunit;
68 cout <<
"Warning: Molecule group outside map boundaries!" << endl;
93 double invunit = 0.5*Kmap/map->
sampling(0)[0];
96 for( res = mol->
res; res; res = res->
next ) {
97 for ( atom = res->
atom; atom; atom = atom->
next ) {
101 if ( x>0 && x<map->sizeX()-1 && y>0 && y<map->
sizeY()-1 && z>0 && z<map->
sizeZ()-1 ) {
102 i = map->
index(0, x, y, z, 0);
104 (*map)[i+slicesize] - (*map)[i-slicesize]);
106 atom->
F += F * invunit;
114 cout <<
"Warning: Molecule outside map boundaries!" << endl;
138 double sumc2(0), sumd2(0), sumcd(0);
142 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
143 for( res = mol->
res; res; res = res->
next ) {
144 for ( atom = res->
atom; atom; atom = atom->
next ) {
148 if ( x>=0 && x<map->sizeX() && y>=0 && y<map->
sizeY() && z>=0 && z<map->
sizeZ() ) {
149 i = map->
index(0, x, y, z, 0);
150 calc[i] += atom->
mass;
156 for ( i=0; i<datasize; i++ ) {
158 sumc2 += calc[i]*calc[i];
159 sumd2 += (*map)[i]*(*map)[i];
160 calc[i] *= (*map)[i];
166 double den = sqrt(sumc2*sumd2);
167 double CC = sumcd/den;
170 for ( i=0; i<datasize; i++ )
171 if ( calc[i] ) calc[i] *= norm;
174 cout <<
"Correlation: " << CC <<
" (" << n <<
")" << endl << endl;
194 double sumc2(0), sumd2(0), sumcd(0);
198 for( res = mol->
res; res; res = res->
next ) {
199 for ( atom = res->
atom; atom; atom = atom->
next ) {
203 if ( x>=0 && x<map->sizeX() && y>=0 && y<map->
sizeY() && z>=0 && z<map->
sizeZ() ) {
204 i = map->
index(0, x, y, z, 0);
205 calc[i] += atom->
mass;
210 for ( i=0; i<datasize; i++ ) {
212 sumc2 += calc[i]*calc[i];
213 sumd2 += (*map)[i]*(*map)[i];
214 calc[i] *= (*map)[i];
220 double den = sqrt(sumc2*sumd2);
221 double CC = sumcd/den;
224 cout <<
"Correlation for " << mol->
id <<
": " << CC <<
" (" << n <<
")" << endl << endl;
255 Batom *atom1, *atom2;
259 double frac, df, frac1, s1, s2, E(0);
260 double invunit = 0.5*Kmap/map->
sampling(0)[0];
263 for ( bond = molgroup->
bond; bond; bond = bond->
next ) {
269 for ( frac=0; frac<=1; frac+=df ) {
271 loc = atom1->
coord * frac1 + atom2->
coord * frac;
275 if ( x>0 && x<map->sizeX()-1 && y>0 && y<map->
sizeY()-1 && z>0 && z<map->
sizeZ()-1 ) {
276 i = map->
index(0, x, y, z, 0);
278 (*map)[i+slicesize] - (*map)[i-slicesize]);
281 if ( !
isfinite((*map)[i]) ) cout <<
"Infinite value at " << x <<
" " << y <<
" " << z << endl;
288 atom1->
F += F1 * (invunit/s1);
289 atom2->
F += F2 * (invunit/s2);
294 cout <<
"Warning: Molecule outside map boundaries!" << endl;