APBS  1.4.1
vparam.c
Go to the documentation of this file.
1 
57 #include "vparam.h"
58 
59 VEMBED(rcsid="$Id$")
60 
61 
65 VPRIVATE char *MCwhiteChars = " =,;\t\n\r";
66 
71 VPRIVATE char *MCcommChars = "#%";
72 
77 VPRIVATE char *MCxmlwhiteChars = " =,;\t\n\r<>";
78 
87 VPRIVATE int readFlatFileLine(Vio *sock, Vparam_AtomData *atom);
88 
97 VPRIVATE int readXMLFileAtom(Vio *sock, Vparam_AtomData *atom);
98 
99 
100 #if !defined(VINLINE_VPARAM)
101 
102 VPUBLIC unsigned long int Vparam_memChk(Vparam *thee) {
103  if (thee == VNULL) return 0;
104  return Vmem_bytes(thee->vmem);
105 }
106 
107 #endif /* if !defined(VINLINE_VPARAM) */
108 
110 
111  Vparam_AtomData *thee = VNULL;
112 
113  /* Set up the structure */
114  thee = (Vparam_AtomData*)Vmem_malloc(VNULL, 1, sizeof(Vparam_AtomData) );
115  VASSERT(thee != VNULL);
116  VASSERT(Vparam_AtomData_ctor2(thee));
117 
118  return thee;
119 }
120 
121 VPUBLIC int Vparam_AtomData_ctor2(Vparam_AtomData *thee) { return 1; }
122 
123 VPUBLIC void Vparam_AtomData_dtor(Vparam_AtomData **thee) {
124 
125  if ((*thee) != VNULL) {
126  Vparam_AtomData_dtor2(*thee);
127  Vmem_free(VNULL, 1, sizeof(Vparam_AtomData), (void **)thee);
128  (*thee) = VNULL;
129  }
130 
131 }
132 
133 VPUBLIC void Vparam_AtomData_dtor2(Vparam_AtomData *thee) { ; }
134 
135 VPUBLIC Vparam_ResData* Vparam_ResData_ctor(Vmem *mem) {
136 
137  Vparam_ResData *thee = VNULL;
138 
139  /* Set up the structure */
140  thee = (Vparam_ResData*)Vmem_malloc(mem, 1, sizeof(Vparam_ResData) );
141  VASSERT(thee != VNULL);
142  VASSERT(Vparam_ResData_ctor2(thee, mem));
143 
144  return thee;
145 }
146 
147 VPUBLIC int Vparam_ResData_ctor2(Vparam_ResData *thee, Vmem *mem) {
148 
149  if (thee == VNULL) {
150  Vnm_print(2, "Vparam_ResData_ctor2: Got VNULL thee!\n");
151  return 0;
152  }
153  thee->vmem = mem;
154  thee->nAtomData = 0;
155  thee->atomData = VNULL;
156 
157  return 1;
158 }
159 
160 VPUBLIC void Vparam_ResData_dtor(Vparam_ResData **thee) {
161 
162  if ((*thee) != VNULL) {
163  Vparam_ResData_dtor2(*thee);
164  Vmem_free((*thee)->vmem, 1, sizeof(Vparam_ResData), (void **)thee);
165  (*thee) = VNULL;
166  }
167 
168 }
169 
171 
172  if (thee == VNULL) return;
173  if (thee->nAtomData > 0) {
174  Vmem_free(thee->vmem, thee->nAtomData, sizeof(Vparam_AtomData),
175  (void **)&(thee->atomData));
176  }
177  thee->nAtomData = 0;
178  thee->atomData = VNULL;
179 }
180 
181 VPUBLIC Vparam* Vparam_ctor() {
182 
183  Vparam *thee = VNULL;
184 
185  /* Set up the structure */
186  thee = (Vparam*)Vmem_malloc(VNULL, 1, sizeof(Vparam) );
187  VASSERT(thee != VNULL);
188  VASSERT(Vparam_ctor2(thee));
189 
190  return thee;
191 }
192 
193 VPUBLIC int Vparam_ctor2(Vparam *thee) {
194 
195  if (thee == VNULL) {
196  Vnm_print(2, "Vparam_ctor2: got VNULL thee!\n");
197  return 0;
198  }
199 
200  thee->vmem = VNULL;
201  thee->vmem = Vmem_ctor("APBS:VPARAM");
202  if (thee->vmem == VNULL) {
203  Vnm_print(2, "Vparam_ctor2: failed to init Vmem!\n");
204  return 0;
205  }
206 
207  thee->nResData = 0;
208  thee->resData = VNULL;
209 
210  return 1;
211 }
212 
213 VPUBLIC void Vparam_dtor(Vparam **thee) {
214 
215  if ((*thee) != VNULL) {
216  Vparam_dtor2(*thee);
217  Vmem_free(VNULL, 1, sizeof(Vparam), (void **)thee);
218  (*thee) = VNULL;
219  }
220 
221 }
222 
223 VPUBLIC void Vparam_dtor2(Vparam *thee) {
224 
225  int i;
226 
227  if (thee == VNULL) return;
228 
229  /* Destroy the residue data */
230  for (i=0; i<thee->nResData; i++) Vparam_ResData_dtor2(&(thee->resData[i]));
231  if (thee->nResData > 0) Vmem_free(thee->vmem, thee->nResData,
232  sizeof(Vparam_ResData), (void **)&(thee->resData));
233  thee->nResData = 0;
234  thee->resData = VNULL;
235 
236  if (thee->vmem != VNULL) Vmem_dtor(&(thee->vmem));
237  thee->vmem = VNULL;
238 
239 }
240 
242  char resName[VMAX_ARGLEN]) {
243 
244  int i;
245  Vparam_ResData *res = VNULL;
246 
247  VASSERT(thee != VNULL);
248 
249  if ((thee->nResData == 0) || (thee->resData == VNULL)) {
250  res = VNULL;
251  return res;
252  }
253 
254  /* Look for the matching residue */
255  for (i=0; i<thee->nResData; i++) {
256  res = &(thee->resData[i]);
257  if (Vstring_strcasecmp(resName, res->name) == 0) return res;
258 
259  }
260 
261  /* Didn't find a matching residue */
262  res = VNULL;
263  Vnm_print(2, "Vparam_getResData: unable to find res=%s\n", resName);
264  return res;
265 }
266 
268  char resName[VMAX_ARGLEN], char atomName[VMAX_ARGLEN]) {
269 
270  int i;
271  Vparam_ResData *res = VNULL;
272  Vparam_AtomData *atom = VNULL;
273 
274  VASSERT(thee != VNULL);
275 
276  if ((thee->nResData == 0) || (thee->resData == VNULL)) {
277  atom = VNULL;
278  return atom;
279  }
280 
281  /* Look for the matching residue */
282  res = Vparam_getResData(thee, resName);
283  if (res == VNULL) {
284  atom = VNULL;
285  Vnm_print(2, "Vparam_getAtomData: Unable to find residue %s!\n", resName);
286  return atom;
287  }
288  for (i=0; i<res->nAtomData; i++) {
289  atom = &(res->atomData[i]);
290  if (atom == VNULL) {
291  Vnm_print(2, "Vparam_getAtomData: got NULL atom!\n");
292  return VNULL;
293  }
294  if (Vstring_strcasecmp(atomName, atom->atomName) == 0) {
295  return atom;
296  }
297  }
298 
299  /* Didn't find a matching atom/residue */
300  atom = VNULL;
301  Vnm_print(2, "Vparam_getAtomData: unable to find atom '%s', res '%s'\n",
302  atomName, resName);
303  return atom;
304 }
305 
306 VPUBLIC int Vparam_readXMLFile(Vparam *thee, const char *iodev,
307  const char *iofmt, const char *thost, const char *fname) {
308 
309  int i, ires, natoms, nalloc, ralloc;
310  Vparam_AtomData *atoms = VNULL;
311  Vparam_AtomData *tatoms = VNULL;
312  Vparam_AtomData *atom = VNULL;
313  Vparam_ResData *res = VNULL;
314  Vparam_ResData *residues = VNULL;
315  Vparam_ResData *tresidues = VNULL;
316  Vio *sock = VNULL;
317  char currResName[VMAX_ARGLEN];
318  char tok[VMAX_ARGLEN];
319  char endtag[VMAX_ARGLEN];
320 
321  VASSERT(thee != VNULL);
322 
323  /* Setup communication */
324  sock = Vio_ctor(iodev,iofmt,thost,fname,"r");
325  if (sock == VNULL) {
326  Vnm_print(2, "Vparam_readXMLFile: Problem opening virtual socket %s\n",
327  fname);
328  return 0;
329  }
330  if (Vio_accept(sock, 0) < 0) {
331  Vnm_print(2, "Vparam_readXMLFile: Problem accepting virtual socket %s\n",
332  fname);
333  return 0;
334  }
335  Vio_setWhiteChars(sock, MCxmlwhiteChars);
336  Vio_setCommChars(sock, MCcommChars);
337 
338  /* Clear existing parameters */
339  if (thee->nResData > 0) {
340  Vnm_print(2, "WARNING -- CLEARING PARAMETER DATABASE!\n");
341  for (i=0; i<thee->nResData; i++) {
342  Vparam_ResData_dtor2(&(thee->resData[i]));
343  }
344  Vmem_free(thee->vmem, thee->nResData,
345  sizeof(Vparam_ResData), (void **)&(thee->resData));
346  }
347 
348  strcpy(endtag,"/");
349 
350  /* Set up temporary residue list */
351 
352  ralloc = 50;
353  residues = (Vparam_ResData*)Vmem_malloc(thee->vmem, ralloc, sizeof(Vparam_ResData));
354 
355  /* Read until we run out of entries, allocating space as needed */
356  while (1) {
357 
358  VJMPERR1(Vio_scanf(sock, "%s", tok) == 1);
359 
360  /* The first token should be the start tag */
361 
362  if (Vstring_strcasecmp(endtag, "/") == 0) strcat(endtag, tok);
363 
364  if (Vstring_strcasecmp(tok, "residue") == 0) {
365  if (thee->nResData >= ralloc) {
366  tresidues = (Vparam_ResData*)Vmem_malloc(thee->vmem, 2*ralloc, sizeof(Vparam_ResData));
367  VASSERT(tresidues != VNULL);
368  for (i=0; i<thee->nResData; i++) {
369  Vparam_ResData_copyTo(&(residues[i]), &(tresidues[i]));
370  }
371  Vmem_free(thee->vmem, ralloc, sizeof(Vparam_ResData),
372  (void **)&(residues));
373  residues = tresidues;
374  tresidues = VNULL;
375  ralloc = 2*ralloc;
376  }
377 
378  /* Initial space for this residue's atoms */
379  nalloc = 20;
380  natoms = 0;
381  atoms = (Vparam_AtomData*)Vmem_malloc(thee->vmem, nalloc, sizeof(Vparam_AtomData));
382 
383  } else if (Vstring_strcasecmp(tok, "name") == 0) {
384  VJMPERR1(Vio_scanf(sock, "%s", tok) == 1); /* value */
385  strcpy(currResName, tok);
386  VJMPERR1(Vio_scanf(sock, "%s", tok) == 1); /* </name> */
387  } else if (Vstring_strcasecmp(tok, "atom") == 0) {
388  if (natoms >= nalloc) {
389  tatoms = (Vparam_AtomData*)Vmem_malloc(thee->vmem, 2*nalloc, sizeof(Vparam_AtomData));
390  VASSERT(tatoms != VNULL);
391  for (i=0; i<natoms; i++) {
392  Vparam_AtomData_copyTo(&(atoms[i]), &(tatoms[i]));
393  }
394  Vmem_free(thee->vmem, nalloc, sizeof(Vparam_AtomData),
395  (void **)&(atoms));
396  atoms = tatoms;
397  tatoms = VNULL;
398  nalloc = 2*nalloc;
399  }
400  atom = &(atoms[natoms]);
401  if (!readXMLFileAtom(sock, atom)) break;
402  natoms++;
403 
404  } else if (Vstring_strcasecmp(tok, "/residue") == 0) {
405 
406  res = &(residues[thee->nResData]);
407  Vparam_ResData_ctor2(res, thee->vmem);
408  res->atomData = (Vparam_AtomData*)Vmem_malloc(thee->vmem, natoms,
409  sizeof(Vparam_AtomData));
410  res->nAtomData = natoms;
411  strcpy(res->name, currResName);
412  for (i=0; i<natoms; i++) {
413  strcpy(atoms[i].resName, currResName);
414  Vparam_AtomData_copyTo(&(atoms[i]), &(res->atomData[i]));
415  }
416  Vmem_free(thee->vmem, nalloc, sizeof(Vparam_AtomData), (void **)&(atoms));
417  (thee->nResData)++;
418 
419  } else if (Vstring_strcasecmp(tok, endtag) == 0) break;
420  }
421 
422  /* Initialize and copy the residues into the Vparam object */
423 
424  thee->resData = (Vparam_ResData*)Vmem_malloc(thee->vmem, thee->nResData,
425  sizeof(Vparam_ResData));
426  for (ires=0; ires<thee->nResData; ires++) {
427  Vparam_ResData_copyTo(&(residues[ires]), &(thee->resData[ires]));
428  }
429 
430  /* Destroy temporary atom space */
431  Vmem_free(thee->vmem, ralloc, sizeof(Vparam_ResData), (void **)&(residues));
432 
433  /* Shut down communication */
434  Vio_acceptFree(sock);
435  Vio_dtor(&sock);
436 
437  return 1;
438 
439 VERROR1:
440  Vnm_print(2, "Vparam_readXMLFile: Got unexpected EOF reading parameter file!\n");
441  return 0;
442 
443 }
444 
445 VPUBLIC int Vparam_readFlatFile(Vparam *thee, const char *iodev,
446  const char *iofmt, const char *thost, const char *fname) {
447 
448  int i, iatom, jatom, ires, natoms, nalloc;
449  Vparam_AtomData *atoms = VNULL;
450  Vparam_AtomData *tatoms = VNULL;
451  Vparam_AtomData *atom = VNULL;
452  Vparam_ResData *res = VNULL;
453  Vio *sock = VNULL;
454  char currResName[VMAX_ARGLEN];
455 
456  VASSERT(thee != VNULL);
457 
458  /* Setup communication */
459  sock = Vio_ctor(iodev,iofmt,thost,fname,"r");
460  if (sock == VNULL) {
461  Vnm_print(2, "Vparam_readFlatFile: Problem opening virtual socket %s\n",
462  fname);
463  return 0;
464  }
465  if (Vio_accept(sock, 0) < 0) {
466  Vnm_print(2, "Vparam_readFlatFile: Problem accepting virtual socket %s\n",
467  fname);
468  return 0;
469  }
470  Vio_setWhiteChars(sock, MCwhiteChars);
471  Vio_setCommChars(sock, MCcommChars);
472 
473  /* Clear existing parameters */
474  if (thee->nResData > 0) {
475  Vnm_print(2, "WARNING -- CLEARING PARAMETER DATABASE!\n");
476  for (i=0; i<thee->nResData; i++) {
477  Vparam_ResData_dtor2(&(thee->resData[i]));
478  }
479  Vmem_free(thee->vmem, thee->nResData,
480  sizeof(Vparam_ResData), (void **)&(thee->resData));
481  }
482 
483  /* Initial space for atoms */
484  nalloc = 200;
485  natoms = 0;
486  atoms = (Vparam_AtomData*)Vmem_malloc(thee->vmem, nalloc, sizeof(Vparam_AtomData));
487 
488  /* Read until we run out of entries, allocating space as needed */
489  while (1) {
490  if (natoms >= nalloc) {
491  tatoms = (Vparam_AtomData*)Vmem_malloc(thee->vmem, 2*nalloc, sizeof(Vparam_AtomData));
492  VASSERT(tatoms != VNULL);
493  for (i=0; i<natoms; i++) {
494  Vparam_AtomData_copyTo(&(atoms[i]), &(tatoms[i]));
495  }
496  Vmem_free(thee->vmem, nalloc, sizeof(Vparam_AtomData),
497  (void **)&(atoms));
498  atoms = tatoms;
499  tatoms = VNULL;
500  nalloc = 2*nalloc;
501  }
502  atom = &(atoms[natoms]);
503  if (!readFlatFileLine(sock, atom)) break;
504  natoms++;
505  }
506  if (natoms == 0) return 0;
507 
508  /* Count the number of residues */
509  thee->nResData = 1;
510  strcpy(currResName, atoms[0].resName);
511  for (i=1; i<natoms; i++) {
512  if (Vstring_strcasecmp(atoms[i].resName, currResName) != 0) {
513  strcpy(currResName, atoms[i].resName);
514  (thee->nResData)++;
515  }
516  }
517 
518  /* Create the residues */
519  thee->resData = (Vparam_ResData*)Vmem_malloc(thee->vmem, thee->nResData,
520  sizeof(Vparam_ResData));
521  VASSERT(thee->resData != VNULL);
522  for (i=0; i<(thee->nResData); i++) {
523  res = &(thee->resData[i]);
524  Vparam_ResData_ctor2(res, thee->vmem);
525  }
526 
527  /* Count the number of atoms per residue */
528  ires = 0;
529  res = &(thee->resData[ires]);
530  res->nAtomData = 1;
531  strcpy(res->name, atoms[0].resName);
532  for (i=1; i<natoms; i++) {
533  if (Vstring_strcasecmp(atoms[i].resName, res->name) != 0) {
534  (ires)++;
535  res = &(thee->resData[ires]);
536  res->nAtomData = 1;
537  strcpy(res->name, atoms[i].resName);
538  } else (res->nAtomData)++;
539  }
540 
541  /* Allocate per-residue space for atoms */
542  for (ires=0; ires<thee->nResData; ires++) {
543  res = &(thee->resData[ires]);
544  res->atomData = (Vparam_AtomData*)Vmem_malloc(thee->vmem, res->nAtomData,
545  sizeof(Vparam_AtomData));
546  }
547 
548  /* Copy atoms into residues */
549  iatom = 0;
550  Vparam_AtomData_copyTo(&(atoms[0]), &(res->atomData[iatom]));
551  for (ires=0; ires<thee->nResData; ires++) {
552  res = &(thee->resData[ires]);
553  for (jatom=0; jatom<res->nAtomData; jatom++) {
554  Vparam_AtomData_copyTo(&(atoms[iatom]), &(res->atomData[jatom]));
555  iatom++;
556  }
557  }
558 
559 
560  /* Shut down communication */
561  Vio_acceptFree(sock);
562  Vio_dtor(&sock);
563 
564  /* Destroy temporary atom space */
565  Vmem_free(thee->vmem, nalloc, sizeof(Vparam_AtomData), (void **)&(atoms));
566 
567  return 1;
568 
569 }
570 
572  Vparam_AtomData *dest) {
573 
574  VASSERT(thee != VNULL);
575  VASSERT(dest != VNULL);
576 
577  strcpy(dest->atomName, thee->atomName);
578  strcpy(dest->resName, thee->resName);
579  dest->charge = thee->charge;
580  dest->radius = thee->radius;
581  dest->epsilon = thee->epsilon;
582 
583 }
584 
586  Vparam_ResData *dest) {
587 
588  int i;
589 
590  VASSERT(thee != VNULL);
591  VASSERT(dest != VNULL);
592 
593  strcpy(dest->name, thee->name);
594  dest->vmem = thee->vmem;
595  dest->nAtomData = thee->nAtomData;
596 
597  dest->atomData = (Vparam_AtomData*)Vmem_malloc(thee->vmem, dest->nAtomData,
598  sizeof(Vparam_AtomData));
599 
600  for (i=0; i<dest->nAtomData; i++) {
601  Vparam_AtomData_copyTo(&(thee->atomData[i]), &(dest->atomData[i]));
602  }
603  Vmem_free(thee->vmem, thee->nAtomData, sizeof(Vparam_AtomData),
604  (void **)&(thee->atomData));
605 }
606 
608  Vparam_AtomData *src) { Vparam_AtomData_copyTo(src, thee); }
609 
610 VPRIVATE int readXMLFileAtom(Vio *sock, Vparam_AtomData *atom) {
611 
612  double dtmp;
613  char tok[VMAX_BUFSIZE];
614  int chgflag, radflag, nameflag;
615 
616  VASSERT(atom != VNULL);
617 
618  if (Vio_scanf(sock, "%s", tok) != 1) return 0;
619 
620  chgflag = 0;
621  radflag = 0;
622  nameflag = 0;
623 
624  while (1)
625  {
626  if (Vstring_strcasecmp(tok, "name") == 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));
631  return 0;
632  }
633  nameflag = 1;
634  strcpy(atom->atomName, tok);
635  } else if (Vstring_strcasecmp(tok, "charge") == 0) {
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);
640  return 0;
641  }
642  chgflag = 1;
643  atom->charge = dtmp;
644  } else if (Vstring_strcasecmp(tok, "radius") == 0) {
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);
649  return 0;
650  }
651  radflag = 1;
652  atom->radius = dtmp;
653  } else if (Vstring_strcasecmp(tok, "epsilon") == 0) {
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);
658  return 0;
659  }
660  atom->epsilon = dtmp;
661  } else if ((Vstring_strcasecmp(tok, "/atom") == 0) ||
662  (Vstring_strcasecmp(tok, "atom") == 0)){
663  if (chgflag && radflag && nameflag) return 1;
664  else if (!chgflag) {
665  Vnm_print(2, "Vparam_readXMLFileAtom: Reached end of atom without \
666 setting the charge!\n");
667  return 0;
668  } else if (!radflag) {
669  Vnm_print(2, "Vparam_readXMLFileAtom: Reached end of atom without \
670 setting the radius!\n");
671  return 0;
672  } else if (!nameflag) {
673  Vnm_print(2, "Vparam_readXMLFileAtom: Reached end of atom without \
674 setting the name!\n");
675  return 0;
676  }
677  }
678  VJMPERR1(Vio_scanf(sock, "%s", tok) == 1);
679  }
680 
681  /* If we get here something wrong has happened */
682 
683  VJMPERR1(1);
684 
685 VERROR1:
686  Vnm_print(2, "Vparam_readXMLFileAtom: Got unexpected EOF reading parameter file!\n");
687  return 0;
688 
689 }
690 
691 VPRIVATE int readFlatFileLine(Vio *sock, Vparam_AtomData *atom) {
692 
693  double dtmp;
694  char tok[VMAX_BUFSIZE];
695 
696  VASSERT(atom != VNULL);
697 
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",
701  tok, strlen(tok));
702  return 0;
703  }
704  strcpy(atom->resName, tok);
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",
708  tok, strlen(tok));
709  return 0;
710  }
711  strcpy(atom->atomName, tok);
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);
716  return 0;
717  }
718  atom->charge = dtmp;
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);
723  return 0;
724  }
725  atom->radius = dtmp;
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);
730  return 0;
731  }
732  atom->epsilon = dtmp;
733 
734  return 1;
735 
736 VERROR1:
737  Vnm_print(2, "Vparam_readFlatFile: Got unexpected EOF reading parameter file!\n");
738  return 0;
739 }
Vmem * vmem
Definition: vparam.h:115
VPUBLIC unsigned long int Vparam_memChk(Vparam *thee)
Get number of bytes in this object and its members.
Definition: vparam.c:102
Vmem * vmem
Definition: vparam.h:137
double epsilon
Definition: vparam.h:97
VPUBLIC Vparam * Vparam_ctor()
Construct the object.
Definition: vparam.c:181
VPUBLIC int Vparam_ctor2(Vparam *thee)
FORTRAN stub to construct the object.
Definition: vparam.c:193
VPUBLIC int Vparam_AtomData_ctor2(Vparam_AtomData *thee)
FORTRAN stub to construct the object.
Definition: vparam.c:121
VPRIVATE int readFlatFileLine(Vio *sock, Vparam_AtomData *atom)
Read a single line of the flat file database.
Definition: vparam.c:691
VPRIVATE char * MCcommChars
Comment characters for socket reads.
Definition: vparam.c:71
VPUBLIC Vparam_ResData * Vparam_ResData_ctor(Vmem *mem)
Construct the object.
Definition: vparam.c:135
VPRIVATE int readXMLFileAtom(Vio *sock, Vparam_AtomData *atom)
Read atom information from an XML file.
Definition: vparam.c:610
VPUBLIC int Vparam_ResData_ctor2(Vparam_ResData *thee, Vmem *mem)
FORTRAN stub to construct the object.
Definition: vparam.c:147
ResData sub-class; stores residue data.
Definition: vparam.h:114
Vparam_ResData * resData
Definition: vparam.h:140
char name[VMAX_ARGLEN]
Definition: vparam.h:116
AtomData sub-class; stores atom data.
Definition: vparam.h:92
int nResData
Definition: vparam.h:138
Contains declarations for class Vparam.
char resName[VMAX_ARGLEN]
Definition: vparam.h:94
VPUBLIC void Vparam_ResData_dtor(Vparam_ResData **thee)
Destroy object.
Definition: vparam.c:160
Vparam_AtomData * atomData
Definition: vparam.h:119
VPUBLIC void Vparam_AtomData_dtor(Vparam_AtomData **thee)
Destroy object.
Definition: vparam.c:123
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
Definition: vhal.h:563
VPUBLIC void Vparam_dtor(Vparam **thee)
Destroy object.
Definition: vparam.c:213
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.
Definition: vparam.c:445
VPUBLIC int Vstring_strcasecmp(const char *s1, const char *s2)
Case-insensitive string comparison (BSD standard)
Definition: vstring.c:66
char atomName[VMAX_ARGLEN]
Definition: vparam.h:93
VPUBLIC Vparam_AtomData * Vparam_getAtomData(Vparam *thee, char resName[VMAX_ARGLEN], char atomName[VMAX_ARGLEN])
Get atom data.
Definition: vparam.c:267
Reads and assigns charge/radii parameters.
Definition: vparam.h:135
double charge
Definition: vparam.h:95
VPRIVATE char * MCxmlwhiteChars
Whitespace characters for XML socket reads.
Definition: vparam.c:77
VPUBLIC void Vparam_AtomData_dtor2(Vparam_AtomData *thee)
FORTRAN stub to destroy object.
Definition: vparam.c:133
VPUBLIC Vparam_AtomData * Vparam_AtomData_ctor()
Construct the object.
Definition: vparam.c:109
VPUBLIC void Vparam_dtor2(Vparam *thee)
FORTRAN stub to destroy object.
Definition: vparam.c:223
VEXTERNC void Vparam_ResData_copyTo(Vparam_ResData *thee, Vparam_ResData *dest)
Copy current residue object to destination.
Definition: vparam.c:585
VEXTERNC void Vparam_AtomData_copyTo(Vparam_AtomData *thee, Vparam_AtomData *dest)
Copy current atom object to destination.
Definition: vparam.c:571
VPUBLIC int Vparam_readXMLFile(Vparam *thee, const char *iodev, const char *iofmt, const char *thost, const char *fname)
Read an XML format parameter database.
Definition: vparam.c:306
VEXTERNC void Vparam_AtomData_copyFrom(Vparam_AtomData *thee, Vparam_AtomData *src)
Copy current atom object from another.
Definition: vparam.c:607
int nAtomData
Definition: vparam.h:117
VPUBLIC Vparam_ResData * Vparam_getResData(Vparam *thee, char resName[VMAX_ARGLEN])
Get residue data.
Definition: vparam.c:241
VPRIVATE char * MCwhiteChars
Whitespace characters for socket reads.
Definition: vparam.c:65
VPUBLIC void Vparam_ResData_dtor2(Vparam_ResData *thee)
FORTRAN stub to destroy object.
Definition: vparam.c:170
double radius
Definition: vparam.h:96