254 thee = (
Vpbe*)Vmem_malloc(VNULL, 1,
sizeof(
Vpbe) );
255 VASSERT( thee != VNULL);
256 VASSERT(
Vpbe_ctor2(thee, alist, ionNum, ionConc, ionRadii, ionQ,
257 T, soluteDiel, solventDiel, solventRadius, focusFlag, sdens,
258 z_mem, L, membraneDiel, V) );
265 double *ionConc,
double *ionRadii,
266 double *ionQ,
double T,
double soluteDiel,
267 double solventDiel,
double solventRadius,
int focusFlag,
268 double sdens,
double z_mem,
double L,
double membraneDiel,
271 int i, iatom, inhash[3];
274 double center[3] = {0.0, 0.0, 0.0};
275 double lower_corner[3] = {0.0, 0.0, 0.0};
276 double upper_corner[3] = {0.0, 0.0, 0.0};
277 double disp[3], dist, radius, charge, xmin, xmax, ymin, ymax, zmin, zmax;
278 double x, y, z, netCharge;
280 const double N_A = 6.022045000e+23;
281 const double e_c = 4.803242384e-10;
282 const double k_B = 1.380662000e-16;
283 const double pi = 4. * VATAN(1.);
286 thee->
vmem = Vmem_ctor(
"APBS::VPBE");
288 VASSERT(thee != VNULL);
289 if (alist == VNULL) {
290 Vnm_print(2,
"Vpbe_ctor2: Got null pointer to Valist object!\n");
323 if ((x+atomRadius) > xmax) xmax = x + atomRadius;
324 if ((x-atomRadius) < xmin) xmin = x - atomRadius;
325 if ((y+atomRadius) > ymax) ymax = y + atomRadius;
326 if ((y-atomRadius) < ymin) ymin = y - atomRadius;
327 if ((z+atomRadius) > zmax) zmax = z + atomRadius;
328 if ((z-atomRadius) < zmin) zmin = z - atomRadius;
329 disp[0] = (x - center[0]);
330 disp[1] = (y - center[1]);
331 disp[2] = (z - center[2]);
332 dist = (disp[0]*disp[0]) + (disp[1]*disp[1]) + (disp[2]*disp[2]);
333 dist = VSQRT(dist) + atomRadius;
334 if (dist > radius) radius = dist;
338 Vnm_print(0,
"Vpbe_ctor2: solute radius = %g\n", radius);
342 Vnm_print(0,
"Vpbe_ctor2: solute dimensions = %g x %g x %g\n",
345 Vnm_print(0,
"Vpbe_ctor2: solute charge = %g\n", charge);
350 Vnm_print(2,
"Vpbe_ctor2: Too many ion species (MAX = %d)!\n",
357 for (i=0; i<thee->
numIon; i++) {
361 thee->
ionQ[i] = ionQ[i];
363 netCharge += (ionConc[i]*ionQ[i]);
366 Vnm_print(1,
" Vpbe_ctor: Using max ion radius (%g A) for exclusion \ 369 if (VABS(netCharge) > VSMALL) {
370 Vnm_print(2,
"Vpbe_ctor2: You have a counterion charge imbalance!\n");
371 Vnm_print(2,
"Vpbe_ctor2: Net charge conc. = %g M\n", netCharge);
389 if (thee->
T == 0.0) {
390 Vnm_print(2,
"Vpbe_ctor2: You set the temperature to 0 K.\n");
391 Vnm_print(2,
"Vpbe_ctor2: That violates the 3rd Law of Thermo.!");
400 ((8.0 * pi * N_A * e_c*e_c) /
406 Vnm_print(0,
"Vpbe_ctor2: bulk ionic strength = %g\n",
408 Vnm_print(0,
"Vpbe_ctor2: xkappa = %g\n", thee->
xkappa);
409 Vnm_print(0,
"Vpbe_ctor2: Debye length = %g\n", thee->
deblen);
410 Vnm_print(0,
"Vpbe_ctor2: zkappa2 = %g\n", thee->
zkappa2);
411 thee->
zmagic = ((4.0 * pi * e_c*e_c) / (k_B * thee->
T)) * 1.0e+8;
412 Vnm_print(0,
"Vpbe_ctor2: zmagic = %g\n", thee->
zmagic);
426 for (i=0; i<3; i++) inhash[i] = (
int)(nhash[i]);
429 if (inhash[i] < 3) inhash[i] = 3;
430 if (inhash[i] > MAX_HASH_DIM) inhash[i] = MAX_HASH_DIM;
432 Vnm_print(0,
"Vpbe_ctor2: Constructing Vclist with %d x %d x %d table\n",
433 inhash[0], inhash[1], inhash[2]);
438 VASSERT(thee->
clist != VNULL);
441 VASSERT(thee->
acc != VNULL);
468 if ((*thee) != VNULL) {
470 Vmem_free(VNULL, 1,
sizeof(
Vpbe), (
void **)thee);
478 Vmem_dtor(&(thee->
vmem));
485 double dist, *ipos, *jpos, icharge, jcharge;
488 Vatom *iatom, *jatom;
491 VASSERT(thee != VNULL);
493 VASSERT(alist != VNULL);
497 for (i=0; i<natoms; i++) {
501 for (j=i+1; j<natoms; j++) {
506 for (k=0; k<3; k++) dist += ((ipos[k]-jpos[k])*(ipos[k]-jpos[k]));
508 energy = energy + icharge*jcharge/dist;
525 unsigned long int memUse = 0;
527 if (thee == VNULL)
return 0;
529 memUse = memUse +
sizeof(
Vpbe);
540 VASSERT(thee != VNULL);
543 for (i=0; i<(*nion); i++) {
546 ionQ[i] = thee->
ionQ[i];
VPUBLIC Vacc * Vacc_ctor(Valist *alist, Vclist *clist, double surf_density)
Construct the accessibility object.
VPUBLIC Valist * Vpbe_getValist(Vpbe *thee)
Get atom list.
Contains public data members for Vpbe class/module.
VPUBLIC double Vpbe_getSoluteDiel(Vpbe *thee)
Get solute dielectric constant.
VPUBLIC void Vacc_dtor(Vacc **thee)
Destroy object.
VPUBLIC double Vpbe_getCoulombEnergy1(Vpbe *thee)
Calculate coulombic energy of set of charges.
VPUBLIC unsigned long int Vacc_memChk(Vacc *thee)
Get number of bytes in this object and its members.
VPUBLIC int Vpbe_ctor2(Vpbe *thee, Valist *alist, int ionNum, double *ionConc, double *ionRadii, double *ionQ, double T, double soluteDiel, double solventDiel, double solventRadius, int focusFlag, double sdens, double z_mem, double L, double membraneDiel, double V)
FORTRAN stub to construct Vpbe objct.
VPUBLIC int Valist_getNumberAtoms(Valist *thee)
Get number of atoms in the list.
VPUBLIC void Vclist_dtor(Vclist **thee)
Destroy object.
Contains declarations for class Vpbe.
VPUBLIC double Vpbe_getTemperature(Vpbe *thee)
Get temperature.
VPUBLIC Vclist * Vclist_ctor(Valist *alist, double max_radius, int npts[VAPBS_DIM], Vclist_DomainMode mode, double lower_corner[VAPBS_DIM], double upper_corner[VAPBS_DIM])
Construct the cell list object.
VPUBLIC int Vpbe_getIons(Vpbe *thee, int *nion, double ionConc[MAXION], double ionRadii[MAXION], double ionQ[MAXION])
Get information about the counterion species present.
VPUBLIC Vatom * Valist_getAtom(Valist *thee, int i)
Get pointer to particular atom in list.
VPUBLIC unsigned long int Vpbe_memChk(Vpbe *thee)
Return the memory used by this structure (and its contents) in bytes.
#define Vunit_kb
Boltzmann constant.
VPUBLIC void Vpbe_dtor(Vpbe **thee)
Object destructor.
VPUBLIC double * Vatom_getPosition(Vatom *thee)
Get atomic position.
Contains public data members for Vatom class/module.
Container class for list of atom objects.
#define Vunit_eps0
Vacuum permittivity.
VPUBLIC void Vpbe_dtor2(Vpbe *thee)
FORTRAN stub object destructor.
#define MAXION
The maximum number of ion species that can be involved in a single PBE calculation.
VPUBLIC double Vatom_getRadius(Vatom *thee)
Get atomic position.
struct sVpbe Vpbe
Declaration of the Vpbe class as the Vpbe structure.
VPUBLIC double Vatom_getCharge(Vatom *thee)
Get atomic charge.
#define Vunit_ec
Charge of an electron in C.