APBS  1.4.1
vpmg.h
Go to the documentation of this file.
1 
80 #ifndef _VPMG_H_
81 #define _VPMG_H_
82 
83 #include "apbscfg.h"
84 
85 #include "maloc/maloc.h"
86 
87 #include "generic/vhal.h"
88 #include "generic/vacc.h"
89 #include "generic/vcap.h"
90 #include "generic/vpbe.h"
91 #include "generic/mgparm.h"
92 #include "generic/pbeparm.h"
93 #include "generic/vmatrix.h"
94 #include "pmgc/mgdrvd.h"
95 #include "pmgc/newdrvd.h"
96 #include "pmgc/mgsubd.h"
97 #include "pmgc/mikpckd.h"
98 #include "pmgc/matvecd.h"
99 #include "mg/vpmgp.h"
100 #include "mg/vgrid.h"
101 
105 #define VPMGMAXPART 2000
106 
116 struct sVpmg {
117 
118  Vmem *vmem;
122 #ifdef BURY_FORTRAN
123  Vpde *pde;
124  Vmgdriver *mgdriver;
125 #endif
126 
127  double *epsx;
128  double *epsy;
129  double *epsz;
130  double *kappa;
131  double *pot;
132  double *charge;
134  int *iparm;
135  double *rparm;
136  int *iwork;
137  double *rwork;
138  double *a1cf;
140  double *a2cf;
142  double *a3cf;
144  double *ccf;
145  double *fcf;
146  double *tcf;
147  double *u;
148  double *xf;
149  double *yf;
150  double *zf;
151  double *gxcf;
152  double *gycf;
153  double *gzcf;
154  double *pvec;
155  double extDiEnergy;
157  double extQmEnergy;
159  double extQfEnergy;
161  double extNpEnergy;
164  double splineWin;
168  int filled;
182  int usePotMap;
189 };
190 
195 typedef struct sVpmg Vpmg;
196 
197 /* /////////////////////////////////////////////////////////////////////////
200 #if !defined(VINLINE_VPMG)
201 
208  VEXTERNC unsigned long int Vpmg_memChk(
209  Vpmg *thee
210  );
211 
212 #else /* if defined(VINLINE_VPMG) */
213 
214 # define Vpmg_memChk(thee) (Vmem_bytes((thee)->vmem))
215 
216 #endif /* if !defined(VINLINE_VPMG) */
217 
218 /* /////////////////////////////////////////////////////////////////////////
221 
226 VEXTERNC Vpmg* Vpmg_ctor(
227  Vpmgp *parms,
228  Vpbe *pbe,
229  int focusFlag,
230  Vpmg *pmgOLD,
231  MGparm *mgparm,
232  PBEparm_calcEnergy energyFlag
233  );
234 
242 VEXTERNC int Vpmg_ctor2(
243  Vpmg *thee,
244  Vpmgp *parms,
245  Vpbe *pbe,
246  int focusFlag,
247  Vpmg *pmgOLD,
249  MGparm *mgparm,
251  PBEparm_calcEnergy energyFlag
254  );
255 
260 VEXTERNC void Vpmg_dtor(
261  Vpmg **thee
263  );
264 
269 VEXTERNC void Vpmg_dtor2(
270  Vpmg *thee
271  );
272 
281 VEXTERNC int Vpmg_fillco(
282  Vpmg *thee,
283  Vsurf_Meth surfMeth,
284  double splineWin,
286  Vchrg_Meth chargeMeth,
287  int useDielXMap,
288  Vgrid *dielXMap,
289  int useDielYMap,
290  Vgrid *dielYMap,
291  int useDielZMap,
292  Vgrid *dielZMap,
293  int useKappaMap,
294  Vgrid *kappaMap,
295  int usePotMap,
296  Vgrid *potMap,
297  int useChargeMap,
298  Vgrid *chargeMap
299  );
300 
306 VEXTERNC int Vpmg_solve(
307  Vpmg *thee
308  );
309 
321 VEXTERNC int Vpmg_solveLaplace(
322  Vpmg *thee
323  );
324 
334 VEXTERNC double Vpmg_energy(
335  Vpmg *thee,
336  int extFlag
340  );
341 
359 VEXTERNC double Vpmg_qfEnergy(
360  Vpmg *thee,
361  int extFlag
365  );
366 
386 VEXTERNC double Vpmg_qfAtomEnergy(
387  Vpmg *thee,
388  Vatom *atom
389  );
390 
415 VEXTERNC double Vpmg_qmEnergy(
416  Vpmg *thee,
417  int extFlag
421  );
422 
423 
442 VEXTERNC double Vpmg_dielEnergy(
443  Vpmg *thee,
444  int extFlag
448  );
449 
450 
467 VEXTERNC double Vpmg_dielGradNorm(
468  Vpmg *thee
469  );
470 
482 VEXTERNC int Vpmg_force(
483  Vpmg *thee,
484  double *force,
486  int atomID,
487  Vsurf_Meth srfm,
488  Vchrg_Meth chgm
489  );
490 
502 VEXTERNC int Vpmg_qfForce(
503  Vpmg *thee,
504  double *force,
506  int atomID,
507  Vchrg_Meth chgm
508  );
509 
521 VEXTERNC int Vpmg_dbForce(
522  Vpmg *thee,
523  double *dbForce,
525  int atomID,
526  Vsurf_Meth srfm
527  );
528 
540 VEXTERNC int Vpmg_ibForce(
541  Vpmg *thee,
542  double *force,
544  int atomID,
545  Vsurf_Meth srfm
546  );
547 
553 VEXTERNC void Vpmg_setPart(
554  Vpmg *thee,
555  double lowerCorner[3],
556  double upperCorner[3],
557  int bflags[6]
561  );
562 
567 VEXTERNC void Vpmg_unsetPart(
568  Vpmg *thee
569  );
570 
576 VEXTERNC int Vpmg_fillArray(
577  Vpmg *thee,
578  double *vec,
580  Vdata_Type type,
581  double parm,
582  Vhal_PBEType pbetype,
583  PBEparm * pbeparm
584  );
585 
591 VPUBLIC void Vpmg_fieldSpline4(
592  Vpmg *thee,
593  int atomID,
594  double field[3]
595  );
596 
604 VEXTERNC double Vpmg_qfPermanentMultipoleEnergy(
605  Vpmg *thee,
606  int atomID
607  );
608 
614 VEXTERNC void Vpmg_qfPermanentMultipoleForce(
615  Vpmg *thee,
616  int atomID,
617  double force[3],
618  double torque[3]
619  );
620 
625 VEXTERNC void Vpmg_ibPermanentMultipoleForce(
626  Vpmg *thee,
627  int atomID,
628  double force[3]
629  );
630 
635 VEXTERNC void Vpmg_dbPermanentMultipoleForce(
636  Vpmg *thee,
637  int atomID,
638  double force[3]
639  );
640 
647 VEXTERNC void Vpmg_qfDirectPolForce(
648  Vpmg *thee,
649  Vgrid *perm,
650  Vgrid *induced,
651  int atomID,
652  double force[3],
653  double torque[3]
654  );
655 
664 VEXTERNC void Vpmg_qfNLDirectPolForce(
665  Vpmg *thee,
666  Vgrid *perm,
667  Vgrid *nlInduced,
668  int atomID,
669  double force[3],
670  double torque[3]
671  );
672 
680 VEXTERNC void Vpmg_ibDirectPolForce(
681  Vpmg *thee,
682  Vgrid *perm,
683  Vgrid *induced,
684  int atomID,
685  double force[3]
686  );
687 
696 VEXTERNC void Vpmg_ibNLDirectPolForce(
697  Vpmg *thee,
698  Vgrid *perm,
699  Vgrid *nlInduced,
700  int atomID,
701  double force[3]
702  );
703 
711 VEXTERNC void Vpmg_dbDirectPolForce(
712  Vpmg *thee,
713  Vgrid *perm,
714  Vgrid *induced,
715  int atomID,
716  double force[3]
717  );
718 
727 VEXTERNC void Vpmg_dbNLDirectPolForce(
728  Vpmg *thee,
729  Vgrid *perm,
730  Vgrid *nlInduced,
731  int atomID,
732  double force[3]
733  );
734 
741 VEXTERNC void Vpmg_qfMutualPolForce(
742  Vpmg *thee,
743  Vgrid *induced,
744  Vgrid *nlInduced,
745  int atomID,
746  double force[3]
747  );
748 
756 VEXTERNC void Vpmg_ibMutualPolForce(
757  Vpmg *thee,
758  Vgrid *induced,
759  Vgrid *nlInduced,
760  int atomID,
761  double force[3]
762  );
763 
771 VEXTERNC void Vpmg_dbMutualPolForce(
772  Vpmg *thee,
773  Vgrid *induced,
774  Vgrid *nlInduced,
775  int atomID,
776  double force[3]
777  );
778 
785 VEXTERNC void Vpmg_printColComp(
786  Vpmg *thee,
787  char path[72],
788  char title[72],
789  char mxtype[3],
797  int flag
801  );
802 
803 
804 
811 VPRIVATE void bcolcomp(
812  int *iparm, ///< @todo Document
813  double *rparm, ///< @todo Document
814  int *iwork, ///< @todo Document
815  double *rwork, ///< @todo Document
816  double *values, ///< @todo Document
817  int *rowind, ///< @todo Document
818  int *colptr, ///< @todo Document
819  int *flag
824  );
825 
826 
827 
834 VPRIVATE void bcolcomp2(
835  int *iparm, ///< @todo Document
836  double *rparm, ///< @todo Document
837  int *nx, ///< @todo Document
838  int *ny, ///< @todo Document
839  int *nz, ///< @todo Document
840  int *iz, ///< @todo Document
841  int *ipc, ///< @todo Document
842  double *rpc, ///< @todo Document
843  double *ac, ///< @todo Document
844  double *cc, ///< @todo Document
845  double *values, ///< @todo Document
846  int *rowind, ///< @todo Document
847  int *colptr, ///< @todo Document
848  int *flag
853  );
854 
855 
856 
863 VPRIVATE void bcolcomp3(
864  int *nx, ///< @todo Document
865  int *ny, ///< @todo Document
866  int *nz, ///< @todo Document
867  int *ipc, ///< @todo Document
868  double *rpc, ///< @todo Document
869  double *ac, ///< @todo Document
870  double *cc, ///< @todo Document
871  double *values, ///< @todo Document
872  int *rowind, ///< @todo Document
873  int *colptr, ///< @todo Document
874  int *flag ///< @todo Document
875  );
876 
877 
878 
885 VPRIVATE void bcolcomp4(
886  int *nx, ///< @todo Document
887  int *ny, ///< @todo Document
888  int *nz, ///< @todo Document
889  int *ipc, ///< @todo Document
890  double *rpc, ///< @todo Document
891  double *oC, ///< @todo Document
892  double *cc, ///< @todo Document
893  double *oE, ///< @todo Document
894  double *oN, ///< @todo Document
895  double *uC, ///< @todo Document
896  double *values, ///< @todo Document
897  int *rowind, ///< @todo Document
898  int *colptr, ///< @todo Document
899  int *flag ///< @todo Document
900  );
901 
902 
903 
910 VPRIVATE void pcolcomp(
911  int *nrow, ///< @todo Document
912  int *ncol, ///< @todo Document
913  int *nnzero, ///< @todo Document
914  double *values, ///< @todo Document
915  int *rowind, ///< @todo Document
916  int *colptr, ///< @todo Document
917  char *path, ///< @todo Document
918  char *title, ///< @todo Document
919  char *mxtype ///< @todo Document
920  );
921 
922 
923 
924 /* ///////////////////////////////////////////////////////////////////////////
925 // Internal routines
927 
933 VPRIVATE double bspline2(
934  double x
935  );
936 
942 VPRIVATE double dbspline2(
943  double x
944  );
945 
951 VPRIVATE double VFCHI4(
952  int i,
953  double f
954  );
955 
961 VPRIVATE double bspline4(
962  double x
963  );
964 
970 VPRIVATE double dbspline4(
971  double x
972  );
973 
979 VPRIVATE double d2bspline4(
980  double x
981  );
982 
988 VPRIVATE double d3bspline4(
989  double x
990  );
991 
998 VPRIVATE double Vpmg_polarizEnergy(
999  Vpmg *thee,
1000  int extFlag
1002  );
1009 VPRIVATE double Vpmg_qfEnergyPoint(
1010  Vpmg *thee,
1011  int extFlag
1013  );
1014 
1020 VPRIVATE double Vpmg_qfEnergyVolume(
1021  Vpmg *thee,
1022  int extFlag
1024  );
1025 
1031 VPRIVATE void Vpmg_splineSelect(
1032  int srfm,
1034  Vacc *acc,
1035  double *gpos,
1036  double win,
1037  double infrad,
1038  Vatom *atom,
1039  double *force
1040  );
1041 
1047 VPRIVATE void focusFillBound(
1048  Vpmg *thee,
1049  Vpmg *pmg
1050  );
1051 
1058 VPRIVATE void bcfl1(
1059  double size,
1060  double *apos,
1061  double charge,
1062  double xkappa,
1063  double pre1,
1064  double *gxcf,
1065  double *gycf,
1066  double *gzcf,
1067  double *xf,
1068  double *yf,
1069  double *zf,
1070  int nx,
1071  int ny,
1072  int nz
1073  );
1074 
1080 VPRIVATE void bcfl2(
1081  double size,
1082  double *apos,
1083  double charge,
1084  double *dipole,
1085  double *quad,
1086  double xkappa,
1087  double eps_p,
1088  double eps_w,
1089  double T,
1090  double *gxcf,
1091  double *gycf,
1092  double *gzcf,
1093  double *xf,
1094  double *yf,
1095  double *zf,
1096  int nx,
1097  int ny,
1098  int nz
1099  );
1100 
1109 VPRIVATE void multipolebc(
1110  double r,
1111  double kappa,
1112  double eps_p,
1113  double eps_w,
1114  double rad,
1115  double tsr[3]
1116  );
1117 
1126 VPRIVATE double bcfl1sp(
1127  double size,
1128  double *apos,
1129  double charge,
1130  double xkappa,
1131  double pre1,
1132  double *pos
1133  );
1134 
1139 VPRIVATE void bcCalc(
1140  Vpmg *thee
1141  );
1142 
1147 VPRIVATE void fillcoCoef(
1148  Vpmg *thee
1149  );
1150 
1155 VPRIVATE void fillcoCoefMap(
1156  Vpmg *thee
1157  );
1158 
1164 VPRIVATE void fillcoCoefMol(
1165  Vpmg *thee
1166  );
1167 
1173 VPRIVATE void fillcoCoefMolIon(
1174  Vpmg *thee
1175  );
1176 
1182 VPRIVATE void fillcoCoefMolDiel(
1183  Vpmg *thee
1184  );
1185 
1191 VPRIVATE void fillcoCoefMolDielNoSmooth(
1192  Vpmg *thee
1193  );
1194 
1208 VPRIVATE void fillcoCoefMolDielSmooth(
1209  Vpmg *thee
1210  );
1211 
1217 VPRIVATE void fillcoCoefSpline(
1218  Vpmg *thee
1219  );
1220 
1226 VPRIVATE void fillcoCoefSpline3(
1227  Vpmg *thee
1228  );
1229 
1235 VPRIVATE void fillcoCoefSpline4(
1236  Vpmg *thee
1237  );
1238 
1244 VPRIVATE Vrc_Codes fillcoCharge(
1245  Vpmg *thee
1246  );
1247 
1253 VPRIVATE Vrc_Codes fillcoChargeMap(
1254  Vpmg *thee
1255  );
1256 
1261 VPRIVATE void fillcoChargeSpline1(
1262  Vpmg *thee
1263  );
1264 
1269 VPRIVATE void fillcoChargeSpline2(
1270  Vpmg *thee
1271  );
1272 
1277 VPRIVATE void fillcoPermanentMultipole(
1278  Vpmg *thee
1279  );
1280 
1285 VPRIVATE void fillcoInducedDipole(
1286  Vpmg *thee
1287  );
1288 
1294 VPRIVATE void fillcoNLInducedDipole(
1295  Vpmg *thee
1296  );
1297 
1304 VPRIVATE void extEnergy(
1305  Vpmg *thee,
1306  Vpmg *pmgOLD,
1307  PBEparm_calcEnergy extFlag,
1308  double partMin[3],
1309  double partMax[3],
1310  int bflags[6]
1311  );
1312 
1317 VPRIVATE void qfForceSpline1(
1318  Vpmg *thee,
1319  double *force,
1320  int atomID
1321  );
1322 
1327 VPRIVATE void qfForceSpline2(
1328  Vpmg *thee,
1329  double *force,
1330  int atomID
1331  );
1332 
1337 VPRIVATE void qfForceSpline4(
1338  Vpmg *thee,
1339  double *force,
1340  int atomID
1341  );
1342 
1343 
1351 VPRIVATE void zlapSolve(
1352  Vpmg *thee,
1353  double **solution,
1354  double **source,
1355  double **work1
1356  );
1357 
1364 VPRIVATE void markSphere(
1365  double rtot,
1366  double *tpos,
1367  int nx,
1368  int ny,
1369  int nz,
1370  double hx,
1371  double hy,
1372  double hzed,
1373  double xmin,
1374  double ymin,
1375  double zmin,
1376  double *array,
1377  double markVal
1378  );
1379 
1384 VPRIVATE double Vpmg_qmEnergySMPBE(Vpmg *thee, int extFlag);
1385 VPRIVATE double Vpmg_qmEnergyNONLIN(Vpmg *thee, int extFlag);
1386 
1387 
1388 
1389 // Additional macros and definitions. May not be needed
1390 
1391 // Added by Vincent Chu 9/13/06 for SMPB
1392 #define VCUB(x) ((x)*(x)*(x))
1393 #define VLOG(x) (log(x))
1394 
1395 #define IJK(i,j,k) (((k)*(nx)*(ny))+((j)*(nx))+(i))
1396 #define IJKx(j,k,i) (((i)*(ny)*(nz))+((k)*(ny))+(j))
1397 #define IJKy(i,k,j) (((j)*(nx)*(nz))+((k)*(nx))+(i))
1398 #define IJKz(i,j,k) (((k)*(nx)*(ny))+((j)*(nx))+(i))
1399 #define VFCHI(iint,iflt) (1.5+((double)(iint)-(iflt)))
1400 
1401 
1402 #endif /* ifndef _VPMG_H_ */
1403 
enum eVchrg_Src Vchrg_Src
Declaration of the Vchrg_Src type as the Vchrg_Meth enum.
Definition: vhal.h:264
double * epsz
Definition: vpmg.h:129
double * xf
Definition: vpmg.h:148
Vmem * vmem
Definition: vpmg.h:118
double * kappa
Definition: vpmg.h:130
enum eVsurf_Meth Vsurf_Meth
Declaration of the Vsurf_Meth type as the Vsurf_Meth enum.
Definition: vhal.h:135
double * gxcf
Definition: vpmg.h:151
double * epsx
Definition: vpmg.h:127
int useDielZMap
Definition: vpmg.h:176
Contains public data members for Vpbe class/module.
Definition: vpbe.h:84
double extQmEnergy
Definition: vpmg.h:157
Contains declarations for class Vacc.
Electrostatic potential oracle for Cartesian mesh data.
Definition: vgrid.h:81
double splineWin
Definition: vpmg.h:164
int useChargeMap
Definition: vpmg.h:186
double extNpEnergy
Definition: vpmg.h:161
Contains public data members for Vpmg class/module.
Definition: vpmg.h:116
double * u
Definition: vpmg.h:147
Vpmgp * pmgp
Definition: vpmg.h:119
double * pot
Definition: vpmg.h:131
Contains declarations for class Vpbe.
Contains declarations for class Vcap.
double * a1cf
Definition: vpmg.h:138
Contains declarations for class Vpmgp.
Contains declarations for class MGparm.
Vgrid * dielYMap
Definition: vpmg.h:175
double extDiEnergy
Definition: vpmg.h:155
Vgrid * dielZMap
Definition: vpmg.h:178
Potential oracle for Cartesian mesh data.
double * rparm
Definition: vpmg.h:135
Vgrid * chargeMap
Definition: vpmg.h:188
double * yf
Definition: vpmg.h:149
int * iwork
Definition: vpmg.h:136
double * rwork
Definition: vpmg.h:137
double * gzcf
Definition: vpmg.h:153
Vgrid * dielXMap
Definition: vpmg.h:172
double * fcf
Definition: vpmg.h:145
double * gycf
Definition: vpmg.h:152
double * charge
Definition: vpmg.h:132
double * ccf
Definition: vpmg.h:144
int * iparm
Definition: vpmg.h:134
int useKappaMap
Definition: vpmg.h:179
Contains public data members for Vpmgp class/module.
Definition: vpmgp.h:80
double * zf
Definition: vpmg.h:150
int filled
Definition: vpmg.h:168
Contains generic macro definitions for APBS.
double extQfEnergy
Definition: vpmg.h:159
Contains declarations for class PBEparm.
int useDielXMap
Definition: vpmg.h:170
Vsurf_Meth surfMeth
Definition: vpmg.h:163
Vgrid * potMap
Definition: vpmg.h:184
double * epsy
Definition: vpmg.h:128
double * a3cf
Definition: vpmg.h:142
double * tcf
Definition: vpmg.h:146
Vpbe * pbe
Definition: vpmg.h:120
Vgrid * kappaMap
Definition: vpmg.h:181
Vchrg_Src chargeSrc
Definition: vpmg.h:166
enum eVchrg_Meth Vchrg_Meth
Declaration of the Vchrg_Meth type as the Vchrg_Meth enum.
Definition: vhal.h:246
Vchrg_Meth chargeMeth
Definition: vpmg.h:165
Contains inclusions for matrix data wrappers.
int useDielYMap
Definition: vpmg.h:173
double * a2cf
Definition: vpmg.h:140
double * pvec
Definition: vpmg.h:154
int usePotMap
Definition: vpmg.h:182