60VPRIVATE
char *Valist_whiteChars = " \t\r\n";
61VPRIVATE
char *Valist_commChars = "
#%";
62VPRIVATE char *Valist_xmlwhiteChars = " \t\r\n<>";
64#if !defined(VINLINE_VATOM)
66VPUBLIC double Valist_getCenterX(Valist *thee) {
69 Vnm_print(2, "Valist_getCenterX: Found null pointer when getting the center of X coordinate!\n");
72 return thee->center[0];
76VPUBLIC double Valist_getCenterY(Valist *thee) {
79 Vnm_print(2, "Valist_getCenterY: Found null pointer when getting the center of Y coordinate!\n");
82 return thee->center[1];
85VPUBLIC double Valist_getCenterZ(Valist *thee) {
88 Vnm_print(2, "Valist_getCenterZ: Found null pointer when getting the center of Z coordinate!\n");
91 return thee->center[2];
95VPUBLIC Vatom* Valist_getAtomList(Valist *thee) {
98 Vnm_print(2, "Valist_getAtomList: Found null pointer when getting the atom list!\n");
105VPUBLIC int Valist_getNumberAtoms(Valist *thee) {
108 Vnm_print(2, "Valist_getNumberAtoms: Found null pointer when getting the number of atoms!\n");
115VPUBLIC Vatom* Valist_getAtom(Valist *thee, int i) {
118 Vnm_print(2, "Valist_getAtom: Found null pointer when getting atoms!\n");
121 if (i >= thee->number) {
122 Vnm_print(2, "Valist_getAtom: Requested atom number (%d) outside of atom list range (%d)!\n", i, thee->number);
125 return &(thee->atoms[i]);
129VPUBLIC unsigned long int Valist_memChk(Valist *thee) {
131 if (thee == NULL) return 0;
132 return Vmem_bytes(thee->vmem);
136#endif /* if !defined(VINLINE_VATOM) */
138VPUBLIC Valist* Valist_ctor() {
140 /* Set up the structure */
141 Valist *thee = VNULL;
142 thee = (Valist*)Vmem_malloc(VNULL, 1, sizeof(Valist));
143 if ( thee == VNULL) {
144 Vnm_print(2, "Valist_ctor: Got NULL pointer when constructing the atom list object!\n");
147 if ( Valist_ctor2(thee) != VRC_SUCCESS) {
148 Vnm_print(2, "Valist_ctor: Error in constructing the atom list object!\n");
155VPUBLIC Vrc_Codes Valist_ctor2(Valist *thee) {
160 /* Initialize the memory management object */
161 thee->vmem = Vmem_ctor("APBS:VALIST");
167VPUBLIC void Valist_dtor(Valist **thee)
169 if ((*thee) != VNULL) {
171 Vmem_free(VNULL, 1, sizeof(Valist), (void **)thee);
176VPUBLIC void Valist_dtor2(Valist *thee) {
178 Vmem_free(thee->vmem, thee->number, sizeof(Vatom), (void **)&(thee->atoms));
182 Vmem_dtor(&(thee->vmem));
185/* Read serial number from PDB ATOM/HETATM field */
186VPRIVATE Vrc_Codes Valist_readPDBSerial(Valist *thee, Vio *sock, int *serial) {
188 char tok[VMAX_BUFSIZE];
191 if (Vio_scanf(sock, "%s", tok) != 1) {
192 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing serial!\n");
195 if (sscanf(tok, "%d", &ti) != 1) {
196 Vnm_print(2, "Valist_readPDB: Unable to parse serial token (%s) as int!\n",
205/* Read atom name from PDB ATOM/HETATM field */
206VPRIVATE Vrc_Codes Valist_readPDBAtomName(Valist *thee, Vio *sock,
207 char atomName[VMAX_ARGLEN]) {
209 char tok[VMAX_BUFSIZE];
211 if (Vio_scanf(sock, "%s", tok) != 1) {
212 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing atom name!\n");
215 if (strlen(tok) < VMAX_ARGLEN) strcpy(atomName, tok);
217 Vnm_print(2, "Valist_readPDB: Atom name (%s) too long!\n", tok);
223/* Read residue name from PDB ATOM/HETATM field */
224VPRIVATE Vrc_Codes Valist_readPDBResidueName(Valist *thee, Vio *sock,
225 char resName[VMAX_ARGLEN]) {
227 char tok[VMAX_BUFSIZE];
229 if (Vio_scanf(sock, "%s", tok) != 1) {
230 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing residue name!\n");
233 if (strlen(tok) < VMAX_ARGLEN) strcpy(resName, tok);
235 Vnm_print(2, "Valist_readPDB: Residue name (%s) too long!\n", tok);
241/* Read residue number from PDB ATOM/HETATM field */
242VPRIVATE Vrc_Codes Valist_readPDBResidueNumber(
243 Valist *thee, Vio *sock, int *resSeq) {
245 char tok[VMAX_BUFSIZE];
249 if (Vio_scanf(sock, "%s", tok) != 1) {
250 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing resSeq!\n");
253 if (sscanf(tok, "%d", &ti) != 1) {
255 /* One of three things can happen here:
256 1) There is a chainID in the line: THR A 1
257 2) The chainID is merged with resSeq: THR A1001
258 3) An actual error: THR foo
262 if (strlen(tok) == 1) {
263 /* Case 1: Chain ID Present
264 Read the next field and hope its a float */
266 if (Vio_scanf(sock, "%s", tok) != 1) {
267 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing resSeq!\n");
270 if (sscanf(tok, "%d", &ti) != 1) {
271 Vnm_print(2, "Valist_readPDB: Unable to parse resSeq token (%s) as int!\n",
277 /* Case 2: Chain ID, merged string.
278 Move pointer forward past the chainID and check
280 //strcpy(resstring, tok);
284 if (sscanf(resstring, "%d", &ti) != 1) {
285 /* Case 3: More than one non-numeral char is present. Error.*/
286 Vnm_print(2, "Valist_readPDB: Unable to parse resSeq token (%s) as int!\n",
297/* Read atom coordinate from PDB ATOM/HETATM field */
298VPRIVATE Vrc_Codes Valist_readPDBAtomCoord(Valist *thee, Vio *sock, double *coord) {
300 char tok[VMAX_BUFSIZE];
303 if (Vio_scanf(sock, "%s", tok) != 1) {
304 Vnm_print(2, "Valist_readPDB: Ran out of tokens while parsing atom coordinate!\n");
307 if (sscanf(tok, "%lf", &tf) != 1) {
315/* Read charge and radius from PQR ATOM/HETATM field */
316VPRIVATE Vrc_Codes Valist_readPDBChargeRadius(Valist *thee, Vio *sock,
317 double *charge, double *radius) {
319 char tok[VMAX_BUFSIZE];
322 if (Vio_scanf(sock, "%s", tok) != 1) {
323 Vnm_print(2, "Valist_readPQR: Ran out of tokens while parsing charge!\n");
326 if (sscanf(tok, "%lf", &tf) != 1) {
331 if (Vio_scanf(sock, "%s", tok) != 1) {
332 Vnm_print(2, "Valist_readPQR: Ran out of tokens while parsing radius!\n");
335 if (sscanf(tok, "%lf", &tf) != 1) {
343/* Read ATOM/HETATM field of PDB through the X/Y/Z fields */
344VPRIVATE Vrc_Codes Valist_readPDB_throughXYZ(
346 Vio *sock, /* Socket ready for reading */
347 int *serial, /* Set to atom number */
348 char atomName[VMAX_ARGLEN], /* Set to atom name */
349 char resName[VMAX_ARGLEN], /* Set to residue name */
350 int *resSeq, /* Set to residue number */
351 double *x, /* Set to x-coordinate */
352 double *y, /* Set to y-coordinate */
353 double *z /* Set to z-coordinate */
360 if (Valist_readPDBSerial(thee, sock, serial) == VRC_FAILURE) {
361 Vnm_print(2, "Valist_readPDB: Error while parsing serial!\n");
365 if (Valist_readPDBAtomName(thee, sock, atomName) == VRC_FAILURE) {
366 Vnm_print(2, "Valist_readPDB: Error while parsing atom name!\n");
370 /* Grab residue name */
371 if (Valist_readPDBResidueName(thee, sock, resName) == VRC_FAILURE) {
372 Vnm_print(2, "Valist_readPDB: Error while parsing residue name!\n");
377 /* Grab residue number */
378 if (Valist_readPDBResidueNumber(thee, sock, resSeq) == VRC_FAILURE) {
379 Vnm_print(2, "Valist_readPDB: Error while parsing residue number!\n");
384 /* Read tokens until we find one that can be parsed as an atom
385 * x-coordinate. We will allow njunk=1 intervening field that
386 * cannot be parsed as a coordinate */
389 for (i=0; i<(njunk+1); i++) {
390 if (Valist_readPDBAtomCoord(thee, sock, x) == VRC_SUCCESS) {
396 Vnm_print(2, "Valist_readPDB: Can't find x!\n");
399 /* Read y-coordinate */
400 if (Valist_readPDBAtomCoord(thee, sock, y) == VRC_FAILURE) {
401 Vnm_print(2, "Valist_readPDB: Can't find y!\n");
404 /* Read z-coordinate */
405 if (Valist_readPDBAtomCoord(thee, sock, z) == VRC_FAILURE) {
406 Vnm_print(2, "Valist_readPDB: Can't find z!\n");
410#if 0 /* Set to 1 if you want to debug */
411 Vnm_print(1, "Valist_readPDB: serial = %d\n", *serial);
412 Vnm_print(1, "Valist_readPDB: atomName = %s\n", atomName);
413 Vnm_print(1, "Valist_readPDB: resName = %s\n", resName);
414 Vnm_print(1, "Valist_readPDB: resSeq = %d\n", *resSeq);
415 Vnm_print(1, "Valist_readPDB: pos = (%g, %g, %g)\n",
422/* Get a the next available atom storage location, increasing the storage
423 * space if necessary. Return VNULL if something goes wrong. */
424VPRIVATE Vatom* Valist_getAtomStorage(
426 Vatom **plist, /* Pointer to existing list of atoms */
427 int *pnlist, /* Size of existing list, may be changed */
428 int *pnatoms /* Existing number of atoms in list; incremented
432 Vatom *oldList, *newList, *theList;
433 Vatom *oldAtom, *newAtom;
434 int iatom, inext, oldLength, newLength, natoms;
438 /* See if we need more space */
439 if (*pnatoms >= *pnlist) {
441 /* Double the storage space */
443 newLength = 2*oldLength;
444 newList = (Vatom*)Vmem_malloc(thee->vmem, newLength, sizeof(Vatom));
447 /* Check the allocation */
448 if (newList == VNULL) {
449 Vnm_print(2, "Valist_readPDB: failed to allocate space for %d (Vatom)s!\n", newLength);
453 /* Copy the atoms over */
455 for (iatom=0; iatom<natoms; iatom++) {
456 oldAtom = &(oldList[iatom]);
457 newAtom = &(newList[iatom]);
458 Vatom_copyTo(oldAtom, newAtom);
459 Vatom_dtor2(oldAtom);
462 /* Free the old list */
463 Vmem_free(thee->vmem, oldLength, sizeof(Vatom), (void **)plist);
465 /* Copy new list to plist */
473 /* Get the next available spot and increment counters */
474 newAtom = &(theList[inext]);
475 *pnatoms = inext + 1;
480VPRIVATE Vrc_Codes Valist_setAtomArray(Valist *thee,
481 Vatom **plist, /* Pointer to list of atoms to store */
482 int nlist, /* Length of list */
483 int natoms /* Number of real atom entries in list */
486 Vatom *list, *newAtom, *oldAtom;
491 /* Allocate necessary space */
493 thee->atoms = (Vatom*)Vmem_malloc(thee->vmem, natoms, sizeof(Vatom));
494 if (thee->atoms == VNULL) {
495 Vnm_print(2, "Valist_readPDB: Unable to allocate space for %d (Vatom)s!\n",
499 thee->number = natoms;
502 for (i=0; i<thee->number; i++) {
503 newAtom = &(thee->atoms[i]);
504 oldAtom = &(list[i]);
505 Vatom_copyTo(oldAtom, newAtom);
506 Vatom_dtor2(oldAtom);
510 Vmem_free(thee->vmem, nlist, sizeof(Vatom), (void **)plist);
515VPUBLIC Vrc_Codes Valist_readPDB(Valist *thee, Vparam *param, Vio *sock) {
517 /* WE DO NOT DIRECTLY CONFORM TO PDB STANDARDS -- TO ALLOW LARGER FILES, WE
518 * REQUIRE ALL FIELDS TO BE WHITESPACE DELIMITED */
520 Vatom *atoms = VNULL;
521 Vatom *nextAtom = VNULL;
522 Vparam_AtomData *atomData = VNULL;
524 char tok[VMAX_BUFSIZE];
525 char atomName[VMAX_ARGLEN], resName[VMAX_ARGLEN];
527 int nlist, natoms, serial, resSeq;
529 double x, y, z, charge, radius, epsilon;
533 Vnm_print(2, "Valist_readPDB: Got NULL pointer when reading PDB file!\n");
538 Vio_setWhiteChars(sock, Valist_whiteChars);
539 Vio_setCommChars(sock, Valist_commChars);
541 /* Allocate some initial space for the atoms */
543 atoms = (Vatom*)Vmem_malloc(thee->vmem, nlist, sizeof(Vatom));
546 /* Read until we run out of lines */
547 while (Vio_scanf(sock, "%s", tok) == 1) {
549 /* Parse only ATOM/HETATOM fields */
550 if ((Vstring_strcasecmp(tok, "ATOM") == 0) ||
551 (Vstring_strcasecmp(tok, "HETATM") == 0)) {
553 /* Read ATOM/HETATM field of PDB through the X/Y/Z fields */
554 if (Valist_readPDB_throughXYZ(thee, sock, &serial, atomName,
555 resName, &resSeq, &x, &y, &z) == VRC_FAILURE) {
556 Vnm_print(2, "Valist_readPDB: Error parsing atom %d!\n",
561 /* Try to find the parameters. */
562 atomData = Vparam_getAtomData(param, resName, atomName);
563 if (atomData == VNULL) {
564 Vnm_print(2, "Valist_readPDB: Couldn't find parameters for \
565atom = %s, residue = %s\n", atomName, resName);
568 charge = atomData->charge;
569 radius = atomData->radius;
570 epsilon = atomData->epsilon;
572 /* Get pointer to next available atom position */
573 nextAtom = Valist_getAtomStorage(thee, &atoms, &nlist, &natoms);
574 if (nextAtom == VNULL) {
575 Vnm_print(2, "Valist_readPDB: Error in allocating spacing for atoms!\n");
579 /* Store the information */
580 pos[0] = x; pos[1] = y; pos[2] = z;
581 Vatom_setPosition(nextAtom, pos);
582 Vatom_setCharge(nextAtom, charge);
583 Vatom_setRadius(nextAtom, radius);
584 Vatom_setEpsilon(nextAtom, epsilon);
585 Vatom_setAtomID(nextAtom, natoms-1);
586 Vatom_setResName(nextAtom, resName);
587 Vatom_setAtomName(nextAtom, atomName);
589 } /* if ATOM or HETATM */
590 } /* while we haven't run out of tokens */
592 Vnm_print(0, "Valist_readPDB: Counted %d atoms\n", natoms);
595 /* Store atoms internally */
596 if (Valist_setAtomArray(thee, &atoms, nlist, natoms) == VRC_FAILURE) {
597 Vnm_print(2, "Valist_readPDB: unable to store atoms!\n");
601 return Valist_getStatistics(thee);
606VPUBLIC Vrc_Codes Valist_readPQR(Valist *thee, Vparam *params, Vio *sock) {
608 /* WE DO NOT DIRECTLY CONFORM TO PDB STANDARDS -- TO ALLOW LARGER FILES, WE
609 * REQUIRE ALL FIELDS TO BE WHITESPACE DELIMITED */
612 Vatom *atoms = VNULL;
613 Vatom *nextAtom = VNULL;
614 Vparam_AtomData *atomData = VNULL;
616 char tok[VMAX_BUFSIZE];
617 char atomName[VMAX_ARGLEN], resName[VMAX_ARGLEN];
618 char chs[VMAX_BUFSIZE];
621 int nlist, natoms, serial, resSeq;
623 double x, y, z, charge, radius, epsilon;
629 Vnm_print(2, "Valist_readPQR: Got NULL pointer when reading PQR file!\n");
634 Vio_setWhiteChars(sock, Valist_whiteChars);
635 Vio_setCommChars(sock, Valist_commChars);
637 /* Allocate some initial space for the atoms */
639 atoms = (Vatom*)Vmem_malloc(thee->vmem, nlist, sizeof(Vatom));
641 /* Check if we are using a parameter file or not */
642 if(params != VNULL) use_params = 1;
645 /* Read until we run out of lines */
646 while (Vio_scanf(sock, "%s", tok) == 1) {
648 /* Parse only ATOM/HETATOM fields */
649 if ((Vstring_strcasecmp(tok, "ATOM") == 0) ||
650 (Vstring_strcasecmp(tok, "HETATM") == 0)) {
652 /* Read ATOM/HETATM field of PDB through the X/Y/Z fields */
653 if (Valist_readPDB_throughXYZ(thee, sock, &serial, atomName,
654 resName, &resSeq, &x, &y, &z) == VRC_FAILURE) {
655 Vnm_print(2, "Valist_readPQR: Error parsing atom %d!\n",serial);
656 Vnm_print(2, "Please double check this atom in the pqr file, e.g., make sure there are no concatenated fields.\n");
660 /* Read Q/R fields */
661 if (Valist_readPDBChargeRadius(thee, sock, &charge, &radius) == VRC_FAILURE) {
662 Vnm_print(2, "Valist_readPQR: Error parsing atom %d!\n",
664 Vnm_print(2, "Please double check this atom in the pqr file, e.g., make sure there are no concatenated fields.\n");
669 /* Try to find the parameters. */
670 atomData = Vparam_getAtomData(params, resName, atomName);
671 if (atomData == VNULL) {
672 Vnm_print(2, "Valist_readPDB: Couldn't find parameters for \
673atom = %s, residue = %s\n", atomName, resName);
676 charge = atomData->charge;
677 radius = atomData->radius;
678 epsilon = atomData->epsilon;
681 /* Get pointer to next available atom position */
682 nextAtom = Valist_getAtomStorage(thee, &atoms, &nlist, &natoms);
683 if (nextAtom == VNULL) {
684 Vnm_print(2, "Valist_readPQR: Error in allocating spacing for atoms!\n");
688 /* Store the information */
689 pos[0] = x; pos[1] = y; pos[2] = z;
690 Vatom_setPosition(nextAtom, pos);
691 Vatom_setCharge(nextAtom, charge);
692 Vatom_setRadius(nextAtom, radius);
693 Vatom_setEpsilon(nextAtom, epsilon);
694 Vatom_setAtomID(nextAtom, natoms-1);
695 Vatom_setResName(nextAtom, resName);
696 Vatom_setAtomName(nextAtom, atomName);
698 } /* if ATOM or HETATM */
702 * Note that if we find a line that starts with something that's not
703 * ATOM or HETATM we'll just keep parsing strings until we find one
704 * of the acceptable keywords.
705 * Extraordinary measures are not necessary, and only add to the
709 } /* while we haven't run out of tokens */
711 Vnm_print(0, "Valist_readPQR: Counted %d atoms\n", natoms);
714 /* Store atoms internally */
715 if (Valist_setAtomArray(thee, &atoms, nlist, natoms) == VRC_FAILURE) {
716 Vnm_print(2, "Valist_readPDB: unable to store atoms!\n");
720 return Valist_getStatistics(thee);
725VPUBLIC Vrc_Codes Valist_readXML(Valist *thee, Vparam *params, Vio *sock) {
727 Vatom *atoms = VNULL;
728 Vatom *nextAtom = VNULL;
730 char tok[VMAX_BUFSIZE];
731 char endtag[VMAX_BUFSIZE];
734 int xset, yset, zset, chgset, radset;
736 double x, y, z, charge, radius, dtmp;
740 Vnm_print(2, "Valist_readXML: Got NULL pointer when reading XML file!\n");
745 Vio_setWhiteChars(sock, Valist_xmlwhiteChars);
746 Vio_setCommChars(sock, Valist_commChars);
748 /* Allocate some initial space for the atoms */
750 atoms = (Vatom*)Vmem_malloc(thee->vmem, nlist, sizeof(Vatom));
752 /* Initialize some variables */
762 Vnm_print(1,"\nValist_readXML: Warning Warning Warning Warning Warning\n");
763 Vnm_print(1,"Valist_readXML: The use of XML input files with parameter\n");
764 Vnm_print(1,"Valist_readXML: files is currently not supported.\n");
765 Vnm_print(1,"Valist_readXML: Warning Warning Warning Warning Warning\n\n");
768 /* Read until we run out of lines */
769 while (Vio_scanf(sock, "%s", tok) == 1) {
771 /* The first tag taken is the start tag - save it to detect end */
772 if (Vstring_strcasecmp(endtag, "/") == 0) strcat(endtag, tok);
774 if (Vstring_strcasecmp(tok, "x") == 0) {
775 Vio_scanf(sock, "%s", tok);
776 if (sscanf(tok, "%lf", &dtmp) != 1) {
777 Vnm_print(2, "Valist_readXML: Unexpected token (%s) while \
783 } else if (Vstring_strcasecmp(tok, "y") == 0) {
784 Vio_scanf(sock, "%s", tok);
785 if (sscanf(tok, "%lf", &dtmp) != 1) {
786 Vnm_print(2, "Valist_readXML: Unexpected token (%s) while \
792 } else if (Vstring_strcasecmp(tok, "z") == 0) {
793 Vio_scanf(sock, "%s", tok);
794 if (sscanf(tok, "%lf", &dtmp) != 1) {
795 Vnm_print(2, "Valist_readXML: Unexpected token (%s) while \
801 } else if (Vstring_strcasecmp(tok, "charge") == 0) {
802 Vio_scanf(sock, "%s", tok);
803 if (sscanf(tok, "%lf", &dtmp) != 1) {
804 Vnm_print(2, "Valist_readXML: Unexpected token (%s) while \
805reading charge!\n", tok);
810 } else if (Vstring_strcasecmp(tok, "radius") == 0) {
811 Vio_scanf(sock, "%s", tok);
812 if (sscanf(tok, "%lf", &dtmp) != 1) {
813 Vnm_print(2, "Valist_readXML: Unexpected token (%s) while \
814reading radius!\n", tok);
819 } else if (Vstring_strcasecmp(tok, "/atom") == 0) {
821 /* Get pointer to next available atom position */
822 nextAtom = Valist_getAtomStorage(thee, &atoms, &nlist, &natoms);
823 if (nextAtom == VNULL) {
824 Vnm_print(2, "Valist_readXML: Error in allocating spacing for atoms!\n");
828 if (xset && yset && zset && chgset && radset){
830 /* Store the information */
831 pos[0] = x; pos[1] = y; pos[2] = z;
832 Vatom_setPosition(nextAtom, pos);
833 Vatom_setCharge(nextAtom, charge);
834 Vatom_setRadius(nextAtom, radius);
835 Vatom_setAtomID(nextAtom, natoms-1);
837 /* Reset the necessary flags */
844 Vnm_print(2, "Valist_readXML: Missing field(s) in atom tag:\n");
845 if (!xset) Vnm_print(2,"\tx value not set!\n");
846 if (!yset) Vnm_print(2,"\ty value not set!\n");
847 if (!zset) Vnm_print(2,"\tz value not set!\n");
848 if (!chgset) Vnm_print(2,"\tcharge value not set!\n");
849 if (!radset) Vnm_print(2,"\tradius value not set!\n");
852 } else if (Vstring_strcasecmp(tok, endtag) == 0) break;
855 Vnm_print(0, "Valist_readXML: Counted %d atoms\n", natoms);
858 /* Store atoms internally */
859 if (Valist_setAtomArray(thee, &atoms, nlist, natoms) == VRC_FAILURE) {
860 Vnm_print(2, "Valist_readXML: unable to store atoms!\n");
864 return Valist_getStatistics(thee);
868/* Load up Valist with various statistics */
869VPUBLIC Vrc_Codes Valist_getStatistics(Valist *thee) {
875 Vnm_print(2, "Valist_getStatistics: Got NULL pointer when loading up Valist with various statistics!\n");
879 thee->center[0] = 0.;
880 thee->center[1] = 0.;
881 thee->center[2] = 0.;
885 if (thee->number == 0) return VRC_FAILURE;
887 /* Reset stat variables */
888 atom = &(thee->atoms[0]);
889 for (i=0; i<3; i++) {
890 thee->maxcrd[i] = thee->mincrd[i] = atom->position[i];
892 thee->maxrad = atom->radius;
895 for (i=0; i<thee->number; i++) {
897 atom = &(thee->atoms[i]);
898 for (j=0; j<3; j++) {
899 if (atom->position[j] < thee->mincrd[j])
900 thee->mincrd[j] = atom->position[j];
901 if (atom->position[j] > thee->maxcrd[j])
902 thee->maxcrd[j] = atom->position[j];
904 if (atom->radius > thee->maxrad) thee->maxrad = atom->radius;
905 thee->charge = thee->charge + atom->charge;
908 thee->center[0] = 0.5*(thee->maxcrd[0] + thee->mincrd[0]);
909 thee->center[1] = 0.5*(thee->maxcrd[1] + thee->mincrd[1]);
910 thee->center[2] = 0.5*(thee->maxcrd[2] + thee->mincrd[2]);
912 Vnm_print(0, "Valist_getStatistics: Max atom coordinate: (%g, %g, %g)\n",
913 thee->maxcrd[0], thee->maxcrd[1], thee->maxcrd[2]);
914 Vnm_print(0, "Valist_getStatistics: Min atom coordinate: (%g, %g, %g)\n",
915 thee->mincrd[0], thee->mincrd[1], thee->mincrd[2]);
916 Vnm_print(0, "Valist_getStatistics: Molecule center: (%g, %g, %g)\n",
917 thee->center[0], thee->center[1], thee->center[2]);
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
Contains declarations for class Valist.