61 #if !defined(VINLINE_VCLIST) 64 if (thee == VNULL)
return 0;
65 return Vmem_bytes(thee->
vmem);
69 VASSERT(thee != VNULL);
77 double lower_corner[VAPBS_DIM],
double upper_corner[VAPBS_DIM]) {
83 VASSERT( thee != VNULL);
84 VASSERT(
Vclist_ctor2(thee, alist, max_radius, npts, mode, lower_corner,
90 VPRIVATE
void Vclist_getMolDims(
93 double upper_corner[VAPBS_DIM],
106 lower_corner[i] = VLARGE;
107 upper_corner[i] = -VLARGE;
116 if ( pos < lower_corner[j] ) lower_corner[j] = pos;
117 if ( pos > upper_corner[j] ) upper_corner[j] = pos;
125 VPRIVATE Vrc_Codes Vclist_setupGrid(
Vclist *thee) {
128 #define VCLIST_INFLATE 1.42 134 switch (thee->
mode) {
151 Vnm_print(2,
"Vclist_setupGrid: invalid setup mode (%d)!\n",
159 thee->
spacs[i] = length[i]/((double)(thee->
npts[i] - 1));
161 Vnm_print(0,
"Vclist_setupGrid: Grid lengths = (%g, %g, %g)\n",
162 length[0], length[1], length[2]);
164 Vnm_print(0,
"Vclist_setupGrid: Grid lower corner = (%g, %g, %g)\n",
170 #undef VCLIST_INFLATE 174 VPRIVATE Vrc_Codes Vclist_storeParms(
Vclist *thee,
Valist *alist,
176 double lower_corner[VAPBS_DIM],
double upper_corner[VAPBS_DIM] ) {
180 if (alist == VNULL) {
181 Vnm_print(2,
"Vclist_ctor2: Got NULL Valist!\n");
183 }
else thee->
alist = alist;
189 "Vclist_ctor2: n[%d] (%d) must be greater than 2!\n",
193 thee->
npts[i] = npts[i];
196 Vnm_print(0,
"Vclist_ctor2: Using %d x %d x %d hash table\n",
197 npts[0], npts[1], npts[2]);
200 switch (thee->
mode) {
202 Vnm_print(0,
"Vclist_ctor2: automatic domain setup.\n");
205 Vnm_print(0,
"Vclist_ctor2: manual domain setup.\n");
206 Vnm_print(0,
"Vclist_ctor2: lower corner = [ \n");
209 Vnm_print(0,
"%g ", lower_corner[i]);
212 Vnm_print(0,
"Vclist_ctor2: upper corner = [ \n");
215 Vnm_print(0,
"%g ", upper_corner[i]);
220 Vnm_print(2,
"Vclist_ctor2: invalid setup mode (%d)!\n", mode);
225 Vnm_print(0,
"Vclist_ctor2: Using %g max radius\n", max_radius);
231 VPRIVATE
void Vclist_gridSpan(
Vclist *thee,
238 double *coord, dc, idc, rtot;
250 idc = (dc + rtot)/(thee->
spacs[i]);
251 imax[i] = (int)(ceil(idc));
252 imax[i] = VMIN2(imax[i], thee->
npts[i]-1);
253 idc = (dc - rtot)/(thee->
spacs[i]);
254 imin[i] = (int)(floor(idc));
255 imin[i] = VMAX2(imin[i], 0);
262 VPRIVATE
int Vclist_arrayIndex(
Vclist *thee,
int i,
int j,
int k) {
264 return (thee->
npts[2])*(thee->
npts[1])*i + (thee->
npts[2])*j + k;
270 VPRIVATE Vrc_Codes Vclist_assignAtoms(
Vclist *thee) {
272 int iatom, i, j, k, ui, inext;
285 Vclist_gridSpan(thee, atom, imin, imax);
288 VASSERT(VAPBS_DIM == 3);
289 for ( i = imin[0]; i <= imax[0]; i++) {
290 for ( j = imin[1]; j <= imax[1]; j++) {
291 for ( k = imin[2]; k <= imax[2]; k++) {
293 ui = Vclist_arrayIndex(thee, i, j, k);
295 cell = &(thee->
cells[ui]);
302 Vnm_print(0,
"Vclist_assignAtoms: Have %d atom entries\n", totatoms);
305 for (ui=0; ui<thee->
n; ui++) {
306 cell = &(thee->
cells[ui]);
308 Vnm_print(2,
"Vclist_assignAtoms: cell error!\n");
320 Vclist_gridSpan(thee, atom, imin, imax);
323 for (i = imin[0]; i <= imax[0]; i++) {
324 for (j = imin[1]; j <= imax[1]; j++) {
325 for (k = imin[2]; k <= imax[2]; k++) {
327 ui = Vclist_arrayIndex(thee, i, j, k);
328 cell = &(thee->
cells[ui]);
331 cell->
atoms[inext] = atom;
345 double lower_corner[VAPBS_DIM],
double upper_corner[VAPBS_DIM]) {
351 if ( Vclist_storeParms(thee, alist, max_radius, npts, mode, lower_corner,
353 Vnm_print(2,
"Vclist_ctor2: parameter check failed!\n");
358 thee->
vmem = Vmem_ctor(
"APBS::VCLIST");
359 if (thee->
vmem == VNULL) {
360 Vnm_print(2,
"Vclist_ctor2: memory object setup failed!\n");
366 if (thee->
cells == VNULL) {
368 "Vclist_ctor2: Failed allocating %d VclistCell objects!\n",
372 for (i=0; i<thee->
n; i++) {
373 cell = &(thee->
cells[i]);
379 Vnm_print(2,
"Vclist_ctor2: grid setup failed!\n");
385 Vnm_print(2,
"Vclist_ctor2: atom assignment failed!\n");
399 if ((*thee) != VNULL) {
401 Vmem_free(VNULL, 1,
sizeof(
Vclist), (
void **)thee);
413 for (i=0; i<thee->
n; i++) {
414 cell = &(thee->
cells[i]);
418 (
void **)&(thee->
cells));
419 Vmem_dtor(&(thee->
vmem));
424 double pos[VAPBS_DIM]
433 VASSERT(VAPBS_DIM == 3);
438 ic[i] = (int)(c[i]/thee->
spacs[i]);
440 if (ic[i] < 0 || ic[i] >= thee->
npts[i]) {
446 ui = Vclist_arrayIndex(thee, ic[0], ic[1], ic[2]);
448 return &(thee->
cells[ui]);
458 VASSERT( thee != VNULL);
467 Vnm_print(2,
"VclistCell_ctor2: NULL thee!\n");
474 if (thee->
atoms == VNULL) {
476 "VclistCell_ctor2: unable to allocate space for %d atom pointers!\n",
488 if ((*thee) != VNULL) {
490 Vmem_free(VNULL, 1,
sizeof(
VclistCell), (
void **)thee);
501 (
void **)&(thee->
atoms));
double upper_corner[VAPBS_DIM]
VPUBLIC unsigned long int Vclist_memChk(Vclist *thee)
Get number of bytes in this object and its members.
VPUBLIC VclistCell * VclistCell_ctor(int natoms)
Allocate and construct a cell list cell object.
VPUBLIC double Vclist_maxRadius(Vclist *thee)
Get the max probe radius value (in A) the cell list was constructed with.
VPUBLIC Vrc_Codes Vclist_ctor2(Vclist *thee, Valist *alist, double max_radius, int npts[VAPBS_DIM], Vclist_DomainMode mode, double lower_corner[VAPBS_DIM], double upper_corner[VAPBS_DIM])
FORTRAN stub to construct the cell list object.
VPUBLIC int Valist_getNumberAtoms(Valist *thee)
Get number of atoms in the list.
VPUBLIC void Vclist_dtor(Vclist **thee)
Destroy object.
VPUBLIC void VclistCell_dtor(VclistCell **thee)
Destroy object.
enum eVclist_DomainMode Vclist_DomainMode
Declaration of Vclist_DomainMode enumeration type.
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 VclistCell * Vclist_getCell(Vclist *thee, double pos[VAPBS_DIM])
Return cell corresponding to specified position or return VNULL.
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
VPUBLIC Vrc_Codes VclistCell_ctor2(VclistCell *thee, int natoms)
Construct a cell list object.
VPUBLIC Vatom * Valist_getAtom(Valist *thee, int i)
Get pointer to particular atom in list.
VPUBLIC void Vclist_dtor2(Vclist *thee)
FORTRAN stub to destroy object.
#define VAPBS_DIM
Our dimension.
VPUBLIC double * Vatom_getPosition(Vatom *thee)
Get atomic position.
Contains public data members for Vatom class/module.
Container class for list of atom objects.
double lower_corner[VAPBS_DIM]
Contains declarations for class Vclist.
VPUBLIC double Vatom_getRadius(Vatom *thee)
Get atomic position.
VPUBLIC void VclistCell_dtor2(VclistCell *thee)
FORTRAN stub to destroy object.