61 #if !defined(VINLINE_MGPARM) 66 VASSERT(thee != VNULL);
70 VASSERT(thee != VNULL);
74 VASSERT(thee != VNULL);
78 VASSERT(thee != VNULL);
82 VASSERT(thee != VNULL);
86 VASSERT(thee != VNULL);
90 VASSERT(thee != VNULL);
94 VASSERT(thee != VNULL);
98 VASSERT(thee != VNULL);
102 VASSERT(thee != VNULL);
103 return thee->
grid[0];
106 VASSERT(thee != VNULL);
107 return thee->
grid[1];
110 VASSERT(thee != VNULL);
111 return thee->
grid[2];
119 VASSERT( thee != VNULL);
131 for (i=0; i<3; i++) {
176 if ((*thee) != VNULL) {
178 Vmem_free(VNULL, 1,
sizeof(
MGparm), (
void **)thee);
188 int i, tdime[3], ti, tnlev[3], nlev;
192 Vnm_print(0,
"MGparm_check: checking MGparm object of type %d.\n",
197 Vnm_print(2,
"MGparm_check: not filled!\n");
203 Vnm_print(2,
"MGparm_check: DIME not set!\n");
207 Vnm_print(2,
"MGparm_check: CHGM not set!\n");
215 Vnm_print(2,
"MGparm_check: Neither GRID nor GLEN set!\n");
219 Vnm_print(2,
"MGparm_check: Both GRID and GLEN set!\n");
223 Vnm_print(2,
"MGparm_check: GCENT not set!\n");
231 Vnm_print(2,
"MGparm_check: CGLEN not set!\n");
235 Vnm_print(2,
"MGparm_check: FGLEN not set!\n");
239 Vnm_print(2,
"MGparm_check: CGCENT not set!\n");
243 Vnm_print(2,
"MGparm_check: FGCENT not set!\n");
251 Vnm_print(2,
"MGparm_check: PDIME not set!\n");
255 Vnm_print(2,
"MGparm_check: PROC_RANK not set!\n");
259 Vnm_print(2,
"MGparm_check: PROC_SIZE not set!\n");
263 Vnm_print(2,
"MGparm_check: OFRAC not set!\n");
274 for (i=0; i<3; i++) {
276 ti = thee->
dime[i] - 1;
277 if (ti == VPOW(2, (thee->
nlev+1))) {
278 tnlev[i] = thee->
nlev;
279 tdime[i] = thee->
dime[i];
281 tdime[i] = thee->
dime[i];
288 ti = (int)ceil(0.5*ti);
294 if ((tdime[i] > 65) && (tnlev[i] <
VMGNLEV)) {
295 Vnm_print(2,
"NOsh: Bad dime[%d] = %d (%d nlev)!\n",
296 i, tdime[i], tnlev[i]);
297 ti = (int)(tdime[i]/VPOW(2.,(
VMGNLEV+1)));
299 tdime[i] = ti*(int)(VPOW(2.,(
VMGNLEV+1))) + 1;
301 Vnm_print(2,
"NOsh: Reset dime[%d] to %d and (nlev = %d).\n", i, tdime[i],
VMGNLEV);
306 for (i=0; i<3; i++) {
307 tnlev[i] = thee->
nlev;
308 tdime[i] = thee->
dime[i];
309 if (thee->
dime[i] <= 0) {
310 Vnm_print(2,
"NOsh: Resetting dime[%d] from %d to 3.\n", i, thee->
dime[i]);
318 nlev = VMIN2(tnlev[0], tnlev[1]);
319 nlev = VMIN2(nlev, tnlev[2]);
321 Vnm_print(0,
"NOsh: nlev = %d, dime = (%d, %d, %d)\n", nlev, tdime[0],
324 if (thee->
nlev <= 0) {
325 Vnm_print(2,
"MGparm_check: illegal nlev (%d); check your grid dimensions!\n", thee->
nlev);
328 if (thee->
nlev < 2) {
329 Vnm_print(2,
"MGparm_check: you're using a very small nlev (%d) and therefore\n", thee->
nlev);
330 Vnm_print(2,
"MGparm_check: will not get the optimal performance of the multigrid\n");
331 Vnm_print(2,
"MGparm_check: algorithm. Please check your grid dimensions.\n");
333 for (i=0; i<3; i++) thee->
dime[i] = tdime[i];
345 VASSERT(thee != VNULL);
346 VASSERT(parm != VNULL);
353 for (i=0; i<3; i++) thee->
dime[i] = parm->
dime[i];
364 for (i=0; i<3; i++) thee->
grid[i] = parm->
grid[i];
366 for (i=0; i<3; i++) thee->
glen[i] = parm->
glen[i];
374 for (i=0; i<3; i++) thee->
cglen[i] = parm->
cglen[i];
376 for (i=0; i<3; i++) thee->
fglen[i] = parm->
fglen[i];
394 for (i=0; i<3; i++) thee->
pdime[i] = parm->
pdime[i];
415 VPRIVATE Vrc_Codes MGparm_parseDIME(
MGparm *thee, Vio *sock) {
417 char tok[VMAX_BUFSIZE];
420 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
421 if (sscanf(tok,
"%d", &ti) == 0){
422 Vnm_print(2,
"parseMG: Read non-integer (%s) while parsing DIME \ 425 }
else thee->
dime[0] = ti;
426 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
427 if (sscanf(tok,
"%d", &ti) == 0) {
428 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing DIME \ 431 }
else thee->
dime[1] = ti;
432 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
433 if (sscanf(tok,
"%d", &ti) == 0) {
434 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing DIME \ 437 }
else thee->
dime[2] = ti;
442 Vnm_print(2,
"parseMG: ran out of tokens!\n");
446 VPRIVATE Vrc_Codes MGparm_parseCHGM(
MGparm *thee, Vio *sock) {
448 char tok[VMAX_BUFSIZE];
451 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
452 if (sscanf(tok,
"%d", (
int*)(&ti)) == 1) {
455 Vnm_print(2,
"NOsh: Warning -- parsed deprecated statment \"chgm %d\".\n", ti);
456 Vnm_print(2,
"NOsh: Please use \"chgm ");
457 switch (thee->
chgm) {
459 Vnm_print(2,
"spl0");
462 Vnm_print(2,
"spl2");
465 Vnm_print(2,
"spl4");
468 Vnm_print(2,
"UNKNOWN");
471 Vnm_print(2,
"\" instead!\n");
486 Vnm_print(2,
"NOsh: Unrecognized parameter (%s) when parsing \ 493 Vnm_print(2,
"parseMG: ran out of tokens!\n");
497 VPRIVATE Vrc_Codes MGparm_parseNLEV(
MGparm *thee, Vio *sock) {
499 char tok[VMAX_BUFSIZE];
502 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
503 if (sscanf(tok,
"%d", &ti) == 0) {
504 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing NLEV \ 507 }
else thee->
nlev = ti;
512 Vnm_print(2,
"parseMG: ran out of tokens!\n");
516 VPRIVATE Vrc_Codes MGparm_parseETOL(
MGparm *thee, Vio *sock) {
518 char tok[VMAX_BUFSIZE];
521 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
522 if (sscanf(tok,
"%lf", &tf) == 0) {
523 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing etol \ 526 }
else if (tf <= 0.0) {
527 Vnm_print(2,
"parseMG: etol must be greater than 0!\n");
529 }
else thee->
etol = tf;
534 Vnm_print(2,
"parseMG: ran out of tokens!\n");
539 VPRIVATE Vrc_Codes MGparm_parseGRID(
MGparm *thee, Vio *sock) {
541 char tok[VMAX_BUFSIZE];
544 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
545 if (sscanf(tok,
"%lf", &tf) == 0) {
546 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GRID \ 549 }
else thee->
grid[0] = tf;
550 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
551 if (sscanf(tok,
"%lf", &tf) == 0) {
552 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GRID \ 555 }
else thee->
grid[1] = tf;
556 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
557 if (sscanf(tok,
"%lf", &tf) == 0) {
558 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GRID \ 561 }
else thee->
grid[2] = tf;
566 Vnm_print(2,
"parseMG: ran out of tokens!\n");
570 VPRIVATE Vrc_Codes MGparm_parseGLEN(
MGparm *thee, Vio *sock) {
572 char tok[VMAX_BUFSIZE];
575 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
576 if (sscanf(tok,
"%lf", &tf) == 0) {
577 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GLEN \ 580 }
else thee->
glen[0] = tf;
581 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
582 if (sscanf(tok,
"%lf", &tf) == 0) {
583 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GLEN \ 586 }
else thee->
glen[1] = tf;
587 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
588 if (sscanf(tok,
"%lf", &tf) == 0) {
589 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing GLEN \ 592 }
else thee->
glen[2] = tf;
597 Vnm_print(2,
"parseMG: ran out of tokens!\n");
601 VPRIVATE Vrc_Codes MGparm_parseGAMMA(
MGparm *thee, Vio *sock) {
603 char tok[VMAX_BUFSIZE];
605 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
606 Vnm_print(2,
"parseMG: GAMMA keyword deprecated!\n");
607 Vnm_print(2,
"parseMG: If you are using PyMOL or VMD and still seeing this message,\n");
608 Vnm_print(2,
"parseMG: please contact the developers of those programs regarding this message.\n");
612 Vnm_print(2,
"parseMG: ran out of tokens!\n");
616 VPRIVATE Vrc_Codes MGparm_parseGCENT(
MGparm *thee, Vio *sock) {
618 char tok[VMAX_BUFSIZE];
624 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
625 if (sscanf(tok,
"%lf", &tf) == 0) {
627 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
628 if (sscanf(tok,
"%d", &ti) == 0) {
629 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 630 GCENT MOL keyword!\n", tok);
639 Vnm_print(2,
"NOsh: Unexpected keyword (%s) while parsing \ 645 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
646 if (sscanf(tok,
"%lf", &tf) == 0) {
647 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 648 GCENT keyword!\n", tok);
652 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
653 if (sscanf(tok,
"%lf", &tf) == 0) {
654 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 655 GCENT keyword!\n", tok);
664 Vnm_print(2,
"parseMG: ran out of tokens!\n");
668 VPRIVATE Vrc_Codes MGparm_parseCGLEN(
MGparm *thee, Vio *sock) {
670 char tok[VMAX_BUFSIZE];
673 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
674 if (sscanf(tok,
"%lf", &tf) == 0) {
675 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing CGLEN \ 678 }
else thee->
cglen[0] = tf;
679 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
680 if (sscanf(tok,
"%lf", &tf) == 0) {
681 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing CGLEN \ 684 }
else thee->
cglen[1] = tf;
685 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
686 if (sscanf(tok,
"%lf", &tf) == 0) {
687 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing CGLEN \ 690 }
else thee->
cglen[2] = tf;
695 Vnm_print(2,
"parseMG: ran out of tokens!\n");
699 VPRIVATE Vrc_Codes MGparm_parseFGLEN(
MGparm *thee, Vio *sock) {
701 char tok[VMAX_BUFSIZE];
704 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
705 if (sscanf(tok,
"%lf", &tf) == 0) {
706 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing FGLEN \ 709 }
else thee->
fglen[0] = tf;
710 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
711 if (sscanf(tok,
"%lf", &tf) == 0) {
712 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing FGLEN \ 715 }
else thee->
fglen[1] = tf;
716 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
717 if (sscanf(tok,
"%lf", &tf) == 0) {
718 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing FGLEN \ 721 }
else thee->
fglen[2] = tf;
726 Vnm_print(2,
"parseMG: ran out of tokens!\n");
730 VPRIVATE Vrc_Codes MGparm_parseCGCENT(
MGparm *thee, Vio *sock) {
732 char tok[VMAX_BUFSIZE];
738 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
739 if (sscanf(tok,
"%lf", &tf) == 0) {
741 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
742 if (sscanf(tok,
"%d", &ti) == 0) {
743 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 744 CGCENT MOL keyword!\n", tok);
753 Vnm_print(2,
"NOsh: Unexpected keyword (%s) while parsing \ 759 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
760 if (sscanf(tok,
"%lf", &tf) == 0) {
761 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 762 CGCENT keyword!\n", tok);
766 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
767 if (sscanf(tok,
"%lf", &tf) == 0) {
768 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 769 CGCENT keyword!\n", tok);
778 Vnm_print(2,
"parseMG: ran out of tokens!\n");
782 VPRIVATE Vrc_Codes MGparm_parseFGCENT(
MGparm *thee, Vio *sock) {
784 char tok[VMAX_BUFSIZE];
790 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
791 if (sscanf(tok,
"%lf", &tf) == 0) {
793 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
794 if (sscanf(tok,
"%d", &ti) == 0) {
795 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing \ 796 FGCENT MOL keyword!\n", tok);
805 Vnm_print(2,
"NOsh: Unexpected keyword (%s) while parsing \ 811 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
812 if (sscanf(tok,
"%lf", &tf) == 0) {
813 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 814 FGCENT keyword!\n", tok);
818 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
819 if (sscanf(tok,
"%lf", &tf) == 0) {
820 Vnm_print(2,
"NOsh: Read non-float (%s) while parsing \ 821 FGCENT keyword!\n", tok);
830 Vnm_print(2,
"parseMG: ran out of tokens!\n");
834 VPRIVATE Vrc_Codes MGparm_parsePDIME(
MGparm *thee, Vio *sock) {
836 char tok[VMAX_BUFSIZE];
840 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
841 if (sscanf(tok,
"%d", &ti) == 0) {
842 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing PDIME \ 848 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
849 if (sscanf(tok,
"%d", &ti) == 0) {
850 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing PDIME \ 856 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
857 if (sscanf(tok,
"%d", &ti) == 0) {
858 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing PDIME \ 868 Vnm_print(2,
"parseMG: ran out of tokens!\n");
872 VPRIVATE Vrc_Codes MGparm_parseOFRAC(
MGparm *thee, Vio *sock) {
874 char tok[VMAX_BUFSIZE];
877 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
878 if (sscanf(tok,
"%lf", &tf) == 0) {
879 Vnm_print(2,
"NOsh: Read non-int (%s) while parsing OFRAC \ 888 Vnm_print(2,
"parseMG: ran out of tokens!\n");
892 VPRIVATE Vrc_Codes MGparm_parseASYNC(
MGparm *thee, Vio *sock) {
894 char tok[VMAX_BUFSIZE];
897 VJMPERR1(Vio_scanf(sock,
"%s", tok) == 1);
898 if (sscanf(tok,
"%i", &ti) == 0) {
899 Vnm_print(2,
"NOsh: Read non-integer (%s) while parsing ASYNC \ 908 Vnm_print(2,
"parseMG: ran out of tokens!\n");
912 VPRIVATE Vrc_Codes MGparm_parseUSEAQUA(
MGparm *thee, Vio *sock) {
913 Vnm_print(0,
"NOsh: parsed useaqua\n");
923 Vnm_print(2,
"parseMG: got NULL thee!\n");
927 Vnm_print(2,
"parseMG: got NULL socket!\n");
931 Vnm_print(0,
"MGparm_parseToken: trying %s...\n", tok);
935 return MGparm_parseDIME(thee, sock);
937 return MGparm_parseCHGM(thee, sock);
939 Vnm_print(2,
"Warning: The 'nlev' keyword is now deprecated!\n");
940 return MGparm_parseNLEV(thee, sock);
942 return MGparm_parseETOL(thee, sock);
944 return MGparm_parseGRID(thee, sock);
946 return MGparm_parseGLEN(thee, sock);
948 return MGparm_parseGCENT(thee, sock);
950 return MGparm_parseCGLEN(thee, sock);
952 return MGparm_parseFGLEN(thee, sock);
954 return MGparm_parseCGCENT(thee, sock);
956 return MGparm_parseFGCENT(thee, sock);
958 return MGparm_parsePDIME(thee, sock);
960 return MGparm_parseOFRAC(thee, sock);
962 return MGparm_parseASYNC(thee, sock);
964 return MGparm_parseGAMMA(thee, sock);
966 return MGparm_parseUSEAQUA(thee, sock);
968 Vnm_print(2,
"parseMG: Unrecognized keyword (%s)!\n", tok);
VPUBLIC Vrc_Codes MGparm_parseToken(MGparm *thee, char tok[VMAX_BUFSIZE], Vio *sock)
Parse an MG keyword from an input file.
VPUBLIC double MGparm_getHz(MGparm *thee)
Get grid spacing in z direction (Å)
VPUBLIC double MGparm_getCenterY(MGparm *thee)
Get center y-coordinate.
VPUBLIC double MGparm_getCenterZ(MGparm *thee)
Get center z-coordinate.
VPUBLIC void MGparm_dtor2(MGparm *thee)
FORTRAN stub for object destructor.
VPUBLIC void MGparm_dtor(MGparm **thee)
Object destructor.
VPUBLIC int MGparm_getNz(MGparm *thee)
Get number of grid points in z direction.
VPUBLIC void MGparm_setCenterY(MGparm *thee, double y)
Set center y-coordinate.
VPUBLIC int MGparm_getNy(MGparm *thee)
Get number of grid points in y direction.
#define VMGNLEV
Minimum number of levels in a multigrid calculations.
Contains declarations for class MGparm.
VPUBLIC MGparm * MGparm_ctor(MGparm_CalcType type)
Construct MGparm object.
VPUBLIC void MGparm_copy(MGparm *thee, MGparm *parm)
Copy MGparm object into thee.
VPUBLIC double MGparm_getHy(MGparm *thee)
Get grid spacing in y direction (Å)
VPUBLIC double MGparm_getHx(MGparm *thee)
Get grid spacing in x direction (Å)
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
enum eMGparm_CalcType MGparm_CalcType
Declare MGparm_CalcType type.
VPUBLIC Vrc_Codes MGparm_ctor2(MGparm *thee, MGparm_CalcType type)
FORTRAN stub to construct MGparm object.
VPUBLIC int Vstring_strcasecmp(const char *s1, const char *s2)
Case-insensitive string comparison (BSD standard)
VPUBLIC void MGparm_setCenterX(MGparm *thee, double x)
Set center x-coordinate.
VPUBLIC int MGparm_getNx(MGparm *thee)
Get number of grid points in x direction.
VPUBLIC double MGparm_getCenterX(MGparm *thee)
Get center x-coordinate.
VPUBLIC Vrc_Codes MGparm_check(MGparm *thee)
Consistency check for parameter values stored in object.
Parameter structure for MG-specific variables from input files.
VPUBLIC void MGparm_setCenterZ(MGparm *thee, double z)
Set center z-coordinate.
enum eVchrg_Meth Vchrg_Meth
Declaration of the Vchrg_Meth type as the Vchrg_Meth enum.