ComputeGBISser.C File Reference

#include "Vector.h"
#include <limits>
#include "InfoStream.h"
#include "Node.h"
#include "PatchMap.h"
#include "PatchMap.inl"
#include "AtomMap.h"
#include "ComputeGBISser.h"
#include "ComputeGBISserMgr.decl.h"
#include "PatchMgr.h"
#include "Molecule.h"
#include "ReductionMgr.h"
#include "ComputeMgr.h"
#include "ComputeMgr.decl.h"
#include "ComputeGBIS.inl"
#include "Debug.h"
#include "SimParameters.h"
#include "WorkDistrib.h"
#include "varsizemsg.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include "ComputeGBISserMgr.def.h"

Go to the source code of this file.

Classes

struct  vect
struct  ComputeGBISAtom
class  GBISCoordMsg
class  GBISForceMsg
class  ComputeGBISserMgr

Defines

#define BENCH_PERIOD   1000
#define GBIS_DEDR_FORCE   1
#define GBIS_DEDA_FORCE   1
#define GBIS_COUL_FORCE   1
#define MIN_DEBUG_LEVEL   3
#define COUL_CONST   332.0636

Functions

void Phase2_PairSer (BigReal r, BigReal r2, BigReal r_i, BigReal qiqj, BigReal ai, BigReal aj, BigReal epsilon_p_i, BigReal epsilon_s_i, BigReal kappa, int exclij, BigReal scale14, int stat, BigReal &coulEij, BigReal &ddrCoulEij, BigReal &gbEij, BigReal &ddrGbEij, BigReal &dEdai, BigReal &dEdaj)
void CalcHPairSer (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal ri0, BigReal rjs, BigReal rj0, BigReal ris, int &dij, int &dji, BigReal &dhij, BigReal &dhji)
void CalcDHPairSer (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal ri0, BigReal rjs, BigReal rj0, BigReal ris, int &dij, int &dji, BigReal &dhij, BigReal &dhji)
void CalcScaleSer (BigReal r, BigReal t, BigReal c, BigReal &s, BigReal &d)
void h0Ser (BigReal r, BigReal r2, BigReal ri, Real rc, BigReal r0, BigReal rs, BigReal &h)
void dh0Ser (BigReal r, BigReal r2, BigReal ri, Real rc, BigReal r0, BigReal rs, BigReal &dh)
void h1Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh1Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void h2Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh2Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void h3Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh3Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void h4Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh4Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void h5Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh5Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void h6Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h)
void dh6Ser (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh)
void CalcHSer (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &h, int &d)
void CalcDHSer (BigReal r, BigReal r2, BigReal ri, BigReal rc, BigReal r0, BigReal rs, BigReal &dh, int &d)
void Calc_Coul_PairSer (BigReal r_i, BigReal qiqj, BigReal epsilon_p_i, int exclij, BigReal scale14, BigReal &coulE, BigReal &ddrCoulE)
void Calc_dEdr_PairSer (BigReal r, BigReal r2, BigReal qiqj, BigReal ai, BigReal aj, BigReal kappa, BigReal epsilon_p_i, BigReal epsilon_s_i, BigReal &aiaj, BigReal &expr2aiaj4, BigReal &fij, BigReal &f_i, BigReal &expkappa, BigReal &Dij, BigReal &gbE, BigReal &ddrGbE)
void Calc_dEda_PairSer (BigReal r2, BigReal ai, BigReal aj, BigReal qiqj, BigReal kappa, BigReal aiaj, BigReal expkappa, BigReal expr2aiaj4, BigReal fij, BigReal f_i, BigReal Dij, BigReal epsilon_s_i, BigReal &dEdai, BigReal &dEdaj)


Define Documentation

#define BENCH_PERIOD   1000

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 22 of file ComputeGBISser.C.

Referenced by ComputeGBISserMgr::recvCoord().

#define COUL_CONST   332.0636

Definition at line 59 of file ComputeGBISser.C.

#define GBIS_COUL_FORCE   1

Definition at line 27 of file ComputeGBISser.C.

Referenced by ComputeGBISserMgr::recvCoord().

#define GBIS_DEDA_FORCE   1

Definition at line 26 of file ComputeGBISser.C.

#define GBIS_DEDR_FORCE   1

Definition at line 25 of file ComputeGBISser.C.

Referenced by ComputeGBISserMgr::recvCoord().

#define MIN_DEBUG_LEVEL   3

Definition at line 45 of file ComputeGBISser.C.


Function Documentation

void Calc_Coul_PairSer ( BigReal  r_i,
BigReal  qiqj,
BigReal  epsilon_p_i,
int  exclij,
BigReal  scale14,
BigReal coulE,
BigReal ddrCoulE 
) [inline]

Definition at line 1183 of file ComputeGBISser.C.

References EXCHCK_FULL, and EXCHCK_MOD.

01191   {
01192   if (exclij != EXCHCK_FULL) {//not excluded
01193     //calculate Coulomb Energy
01194     coulE = -qiqj*epsilon_p_i*r_i;
01195 
01196     //calculate Coulomb Force
01197     if (exclij == EXCHCK_MOD)
01198       coulE *= scale14;
01199     ddrCoulE = -r_i*coulE;
01200   } else {
01201     coulE = 0;
01202     ddrCoulE = 0;
01203   }
01204 }

void Calc_dEda_PairSer ( BigReal  r2,
BigReal  ai,
BigReal  aj,
BigReal  qiqj,
BigReal  kappa,
BigReal  aiaj,
BigReal  expkappa,
BigReal  expr2aiaj4,
BigReal  fij,
BigReal  f_i,
BigReal  Dij,
BigReal  epsilon_s_i,
BigReal dEdai,
BigReal dEdaj 
) [inline]

Definition at line 1255 of file ComputeGBISser.C.

Referenced by Phase2_PairSer().

01270   {
01271 
01272   BigReal tmp_dEda = 0.5*qiqj*f_i*f_i
01273                       *(kappa*epsilon_s_i*expkappa-Dij*f_i)
01274                       *(aiaj+0.25*r2)*expr2aiaj4;//0
01275   dEdai = tmp_dEda/ai;
01276   dEdaj = tmp_dEda/aj;
01277 }

void Calc_dEdr_PairSer ( BigReal  r,
BigReal  r2,
BigReal  qiqj,
BigReal  ai,
BigReal  aj,
BigReal  kappa,
BigReal  epsilon_p_i,
BigReal  epsilon_s_i,
BigReal aiaj,
BigReal expr2aiaj4,
BigReal fij,
BigReal f_i,
BigReal expkappa,
BigReal Dij,
BigReal gbE,
BigReal ddrGbE 
) [inline]

Definition at line 1210 of file ComputeGBISser.C.

Referenced by Phase2_PairSer().

01227   {
01228   //allocate local variables
01229   BigReal aiaj4,ddrDij,ddrf_i,ddrfij;
01230 
01231   //calculate GB energy
01232   aiaj = ai*aj;
01233   aiaj4 = 4*aiaj;
01234   expr2aiaj4 = exp(-r2/aiaj4);
01235   fij = sqrt(r2+aiaj*expr2aiaj4);
01236   f_i = 1/fij;
01237   if (kappa > 0)
01238     expkappa = exp(-kappa*fij);
01239   else
01240     expkappa = 1.0;
01241   Dij = epsilon_p_i - expkappa*epsilon_s_i;//dielectric term
01242   gbE = qiqj*Dij*f_i;
01243 
01244   //calculate energy derivatives
01245   ddrfij = r*f_i*(1 - 0.25*expr2aiaj4);
01246   ddrf_i = -ddrfij*f_i*f_i;
01247   ddrDij = kappa*expkappa*ddrfij*epsilon_s_i;
01248   ddrGbE = qiqj*(ddrDij*f_i+Dij*ddrf_i);
01249 }

void CalcDHPairSer ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  ri0,
BigReal  rjs,
BigReal  rj0,
BigReal  ris,
int &  dij,
int &  dji,
BigReal dhij,
BigReal dhji 
) [inline]

Definition at line 1155 of file ComputeGBISser.C.

References CalcDHSer().

01168   {
01169   CalcDHSer(r,r2,ri,rc,ri0,rjs,dhij,dij);//hij
01170   CalcDHSer(r,r2,ri,rc,rj0,ris,dhji,dji);//hji
01171 }

void CalcDHSer ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh,
int &  d 
) [inline]

Definition at line 1120 of file ComputeGBISser.C.

References dh0Ser(), dh1Ser(), dh2Ser(), dh3Ser(), dh4Ser(), dh5Ser(), and dh6Ser().

Referenced by CalcDHPairSer().

01121                                                            {
01122   if( r <= rc - rs && r > 4*rs ) {//II
01123     dh2Ser(r,r2,ri,rc,r0,rs,dh); d = 2;
01124   } else if (r <= rc + rs && r > rc - rs) {//I
01125     dh1Ser(r,r2,ri,rc,r0,rs,dh); d = 1;
01126   } else if (r > rc + rs) {//0
01127     dh0Ser(r,r2,ri,rc,r0,rs,dh); d = 0;
01128   } else if( r <= 4*rs && r > r0 + rs ) {//III
01129     dh3Ser(r,r2,ri,rc,r0,rs,dh); d = 3;
01130   } else if ( r <= r0 + rs && r > (r0>rs?r0-rs:rs-r0) ) {//IV
01131     dh4Ser(r,r2,ri,rc,r0,rs,dh); d = 4;
01132   } else if (r0 < rs ) {//V
01133     dh5Ser(r,r2,ri,rc,r0,rs,dh); d = 5;
01134   } else {//VI
01135     dh6Ser(r,r2,ri,rc,r0,rs,dh); d = 6;
01136   }
01137 }

void CalcHPairSer ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  ri0,
BigReal  rjs,
BigReal  rj0,
BigReal  ris,
int &  dij,
int &  dji,
BigReal dhij,
BigReal dhji 
) [inline]

Definition at line 1138 of file ComputeGBISser.C.

References CalcHSer().

01151   {
01152   CalcHSer(r,r2,ri,rc,ri0,rjs,hij,dij);//hij
01153   CalcHSer(r,r2,ri,rc,rj0,ris,hji,dji);//hji
01154 }

void CalcHSer ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h,
int &  d 
) [inline]

Definition at line 1102 of file ComputeGBISser.C.

References h0Ser(), h1Ser(), h2Ser(), h3Ser(), h4Ser(), h5Ser(), and h6Ser().

Referenced by CalcHPairSer().

01103                                                           {
01104   if( r <= rc - rs && r > 4*rs ) {//II
01105     h2Ser(r,r2,ri,rc,r0,rs,h); d = 2;
01106   } else if (r <= rc + rs && r > rc - rs) {//I
01107     h1Ser(r,r2,ri,rc,r0,rs,h); d = 1;
01108   } else if (r > rc + rs) {//0
01109     h0Ser(r,r2,ri,rc,r0,rs,h); d = 0;
01110   } else if( r <= 4*rs && r > r0 + rs ) {//III
01111     h3Ser(r,r2,ri,rc,r0,rs,h); d = 3;
01112   } else if ( r <= r0 + rs && r > (r0>rs?r0-rs:rs-r0) ) {//IV
01113     h4Ser(r,r2,ri,rc,r0,rs,h); d = 4;
01114   } else if (r0 < rs ) {//V
01115     h5Ser(r,r2,ri,rc,r0,rs,h); d = 5;
01116   } else {//VI
01117     h6Ser(r,r2,ri,rc,r0,rs,h); d = 6;
01118   }
01119 }

void CalcScaleSer ( BigReal  r,
BigReal  t,
BigReal  c,
BigReal s,
BigReal d 
) [inline]

Definition at line 257 of file ComputeGBISser.C.

00262                 {//output s'(r)
00263 
00264   if (r <= t) { //[0,trans]
00265     s = 1;
00266     d = 0;
00267   } else if (r < c) { //[trans,cutoff]
00268     //precompute
00269     BigReal ct = (c-t);
00270     BigReal ct_i = 1/ct;
00271     BigReal ct_i2 = ct_i*ct_i;
00272     //BigReal ct_i4 = ct_i2*ct_i2;
00273 
00274     BigReal rt = r - t;
00275     BigReal rt2 = rt*rt;
00276     BigReal omrtct2 = 1-rt2*ct_i2;
00277     s = omrtct2*omrtct2;
00278     
00279     BigReal rc = r - c;
00280     d=s*4*rt/(rc*(rt+ct));
00281 
00282   } else { //[cutoff,infinity]
00283     s = 0;
00284     d = 0;
00285   }
00286 }

void dh0Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
Real  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 991 of file ComputeGBISser.C.

Referenced by CalcDHSer().

00992                                                 {
00993   dh = 0;
00994 }

void dh1Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1008 of file ComputeGBISser.C.

Referenced by CalcDHSer().

01009                                                    {
01010 
01011   BigReal rci = 1.0/rc;
01012   BigReal rmrs = r-rs;// 4 times
01013   BigReal rmrsi = 1.0/rmrs;
01014   BigReal rmrs2 = rmrs*rmrs;
01015   BigReal rs2 = rs*rs;
01016   BigReal logr = log(rmrs*rci);
01017   BigReal rci2 = rci*rci;
01018   dh = ri*ri*(-0.25*logr - (rc*rc - rmrs2)*(rs2 + r2)*0.125*rci2*rmrsi*rmrsi);
01019 }

void dh2Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1027 of file ComputeGBISser.C.

References DA, DB, DC, DD, and DE.

Referenced by CalcDHSer().

01028                                                    {
01029 
01030     BigReal k = rs*ri; k*=k;//k=(rs/r)^2
01031     dh = -rs*ri*ri*ri*k*(DA+k*(DB+k*(DC+k*(DD+k*DE))));
01032 }

void dh3Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1039 of file ComputeGBISser.C.

Referenced by CalcDHSer().

01040                                                    {
01041     BigReal rs2 = rs*rs;
01042     BigReal r2mrs2i = 1.0/(r2-rs2);
01043     dh = -0.25*ri*(2*(r2+rs2)*rs*r2mrs2i*r2mrs2i + ri*log((r-rs)/(r+rs)));
01044 }

void dh4Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1058 of file ComputeGBISser.C.

Referenced by CalcDHSer().

01059                                                    {
01060     BigReal ri2 = ri*ri;
01061     BigReal r02 = r0*r0;
01062     BigReal rs2 = rs*rs;
01063     BigReal r0i = 1.0/r0;
01064     BigReal rspri = 1.0/(r+rs);
01065     BigReal logr = log(r0*rspri);
01066     BigReal r02mrs2 = r02-rs2;
01067     BigReal rilogr = ri*logr;
01068     dh = 0.25*( (-0.5+(r2*r02mrs2 - 2*r*rs*rs2+rs2*r02mrs2)
01069         * 0.5*ri2*rspri*rspri)*r0i*r0i - ri*rilogr );
01070 }

void dh5Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1082 of file ComputeGBISser.C.

Referenced by CalcDHSer().

01083                                                    {
01084     BigReal rs2 = rs*rs;
01085     BigReal r2mrs2i = 1/(r2-rs2);
01086     BigReal rsr2mrs2i = rs*r2mrs2i;
01087     BigReal rprs = r+rs;
01088     BigReal rmrs = r-rs;
01089     BigReal logr = 0.5*ri*log(-rmrs/rprs);
01090     dh = -0.5*ri*((rs2+r2)*rsr2mrs2i*r2mrs2i+logr );
01091 }

void dh6Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal dh 
) [inline]

Definition at line 1097 of file ComputeGBISser.C.

Referenced by CalcDHSer().

01098                                                    {
01099   dh = 0;
01100 }

void h0Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
Real  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 987 of file ComputeGBISser.C.

Referenced by CalcHSer().

00988                                                {
00989   h = 0;
00990 }

void h1Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 996 of file ComputeGBISser.C.

Referenced by CalcHSer().

00997                                                   {
00998 
00999   BigReal rci = 1.0/rc;
01000   BigReal rmrs = r-rs;// 4 times
01001   BigReal rmrsi = 1.0/rmrs;
01002   BigReal rmrs2 = rmrs*rmrs;
01003   BigReal rs2 = rs*rs;
01004   BigReal logr = log(rmrs*rci);
01005   BigReal rci2 = rci*rci;
01006   h = 0.125*ri*(1 + 2*r*rmrsi + rci2*(r2 - 4*rc*r - rs2) + 2*logr);
01007 }

void h2Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 1021 of file ComputeGBISser.C.

References TA, TB, TC, TD, and TE.

Referenced by CalcHSer().

01022                                                   {
01023 
01024     BigReal k = rs*ri; k*=k;//k=(rs/r)^2
01025     h = rs*ri*ri*k*(TA+k*(TB+k*(TC+k*(TD+k*TE))));
01026 }

void h3Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 1034 of file ComputeGBISser.C.

Referenced by CalcHSer().

01035                                                   {
01036     BigReal r2mrs2i = 1.0/(r2-rs*rs);
01037     h = 0.5 * ( rs*r2mrs2i + 0.5 * log((r-rs)/(r+rs))*ri );
01038 }

void h4Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 1046 of file ComputeGBISser.C.

Referenced by CalcHSer().

01047                                                   {
01048     BigReal ri2 = ri*ri;
01049     BigReal r02 = r0*r0;
01050     BigReal rs2 = rs*rs;
01051     BigReal r0i = 1.0/r0;
01052     BigReal rspri = 1.0/(r+rs);
01053     BigReal logr = log(r0*rspri);
01054     BigReal r02mrs2 = r02-rs2;
01055     BigReal rilogr = ri*logr;
01056     h = 0.25*( r0i*(2-0.5*(r0i*ri*(r2 + r02 - rs2))) - rspri + rilogr );
01057 }

void h5Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 1072 of file ComputeGBISser.C.

Referenced by CalcHSer().

01073                                                   {
01074     BigReal rs2 = rs*rs;
01075     BigReal r2mrs2i = 1/(r2-rs2);
01076     BigReal rsr2mrs2i = rs*r2mrs2i;
01077     BigReal rprs = r+rs;
01078     BigReal rmrs = r-rs;
01079     BigReal logr = 0.5*ri*log(-rmrs/rprs);
01080     h = 0.5*( rsr2mrs2i + 2/r0 + logr );
01081 }

void h6Ser ( BigReal  r,
BigReal  r2,
BigReal  ri,
BigReal  rc,
BigReal  r0,
BigReal  rs,
BigReal h 
) [inline]

Definition at line 1093 of file ComputeGBISser.C.

Referenced by CalcHSer().

01094                                                   {
01095   h = 0;
01096 }

void Phase2_PairSer ( BigReal  r,
BigReal  r2,
BigReal  r_i,
BigReal  qiqj,
BigReal  ai,
BigReal  aj,
BigReal  epsilon_p_i,
BigReal  epsilon_s_i,
BigReal  kappa,
int  exclij,
BigReal  scale14,
int  stat,
BigReal coulEij,
BigReal ddrCoulEij,
BigReal gbEij,
BigReal ddrGbEij,
BigReal dEdai,
BigReal dEdaj 
) [inline]

Definition at line 1283 of file ComputeGBISser.C.

References Calc_dEda_PairSer(), and Calc_dEdr_PairSer().

01306   {
01307 
01308   //calculate Coulomb energy and force
01309   //Calc_Coul_Pair(r_i,qiqj,epsilon_p_i,exclij,scale14,coulEij,ddrCoulEij);
01310   coulEij = 0;
01311   ddrCoulEij = 0;
01312 
01313   //calculate GB energy and force
01314   BigReal aiaj,expr2aiaj4,fij,f_i,expkappa,Dij;
01315   Calc_dEdr_PairSer(r,r2,qiqj,ai,aj,kappa,epsilon_p_i,epsilon_s_i,
01316       aiaj,expr2aiaj4,fij,f_i,expkappa,Dij,gbEij,ddrGbEij);
01317 
01318   //calculate dEda
01319   if (doSlow) {
01320     Calc_dEda_PairSer(r2,ai,aj,qiqj,kappa,aiaj,expkappa,expr2aiaj4,
01321              fij,f_i,Dij,epsilon_s_i,dEdai,dEdaj);
01322   }
01323 }


Generated on Tue Sep 19 01:17:15 2017 for NAMD by  doxygen 1.4.7