61 #if !defined(VINLINE_MGPARM) 66 VASSERT(thee != VNULL);
67 VASSERT(i < thee->nion);
72 VASSERT(thee != VNULL);
73 VASSERT(i < thee->nion);
78 VASSERT(thee != VNULL);
79 VASSERT(i < thee->nion);
87 VPUBLIC
double PBEparm_getzmem(
PBEparm *thee) {
88 VASSERT(thee != VNULL);
91 VPUBLIC
double PBEparm_getLmem(
PBEparm *thee) {
92 VASSERT(thee != VNULL);
95 VPUBLIC
double PBEparm_getmembraneDiel(
PBEparm *thee) {
96 VASSERT(thee != VNULL);
99 VPUBLIC
double PBEparm_getmemv(
PBEparm *thee) {
100 VASSERT(thee != VNULL);
109 VASSERT( thee != VNULL);
119 if (thee == VNULL)
return 0;
174 if ((*thee) != VNULL) {
176 Vmem_free(VNULL, 1,
sizeof(
PBEparm), (
void **)thee);
189 Vnm_print(2,
"PBEparm_check: not filled!\n");
194 Vnm_print(2,
"PBEparm_check: MOL not set!\n");
198 Vnm_print(2,
"PBEparm_check: LPBE/NPBE/LRPBE/NRPBE/SMPBE not set!\n");
202 Vnm_print(2,
"PBEparm_check: BCFL not set!\n");
209 for (i=0; i<thee->
nion; i++) {
211 Vnm_print(2,
"PBEparm_check: ION #%d not set!\n",i);
216 Vnm_print(2,
"PBEparm_check: PDIE not set!\n");
221 Vnm_print(2,
"PBEparm_check: SDENS not set!\n");
225 Vnm_print(2,
"PBEparm_check: SDIE not set!\n");
229 Vnm_print(2,
"PBEparm_check: SRFM not set!\n");
234 Vnm_print(2,
"PBEparm_check: SRAD not set!\n");
238 Vnm_print(2,
"PBEparm_check: SWIN not set!\n");
242 Vnm_print(2,
"PBEparm_check: SWIN not set!\n");
246 Vnm_print(2,
"PBEparm_check: SWIN not set!\n");
250 Vnm_print(2,
"PBEparm_check: TEMP not set!\n");
262 Vnm_print(2,
"PBEparm_check: ZMEM not set!\n");
266 Vnm_print(2,
"PBEparm_check: LMEM not set!\n");
270 Vnm_print(2,
"PBEparm_check: MDIE not set!\n");
274 Vnm_print(2,
"PBEparm_check: MEMV not set!\n");
287 VASSERT(thee != VNULL);
288 VASSERT(parm != VNULL);
306 for (i=0; i<
MAXION; i++) {
350 for (j=0; j<VMAX_ARGLEN; j++)
368 VPRIVATE
int PBEparm_parseLPBE(
PBEparm *thee, Vio *sock) {
369 Vnm_print(0,
"NOsh: parsed lpbe\n");
375 VPRIVATE
int PBEparm_parseNPBE(
PBEparm *thee, Vio *sock) {
376 Vnm_print(0,
"NOsh: parsed npbe\n");
382 VPRIVATE
int PBEparm_parseMOL(
PBEparm *thee, Vio *sock) {
384 char tok[VMAX_BUFSIZE];
386 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
387 if (sscanf(tok,
"%d", &ti) == 0) {
388 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing MOL \ 397 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
401 VPRIVATE
int PBEparm_parseLRPBE(
PBEparm *thee, Vio *sock) {
402 Vnm_print(0,
"NOsh: parsed lrpbe\n");
408 VPRIVATE
int PBEparm_parseNRPBE(
PBEparm *thee, Vio *sock) {
409 Vnm_print(0,
"NOsh: parsed nrpbe\n");
415 VPRIVATE
int PBEparm_parseSMPBE(
PBEparm *thee, Vio *sock) {
419 char type[VMAX_BUFSIZE];
420 char value[VMAX_BUFSIZE];
424 char keyValuePairs = 2;
428 for(i=0;i<keyValuePairs;i++){
431 VJMPERR1(Vio_scanf(sock,
"%s", type) == 1);
432 VJMPERR1(Vio_scanf(sock,
"%s", value) == 1);
434 if(!strcmp(type,
"vol")){
435 if ((setVol = sscanf(value,
"%lf", &volume)) == 0){
436 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing smpbe keyword!\n", value);
439 }
else if(!strcmp(type,
"size")){
440 if ((setSize = sscanf(value,
"%lf", &size)) == 0){
441 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing smpbe keyword!\n", value);
445 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing smpbe keyword!\n", value);
451 if((setVol == 0) || (setSize == 0)){
452 Vnm_print(2,
"NOsh: Error while parsing smpbe keywords! Only size or vol was specified.\n");
456 Vnm_print(0,
"NOsh: parsed smpbe\n");
469 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
474 VPRIVATE
int PBEparm_parseBCFL(
PBEparm *thee, Vio *sock) {
475 char tok[VMAX_BUFSIZE];
478 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
481 if (sscanf(tok,
"%d", &ti) == 1) {
486 Vnm_print(2,
"parsePBE: Warning -- parsed deprecated \"bcfl %d\" \ 488 Vnm_print(2,
"parsePBE: Please use \"bcfl ");
489 switch (thee->
bcfl) {
491 Vnm_print(2,
"zero");
500 Vnm_print(2,
"focus");
509 Vnm_print(2,
"UKNOWN");
512 Vnm_print(2,
"\" instead.\n");
543 Vnm_print(2,
"NOsh: parsed unknown BCFL parameter (%s)!\n",
551 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
555 VPRIVATE
int PBEparm_parseION(
PBEparm *thee, Vio *sock) {
560 char tok[VMAX_BUFSIZE];
561 char value[VMAX_BUFSIZE];
564 double charge, conc, radius;
569 int keyValuePairs = 3;
572 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
575 meth = sscanf(tok,
"%lf", &tf);
579 Vnm_print(2,
"NOsh: Deprecated use of ION keyword! Use key-value pairs\n", tok);
581 if (sscanf(tok,
"%lf", &tf) == 0) {
582 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION keyword!\n", tok);
586 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
587 if (sscanf(tok,
"%lf", &tf) == 0) {
588 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION keyword!\n", tok);
592 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
593 if (sscanf(tok,
"%lf", &tf) == 0) {
594 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION keyword!\n", tok);
602 for(i=0;i<keyValuePairs;i++){
606 VJMPERR1(Vio_scanf(sock,
"%s", value) == 1);
607 if(!strcmp(tok,
"charge")){
608 setCharge = sscanf(value,
"%lf", &charge);
610 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION %s keyword!\n", value, tok);
614 }
else if(!strcmp(tok,
"radius")){
615 setRadius = sscanf(value,
"%lf", &radius);
617 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION %s keyword!\n", value, tok);
621 }
else if(!strcmp(tok,
"conc")){
622 setConc = sscanf(value,
"%lf", &conc);
624 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ION %s keyword!\n", value, tok);
629 Vnm_print(2,
"NOsh: Illegal or missing key-value pair for ION keyword!\n");
634 if((setCharge != 1) || (setConc != 1) || (setRadius != 1)){
635 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
648 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
652 VPRIVATE
int PBEparm_parsePDIE(
PBEparm *thee, Vio *sock) {
653 char tok[VMAX_BUFSIZE];
656 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
657 if (sscanf(tok,
"%lf", &tf) == 0) {
658 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing PDIE \ 667 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
671 VPRIVATE
int PBEparm_parseSDENS(
PBEparm *thee, Vio *sock) {
672 char tok[VMAX_BUFSIZE];
675 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
676 if (sscanf(tok,
"%lf", &tf) == 0) {
677 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing SDENS \ 686 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
690 VPRIVATE
int PBEparm_parseSDIE(
PBEparm *thee, Vio *sock) {
691 char tok[VMAX_BUFSIZE];
694 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
695 if (sscanf(tok,
"%lf", &tf) == 0) {
696 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing SDIE \ 705 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
709 VPRIVATE
int PBEparm_parseSRFM(
PBEparm *thee, Vio *sock) {
710 char tok[VMAX_BUFSIZE];
713 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
716 if (sscanf(tok,
"%d", &ti) == 1) {
720 Vnm_print(2,
"parsePBE: Warning -- parsed deprecated \"srfm %d\" \ 722 Vnm_print(2,
"parsePBE: Please use \"srfm ");
723 switch (thee->
srfm) {
728 Vnm_print(2,
"smol");
731 Vnm_print(2,
"spl2");
734 Vnm_print(2,
"spl3");
737 Vnm_print(2,
"spl4");
740 Vnm_print(2,
"UNKNOWN");
743 Vnm_print(2,
"\" instead.\n");
768 Vnm_print(2,
"NOsh: Unrecongnized keyword (%s) when parsing \ 776 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
780 VPRIVATE
int PBEparm_parseSRAD(
PBEparm *thee, Vio *sock) {
781 char tok[VMAX_BUFSIZE];
784 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
785 if (sscanf(tok,
"%lf", &tf) == 0) {
786 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing SRAD \ 795 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
799 VPRIVATE
int PBEparm_parseSWIN(
PBEparm *thee, Vio *sock) {
800 char tok[VMAX_BUFSIZE];
803 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
804 if (sscanf(tok,
"%lf", &tf) == 0) {
805 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing SWIN \ 814 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
818 VPRIVATE
int PBEparm_parseTEMP(
PBEparm *thee, Vio *sock) {
819 char tok[VMAX_BUFSIZE];
822 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
823 if (sscanf(tok,
"%lf", &tf) == 0) {
824 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing TEMP \ 833 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
837 VPRIVATE
int PBEparm_parseUSEMAP(
PBEparm *thee, Vio *sock) {
838 char tok[VMAX_BUFSIZE];
841 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
842 Vnm_print(0,
"PBEparm_parseToken: Read %s...\n", tok);
845 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
846 if (sscanf(tok,
"%d", &ti) == 0) {
847 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 848 USEMAP DIEL keyword!\n", tok);
855 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
856 if (sscanf(tok,
"%d", &ti) == 0) {
857 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 858 USEMAP KAPPA keyword!\n", tok);
865 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
866 if (sscanf(tok,
"%d", &ti) == 0) {
867 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 868 USEMAP POT keyword!\n", tok);
875 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
876 if (sscanf(tok,
"%d", &ti) == 0) {
877 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 878 USEMAP CHARGE keyword!\n", tok);
884 Vnm_print(2,
"NOsh: Read undefined keyword (%s) while parsing \ 885 USEMAP statement!\n", tok);
891 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
895 VPRIVATE
int PBEparm_parseCALCENERGY(
PBEparm *thee, Vio *sock) {
896 char tok[VMAX_BUFSIZE];
899 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
901 if (sscanf(tok,
"%d", &ti) == 1) {
905 Vnm_print(2,
"parsePBE: Warning -- parsed deprecated \"calcenergy \ 906 %d\" statement.\n", ti);
907 Vnm_print(2,
"parsePBE: Please use \"calcenergy ");
913 Vnm_print(2,
"total");
916 Vnm_print(2,
"comps");
919 Vnm_print(2,
"UNKNOWN");
922 Vnm_print(2,
"\" instead.\n");
937 Vnm_print(2,
"NOsh: Unrecognized parameter (%s) while parsing \ 938 calcenergy!\n", tok);
944 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
948 VPRIVATE
int PBEparm_parseCALCFORCE(
PBEparm *thee, Vio *sock) {
949 char tok[VMAX_BUFSIZE];
952 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
954 if (sscanf(tok,
"%d", &ti) == 1) {
958 Vnm_print(2,
"parsePBE: Warning -- parsed deprecated \"calcforce \ 959 %d\" statement.\n", ti);
960 Vnm_print(2,
"parsePBE: Please use \"calcforce ");
966 Vnm_print(2,
"total");
969 Vnm_print(2,
"comps");
972 Vnm_print(2,
"UNKNOWN");
975 Vnm_print(2,
"\" instead.\n");
990 Vnm_print(2,
"NOsh: Unrecognized parameter (%s) while parsing \ 997 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1005 VPRIVATE
int PBEparm_parseZMEM(
PBEparm *thee, Vio *sock) {
1006 char tok[VMAX_BUFSIZE];
1009 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1010 if (sscanf(tok,
"%lf", &tf) == 0) {
1011 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing ZMEM \ 1020 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1025 VPRIVATE
int PBEparm_parseLMEM(
PBEparm *thee, Vio *sock) {
1026 char tok[VMAX_BUFSIZE];
1029 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1030 if (sscanf(tok,
"%lf", &tf) == 0) {
1031 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing LMEM \ 1040 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1044 VPRIVATE
int PBEparm_parseMDIE(
PBEparm *thee, Vio *sock) {
1045 char tok[VMAX_BUFSIZE];
1048 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1049 if (sscanf(tok,
"%lf", &tf) == 0) {
1050 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing MDIE \ 1059 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1063 VPRIVATE
int PBEparm_parseMEMV(
PBEparm *thee, Vio *sock) {
1064 char tok[VMAX_BUFSIZE];
1067 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1068 if (sscanf(tok,
"%lf", &tf) == 0) {
1069 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing MEMV \ 1078 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1084 VPRIVATE
int PBEparm_parseWRITE(
PBEparm *thee, Vio *sock) {
1085 char tok[VMAX_BUFSIZE], str[VMAX_BUFSIZE]=
"", strnew[VMAX_BUFSIZE]=
"";
1089 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1121 Vnm_print(2,
"PBEparm_parse: Invalid data type (%s) to write!\n",
1125 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1140 Vnm_print(2,
"PBEparm_parse: Invalid data format (%s) to write!\n",
1144 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1147 while (tok[strlen(tok)-1] !=
'"') {
1150 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1153 strncpy(strnew, str+1, strlen(str)-2);
1154 strcpy(tok, strnew);
1162 Vnm_print(2,
"PBEparm_parse: You have exceeded the maximum number of write statements!\n");
1163 Vnm_print(2,
"PBEparm_parse: Ignoring additional write statements!\n");
1168 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1172 VPRIVATE
int PBEparm_parseWRITEMAT(
PBEparm *thee, Vio *sock) {
1173 char tok[VMAX_BUFSIZE], str[VMAX_BUFSIZE]=
"", strnew[VMAX_BUFSIZE]=
"";
1175 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1181 Vnm_print(2,
"NOsh: Invalid format (%s) while parsing \ 1182 WRITEMAT keyword!\n", tok);
1186 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1189 while (tok[strlen(tok)-1] !=
'"') {
1192 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
1195 strncpy(strnew, str+1, strlen(str)-2);
1196 strcpy(tok, strnew);
1204 Vnm_print(2,
"parsePBE: ran out of tokens!\n");
1212 if (thee == VNULL) {
1213 Vnm_print(2,
"parsePBE: got NULL thee!\n");
1216 if (sock == VNULL) {
1217 Vnm_print(2,
"parsePBE: got NULL socket!\n");
1221 Vnm_print(0,
"PBEparm_parseToken: trying %s...\n", tok);
1224 return PBEparm_parseMOL(thee, sock);
1226 return PBEparm_parseLPBE(thee, sock);
1228 return PBEparm_parseNPBE(thee, sock);
1230 return PBEparm_parseLRPBE(thee, sock);
1232 return PBEparm_parseNRPBE(thee, sock);
1234 return PBEparm_parseSMPBE(thee, sock);
1236 return PBEparm_parseBCFL(thee, sock);
1238 return PBEparm_parseION(thee, sock);
1240 return PBEparm_parsePDIE(thee, sock);
1242 return PBEparm_parseSDENS(thee, sock);
1244 return PBEparm_parseSDIE(thee, sock);
1246 return PBEparm_parseSRFM(thee, sock);
1248 return PBEparm_parseSRAD(thee, sock);
1250 return PBEparm_parseSWIN(thee, sock);
1252 return PBEparm_parseTEMP(thee, sock);
1254 return PBEparm_parseUSEMAP(thee, sock);
1256 return PBEparm_parseCALCENERGY(thee, sock);
1258 return PBEparm_parseCALCFORCE(thee, sock);
1260 return PBEparm_parseWRITE(thee, sock);
1262 return PBEparm_parseWRITEMAT(thee, sock);
1269 return PBEparm_parseZMEM(thee, sock);
1271 return PBEparm_parseLMEM(thee, sock);
1273 return PBEparm_parseMDIE(thee, sock);
1275 return PBEparm_parseMEMV(thee, sock);
enum eVdata_Format Vdata_Format
Declaration of the Vdata_Format type as the Vdata_Format enum.
enum eVsurf_Meth Vsurf_Meth
Declaration of the Vsurf_Meth type as the Vsurf_Meth enum.
#define PBEPARM_MAXWRITE
Number of things that can be written out in a single calculation.
Vdata_Format writefmt[PBEPARM_MAXWRITE]
VPUBLIC PBEparm * PBEparm_ctor()
Construct PBEparm object.
VPUBLIC int PBEparm_ctor2(PBEparm *thee)
FORTRAN stub to construct PBEparm object.
VPUBLIC double PBEparm_getIonRadius(PBEparm *thee, int i)
Get radius (A) of specified ion species.
enum eVbcfl Vbcfl
Declare Vbcfl type.
VPUBLIC int PBEparm_parseToken(PBEparm *thee, char tok[VMAX_BUFSIZE], Vio *sock)
Parse a keyword from an input file.
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
VPUBLIC void PBEparm_dtor2(PBEparm *thee)
FORTRAN stub for object destructor.
VPUBLIC int Vstring_strcasecmp(const char *s1, const char *s2)
Case-insensitive string comparison (BSD standard)
VPUBLIC void PBEparm_copy(PBEparm *thee, PBEparm *parm)
Copy PBEparm object into thee.
VPUBLIC void PBEparm_dtor(PBEparm **thee)
Object destructor.
enum ePBEparm_calcEnergy PBEparm_calcEnergy
Define ePBEparm_calcEnergy enumeration as PBEparm_calcEnergy.
VPUBLIC int PBEparm_check(PBEparm *thee)
Consistency check for parameter values stored in object.
PBEparm_calcEnergy calcenergy
Contains declarations for class PBEparm.
Parameter structure for PBE variables from input files.
PBEparm_calcForce calcforce
enum eVdata_Type Vdata_Type
Declaration of the Vdata_Type type as the Vdata_Type enum.
char writematstem[VMAX_ARGLEN]
enum ePBEparm_calcForce PBEparm_calcForce
Define ePBEparm_calcForce enumeration as PBEparm_calcForce.
VPUBLIC double PBEparm_getIonCharge(PBEparm *thee, int i)
Get charge (e) of specified ion species.
Vdata_Type writetype[PBEPARM_MAXWRITE]
#define MAXION
The maximum number of ion species that can be involved in a single PBE calculation.
char writestem[PBEPARM_MAXWRITE][VMAX_ARGLEN]
VPUBLIC double PBEparm_getIonConc(PBEparm *thee, int i)
Get concentration (M) of specified ion species.