100 #if !defined(VINLINE_VPARAM) 103 if (thee == VNULL)
return 0;
104 return Vmem_bytes(thee->
vmem);
115 VASSERT(thee != VNULL);
125 if ((*thee) != VNULL) {
141 VASSERT(thee != VNULL);
150 Vnm_print(2,
"Vparam_ResData_ctor2: Got VNULL thee!\n");
162 if ((*thee) != VNULL) {
164 Vmem_free((*thee)->vmem, 1,
sizeof(
Vparam_ResData), (
void **)thee);
172 if (thee == VNULL)
return;
187 VASSERT(thee != VNULL);
196 Vnm_print(2,
"Vparam_ctor2: got VNULL thee!\n");
201 thee->
vmem = Vmem_ctor(
"APBS:VPARAM");
202 if (thee->
vmem == VNULL) {
203 Vnm_print(2,
"Vparam_ctor2: failed to init Vmem!\n");
215 if ((*thee) != VNULL) {
217 Vmem_free(VNULL, 1,
sizeof(
Vparam), (
void **)thee);
227 if (thee == VNULL)
return;
236 if (thee->
vmem != VNULL) Vmem_dtor(&(thee->
vmem));
242 char resName[VMAX_ARGLEN]) {
247 VASSERT(thee != VNULL);
263 Vnm_print(2,
"Vparam_getResData: unable to find res=%s\n", resName);
268 char resName[VMAX_ARGLEN],
char atomName[VMAX_ARGLEN]) {
274 VASSERT(thee != VNULL);
285 Vnm_print(2,
"Vparam_getAtomData: Unable to find residue %s!\n", resName);
291 Vnm_print(2,
"Vparam_getAtomData: got NULL atom!\n");
301 Vnm_print(2,
"Vparam_getAtomData: unable to find atom '%s', res '%s'\n",
307 const char *iofmt,
const char *thost,
const char *fname) {
309 int i, ires, natoms, nalloc, ralloc;
317 char currResName[VMAX_ARGLEN];
318 char tok[VMAX_ARGLEN];
319 char endtag[VMAX_ARGLEN];
321 VASSERT(thee != VNULL);
324 sock = Vio_ctor(iodev,iofmt,thost,fname,
"r");
326 Vnm_print(2,
"Vparam_readXMLFile: Problem opening virtual socket %s\n",
330 if (Vio_accept(sock, 0) < 0) {
331 Vnm_print(2,
"Vparam_readXMLFile: Problem accepting virtual socket %s\n",
340 Vnm_print(2,
"WARNING -- CLEARING PARAMETER DATABASE!\n");
358 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
367 VASSERT(tresidues != VNULL);
372 (
void **)&(residues));
373 residues = tresidues;
384 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
385 strcpy(currResName, tok);
386 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
388 if (natoms >= nalloc) {
390 VASSERT(tatoms != VNULL);
391 for (i=0; i<natoms; i++) {
400 atom = &(atoms[natoms]);
411 strcpy(res->
name, currResName);
412 for (i=0; i<natoms; i++) {
413 strcpy(atoms[i].resName, currResName);
426 for (ires=0; ires<thee->
nResData; ires++) {
434 Vio_acceptFree(sock);
440 Vnm_print(2,
"Vparam_readXMLFile: Got unexpected EOF reading parameter file!\n");
446 const char *iofmt,
const char *thost,
const char *fname) {
448 int i, iatom, jatom, ires, natoms, nalloc;
454 char currResName[VMAX_ARGLEN];
456 VASSERT(thee != VNULL);
459 sock = Vio_ctor(iodev,iofmt,thost,fname,
"r");
461 Vnm_print(2,
"Vparam_readFlatFile: Problem opening virtual socket %s\n",
465 if (Vio_accept(sock, 0) < 0) {
466 Vnm_print(2,
"Vparam_readFlatFile: Problem accepting virtual socket %s\n",
475 Vnm_print(2,
"WARNING -- CLEARING PARAMETER DATABASE!\n");
490 if (natoms >= nalloc) {
492 VASSERT(tatoms != VNULL);
493 for (i=0; i<natoms; i++) {
502 atom = &(atoms[natoms]);
506 if (natoms == 0)
return 0;
510 strcpy(currResName, atoms[0].resName);
511 for (i=1; i<natoms; i++) {
513 strcpy(currResName, atoms[i].resName);
521 VASSERT(thee->
resData != VNULL);
522 for (i=0; i<(thee->
nResData); i++) {
532 for (i=1; i<natoms; i++) {
542 for (ires=0; ires<thee->
nResData; ires++) {
551 for (ires=0; ires<thee->
nResData; ires++) {
553 for (jatom=0; jatom<res->
nAtomData; jatom++) {
561 Vio_acceptFree(sock);
574 VASSERT(thee != VNULL);
575 VASSERT(dest != VNULL);
590 VASSERT(thee != VNULL);
591 VASSERT(dest != VNULL);
613 char tok[VMAX_BUFSIZE];
614 int chgflag, radflag, nameflag;
616 VASSERT(atom != VNULL);
618 if (Vio_scanf(sock,
"%s", tok) != 1)
return 0;
627 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
628 if (strlen(tok) > VMAX_ARGLEN) {
629 Vnm_print(2,
"Vparam_readXMLFileAtom: string (%s) too long \ 630 (%d)!\n", tok, strlen(tok));
636 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
637 if (sscanf(tok,
"%lf", &dtmp) != 1) {
638 Vnm_print(2,
"Vparam_readXMLFileAtom: Unexpected token (%s) while \ 639 parsing charge!\n", tok);
645 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
646 if (sscanf(tok,
"%lf", &dtmp) != 1) {
647 Vnm_print(2,
"Vparam_readXMLFileAtom: Unexpected token (%s) while \ 648 parsing radius!\n", tok);
654 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
655 if (sscanf(tok,
"%lf", &dtmp) != 1) {
656 Vnm_print(2,
"Vparam_readXMLFileAtom: Unexpected token (%s) while \ 657 parsing epsilon!\n", tok);
663 if (chgflag && radflag && nameflag)
return 1;
665 Vnm_print(2,
"Vparam_readXMLFileAtom: Reached end of atom without \ 666 setting the charge!\n");
668 }
else if (!radflag) {
669 Vnm_print(2,
"Vparam_readXMLFileAtom: Reached end of atom without \ 670 setting the radius!\n");
672 }
else if (!nameflag) {
673 Vnm_print(2,
"Vparam_readXMLFileAtom: Reached end of atom without \ 674 setting the name!\n");
678 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
686 Vnm_print(2,
"Vparam_readXMLFileAtom: Got unexpected EOF reading parameter file!\n");
694 char tok[VMAX_BUFSIZE];
696 VASSERT(atom != VNULL);
698 if (Vio_scanf(sock,
"%s", tok) != 1)
return 0;
699 if (strlen(tok) > VMAX_ARGLEN) {
700 Vnm_print(2,
"Vparam_readFlatFile: string (%s) too long (%d)!\n",
705 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
706 if (strlen(tok) > VMAX_ARGLEN) {
707 Vnm_print(2,
"Vparam_readFlatFile: string (%s) too long (%d)!\n",
712 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
713 if (sscanf(tok,
"%lf", &dtmp) != 1) {
714 Vnm_print(2,
"Vparam_readFlatFile: Unexpected token (%s) while \ 715 parsing charge!\n", tok);
719 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
720 if (sscanf(tok,
"%lf", &dtmp) != 1) {
721 Vnm_print(2,
"Vparam_readFlatFile: Unexpected token (%s) while \ 722 parsing radius!\n", tok);
726 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
727 if (sscanf(tok,
"%lf", &dtmp) != 1) {
728 Vnm_print(2,
"Vparam_readFlatFile: Unexpected token (%s) while \ 729 parsing radius!\n", tok);
737 Vnm_print(2,
"Vparam_readFlatFile: Got unexpected EOF reading parameter file!\n");
VPUBLIC unsigned long int Vparam_memChk(Vparam *thee)
Get number of bytes in this object and its members.
VPUBLIC Vparam * Vparam_ctor()
Construct the object.
VPUBLIC int Vparam_ctor2(Vparam *thee)
FORTRAN stub to construct the object.
VPUBLIC int Vparam_AtomData_ctor2(Vparam_AtomData *thee)
FORTRAN stub to construct the object.
VPRIVATE int readFlatFileLine(Vio *sock, Vparam_AtomData *atom)
Read a single line of the flat file database.
VPRIVATE char * MCcommChars
Comment characters for socket reads.
VPUBLIC Vparam_ResData * Vparam_ResData_ctor(Vmem *mem)
Construct the object.
VPRIVATE int readXMLFileAtom(Vio *sock, Vparam_AtomData *atom)
Read atom information from an XML file.
VPUBLIC int Vparam_ResData_ctor2(Vparam_ResData *thee, Vmem *mem)
FORTRAN stub to construct the object.
ResData sub-class; stores residue data.
AtomData sub-class; stores atom data.
Contains declarations for class Vparam.
char resName[VMAX_ARGLEN]
VPUBLIC void Vparam_ResData_dtor(Vparam_ResData **thee)
Destroy object.
Vparam_AtomData * atomData
VPUBLIC void Vparam_AtomData_dtor(Vparam_AtomData **thee)
Destroy object.
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
VPUBLIC void Vparam_dtor(Vparam **thee)
Destroy object.
VPUBLIC int Vparam_readFlatFile(Vparam *thee, const char *iodev, const char *iofmt, const char *thost, const char *fname)
Read a flat-file format parameter database.
VPUBLIC int Vstring_strcasecmp(const char *s1, const char *s2)
Case-insensitive string comparison (BSD standard)
char atomName[VMAX_ARGLEN]
VPUBLIC Vparam_AtomData * Vparam_getAtomData(Vparam *thee, char resName[VMAX_ARGLEN], char atomName[VMAX_ARGLEN])
Get atom data.
Reads and assigns charge/radii parameters.
VPRIVATE char * MCxmlwhiteChars
Whitespace characters for XML socket reads.
VPUBLIC void Vparam_AtomData_dtor2(Vparam_AtomData *thee)
FORTRAN stub to destroy object.
VPUBLIC Vparam_AtomData * Vparam_AtomData_ctor()
Construct the object.
VPUBLIC void Vparam_dtor2(Vparam *thee)
FORTRAN stub to destroy object.
VEXTERNC void Vparam_ResData_copyTo(Vparam_ResData *thee, Vparam_ResData *dest)
Copy current residue object to destination.
VEXTERNC void Vparam_AtomData_copyTo(Vparam_AtomData *thee, Vparam_AtomData *dest)
Copy current atom object to destination.
VPUBLIC int Vparam_readXMLFile(Vparam *thee, const char *iodev, const char *iofmt, const char *thost, const char *fname)
Read an XML format parameter database.
VEXTERNC void Vparam_AtomData_copyFrom(Vparam_AtomData *thee, Vparam_AtomData *src)
Copy current atom object from another.
VPUBLIC Vparam_ResData * Vparam_getResData(Vparam *thee, char resName[VMAX_ARGLEN])
Get residue data.
VPRIVATE char * MCwhiteChars
Whitespace characters for socket reads.
VPUBLIC void Vparam_ResData_dtor2(Vparam_ResData *thee)
FORTRAN stub to destroy object.