APBS  1.4.1
vhal.h
Go to the documentation of this file.
1 
55 #ifndef _VAPBSHAL_H_
56 #define _VAPBSHAL_H_
57 
58 #include "stdio.h"
59 
60 FILE *data;
61 
68 enum eVrc_Codes {
69 
70  VRC_WARNING=-1,
74 };
75 typedef enum eVrc_Codes Vrc_Codes;
76 
83 enum eVsol_Meth {
84 
85  VSOL_CGMG, /* 0: conjugate gradient multigrid */
86  VSOL_Newton, /* 1: newton */
87  VSOL_MG, /* 2: multigrid */
88  VSOL_CG, /* 3: conjugate gradient */
89  VSOL_SOR, /* 4: sucessive overrelaxation */
90  VSOL_RBGS, /* 5: red-black gauss-seidel */
91  VSOL_WJ, /* 6: weighted jacobi */
92  VSOL_Richardson,/* 7: richardson */
93  VSOL_CGMGAqua, /* 8: conjugate gradient multigrid aqua */
94  VSOL_NewtonAqua /* 9: newton aqua */
95 
96 };
97 typedef enum eVsol_Meth Vsol_Meth;
98 
129 };
130 
135 typedef enum eVsurf_Meth Vsurf_Meth;
136 
145  PBE_NRPBE,
147 };
148 
154 
160  IPKEY_SMPBE = -2,
163 };
164 
170 
176  NONLIN_LPBE = 0,
177  NONLIN_NPBE,
178  NONLIN_SMPBE,
179  NONLIN_LPBEAQUA,
180  NONLIN_NPBEAQUA
181 };
182 
188 
196 };
197 
203 
209 enum eVbcfl {
219 };
220 
225 typedef enum eVbcfl Vbcfl;
226 
240 };
241 
246 typedef enum eVchrg_Meth Vchrg_Meth;
247 
258 };
259 
264 typedef enum eVchrg_Src Vchrg_Src;
265 
298 };
299 
304 typedef enum eVdata_Type Vdata_Type;
305 
312  VDF_DX=0,
316  VDF_GZ=4,
318 };
319 
325 
330 #define APBS_TIMER_WALL_CLOCK 26
331 
336 #define APBS_TIMER_SETUP 27
337 
342 #define APBS_TIMER_SOLVER 28
343 
348 #define APBS_TIMER_ENERGY 29
349 
354 #define APBS_TIMER_FORCE 30
355 
360 #define APBS_TIMER_TEMP1 31
361 
366 #define APBS_TIMER_TEMP2 32
367 
372 #define MAXMOL 5
373 
378 #define MAXION 10
379 
383 #define MAXFOCUS 5
384 
388 #define VMGNLEV 4
389 
393 #define VREDFRAC 0.25
394 
398 #define VAPBS_NVS 4
399 
403 #define VAPBS_DIM 3
404 
409 #define VAPBS_RIGHT 0
410 
415 #define MAX_SPHERE_PTS 50000
416 
421 #define VAPBS_FRONT 1
422 
427 #define VAPBS_UP 2
428 
433 #define VAPBS_LEFT 3
434 
439 #define VAPBS_BACK 4
440 
445 #define VAPBS_DOWN 5
446 
451 #define VPMGSMALL 1e-12
452 
457 #define SINH_MIN -85.0
458 
463 #define SINH_MAX 85.0
464 
465 #define MAX_HASH_DIM 75
466 
467 #if defined(VDEBUG)
468 # if !defined(APBS_NOINLINE)
469 # define APBS_NOINLINE 1
470 # endif
471 #endif
472 
473 #if !defined(APBS_NOINLINE)
474 
478 # define VINLINE_VACC
479 
483 # define VINLINE_VATOM
484 
488 # define VINLINE_VCSM
489 
493 # define VINLINE_VPBE
494 
498 # define VINLINE_VPEE
499 
503 # define VINLINE_VGREEN
504 
508 # define VINLINE_VFETK
509 
513 # define VINLINE_VPMG
514 
519 #endif
520 
521 /* Fortran name mangling */
522 #if defined(VF77_UPPERCASE)
523 # if defined(VF77_NOUNDERSCORE)
524 # define VF77_MANGLE(name,NAME) NAME
525 # elif defined(VF77_ONEUNDERSCORE)
526 # define VF77_MANGLE(name,NAME) NAME ## _
527 # else
528 # define VF77_MANGLE(name,NAME) name
529 # endif
530 #else
531 # if defined(VF77_NOUNDERSCORE)
532 # define VF77_MANGLE(name,NAME) name
533 # elif defined(VF77_ONEUNDERSCORE)
534 # define VF77_MANGLE(name,NAME) name ## _
535 # else
536 
539 # define VF77_MANGLE(name,NAME) name
540 # endif
541 #endif
542 
543 /* Floating Point Error */
544 #if defined(FLOAT_EPSILON)
545 # define VFLOOR(value) \
546  ((floor(value) != floor(value + FLOAT_EPSILON)) ? \
547  floor(value + FLOAT_EPSILON) : floor(value))
548 #else
549 
554 # define VFLOOR(value) floor(value)
555 #endif
556 
557 /* String embedding for ident */
558 #if defined(HAVE_EMBED)
559 
563 # define VEMBED(rctag) \
564  VPRIVATE const char* rctag; \
565  static void* use_rcsid=(0 ? &use_rcsid : (void**)&rcsid);
566 #else
567 
571 # define VEMBED(rctag)
572 #endif /* if defined(HAVE_EMBED) */
573 
574 
575 
577 #if !defined(WIN32) || defined(__MINGW32__)
578 #define PRINT_FUNC __PRETTY_FUNCTION__
579 #define OS_SEP_STR "/"
580 #define OS_SEP_CHAR '/'
581 #else
582 #define OS_SEP_STR "\\"
583 #define OS_SEP_CHAR '\\'
584 #define PRINT_FUNC __FUNCSIG__
585 #define snprintf sprintf_s
586 #endif
587 
588 #ifdef VERGBOSE_DEBUG
589 #define ANNOUNCE_FUNCTION \
590  do { \
591  Vnm_prrint(2, "%s() [%s:%d]\n", \
592  PRINT_FUNC, __FILE__, __LINE__ ); \
593  } while(0)
594 
595 #define WARN_UNTESTED \
596  do { \
597  Vnm_print(2, "%s() [%s:%d]: Untested Translation!\n", \
598  __FUNCTION__, __FILE__, __LINE__); \
599  } while(0)
600 
601 #define WARN_PARTTESTED \
602  do{ \
603  Vnm_print(2, "%s() [%s:%d]: Partially Tested Translation.\n", \
604  __FUNCTION__, __FILE__, __LINE__); \
605  } while(0)
606 #else
607 #define ANNOUNCE_FUNCTION
608 #define WARN_UNTESTED
609 #define WARN_PARTTESTED
610 #endif
611 
612 
613 
614 /* Utility messages. Print out messages with location information */
615 #ifdef DEBUG
616 #define VCHANNELEDMESSAGE0(channel, msg) \
617  do { \
618  Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
619  " %s\n\n", \
620  __FILE__, __LINE__, __FUNCTION__, msg); \
621  } while(0)
622 
623 #define VCHANNELEDMESSAGE1(channel, msg, arg) \
624  do { \
625  char buff[1000]; \
626  snprintf( buff, 1000, msg, arg ); \
627  Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
628  " %s\n\n", \
629  __FILE__, __LINE__, __FUNCTION__, buff); \
630  } while(0)
631 
632 #define VCHANNELEDMESSAGE2(channel, msg, arg0, arg1) \
633  do { \
634  char buff[1000]; \
635  snprintf( buff, 1000, msg, arg0, arg1 ); \
636  Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
637  " %s\n\n", \
638  __FILE__, __LINE__, __FUNCTION__, buff); \
639  } while(0)
640 
641 #define VCHANNELEDMESSAGE3(channel, msg, arg0, arg1, arg2) \
642  do { \
643  char buff[1000]; \
644  snprintf(buff, 1000, msg, arg0, arg1, arg2); \
645  Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
646  " %s\n\n", \
647  __FILE__, __LINE__, __FUNCTION__, buff); \
648  } while(0)
649 
650 #define VMESSAGE0(msg) VCHANNELEDMESSAGE0(2, msg)
651 #define VMESSAGE1(msg, arg0) VCHANNELEDMESSAGE1(2, msg, arg0)
652 #define VMESSAGE2(msg, arg0, arg1) VCHANNELEDMESSAGE2(2, msg, arg0, arg1)
653 #define VMESSAGE3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(2, msg, arg0, arg1, arg2)
654 
655 #define VERRMSG0(msg) VMESSAGE0(msg)
656 #define VERRMSG1(msg, arg0) VMESSAGE1(msg, arg0)
657 #define VERRMSG2(msg, arg0, arg1) VMESSAGE2(msg, arg0, arg1)
658 #define VERRMSG3(msg, arg0, arg1, arg2) VMESSAGE3(msg, arg0, arg1, arg2)
659 #else
660 #define VCHANNELEDMESSAGE0(channel, msg) \
661  do { \
662  Vnm_print(channel, "%s: %s\n", __FUNCTION__, msg); \
663  } while(0)
664 
665 #define VCHANNELEDMESSAGE1(channel, msg, arg0) \
666  do { \
667  char buff[1000]; \
668  snprintf( buff, 1000, msg, arg0 ); \
669  Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
670  } while(0)
671 
672 #define VCHANNELEDMESSAGE2(channel, msg, arg0, arg1) \
673  do { \
674  char buff[1000]; \
675  snprintf( buff, 1000, msg, arg0, arg1 ); \
676  Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
677  } while(0)
678 
679 #define VCHANNELEDMESSAGE3(channel, msg, arg0, arg1, arg2) \
680  do { \
681  char buff[1000]; \
682  snprintf(buff, 1000, msg, arg0, arg1, arg2); \
683  Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
684  } while(0)
685 
686 #define VMESSAGE0(msg) VCHANNELEDMESSAGE0(0, msg)
687 #define VMESSAGE1(msg, arg0) VCHANNELEDMESSAGE1(0, msg, arg0)
688 #define VMESSAGE2(msg, arg0, arg1) VCHANNELEDMESSAGE2(0, msg, arg0, arg1)
689 #define VMESSAGE3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(0, msg, arg0, arg1, arg2)
690 
691 #define VERRMSG0(msg) VCHANNELEDMESSAGE0(2, msg)
692 #define VERRMSG1(msg, arg0) VCHANNELEDMESSAGE1(2, msg, arg0)
693 #define VERRMSG2(msg, arg0, arg1) VCHANNELEDMESSAGE2(2, msg, arg0, arg1)
694 #define VERRMSG3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(2, msg, arg0, arg1, arg2)
695 #endif
696 
697 
698 
699 /* Utility assertions. If they fail, they print out messages with possible
700  * arguments and then abort
701  * The do{...} while(0) simply enforces that a semicolon appears at the end
702  */
703 #ifdef DEBUG
704 #define VASSERT_MSG0(cnd, msg) \
705  do { \
706  if( (cnd) == 0 ) { \
707  Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
708  " Assertion Failed (%s): %s\n\n", \
709  __FILE__, __LINE__, __FUNCTION__, #cnd, msg); \
710  abort(); \
711  } \
712  } while(0)
713 
714 #define VASSERT_MSG1(cnd, msg, arg) \
715  do { \
716  if( (cnd) == 0 ) { \
717  char buff[1000]; \
718  snprintf( buff, 1000, msg, arg ); \
719  Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
720  " Assertion Failed (%s): %s\n\n", \
721  __FILE__, __LINE__, __FUNCTION__, #cnd, buff); \
722  abort(); \
723  } \
724  } while(0)
725 
726 #define VASSERT_MSG2(cnd, msg, arg0, arg1) \
727  do { \
728  if( (cnd) == 0 ) { \
729  char buff[1000]; \
730  snprintf( buff, 1000, msg, arg0, arg1 ); \
731  Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
732  " Assertion Failed (%s): %s\n\n", \
733  __FILE__, __LINE__, __FUNCTION__, #cnd, buff); \
734  abort(); \
735  } \
736  } while(0)
737 #else
738 #define VASSERT_MSG0(cnd, msg) \
739  do { \
740  if( (cnd) == 0 ) { \
741  Vnm_print(2, "%[%s()]: ERROR:\n" \
742  " Assertion Failed (%s): %s\n\n", \
743  __FUNCTION__, #cnd, msg); \
744  abort(); \
745  } \
746  } while(0)
747 
748 #define VASSERT_MSG1(cnd, msg, arg) \
749  do { \
750  if( (cnd) == 0 ) { \
751  char buff[1000]; \
752  snprintf( buff, 1000, msg, arg ); \
753  Vnm_print(2, "[%s()]: ERROR:\n" \
754  " Assertion Failed (%s): %s\n\n", \
755  __FUNCTION__, #cnd, buff); \
756  abort(); \
757  } \
758  } while(0)
759 
760 #define VASSERT_MSG2(cnd, msg, arg0, arg1) \
761  do { \
762  if( (cnd) == 0 ) { \
763  char buff[1000]; \
764  snprintf( buff, 1000, msg, arg0, arg1 ); \
765  Vnm_print(2, "[%s()]: ERROR:\n" \
766  " Assertion Failed (%s): %s\n\n", \
767  __FUNCTION__, #cnd, buff); \
768  abort(); \
769  } \
770  } while(0)
771 #endif
772 
773 
774 
775 /* Utility warning. Tests a condition and if it fails prints out a message
776  * with optional arguments
777  * The do{...} while(0) simply enforces that a semicolon at the end
778  */
779 #ifdef DEBUG
780 #define VWARN_MSG0(cnd, msg) \
781  do { \
782  if( (cnd) == 0 ) { \
783  Vnm_print( \
784  2, \
785  "%s:%d [%s()]: WARNING:\n" \
786  " Condition Failed (%s):\n %s\n\n", \
787  __FILE__, \
788  __LINE__, \
789  __FUNCTION__, \
790  #cnd, \
791  msg \
792  ); \
793  } \
794  } while(0)
795 
796 #define VWARN_MSG1(cnd, msg, arg0) \
797  do { \
798  if( (cnd) == 0 ) { \
799  char buff[1000]; \
800  snprintf(buff, 1000, msg, arg0); \
801  Vnm_print( \
802  2, \
803  "%s:%d [%s()]: WARNING:\n" \
804  " Condition Failed (%s):\n %s\n\n", \
805  __FILE__, \
806  __LINE__, \
807  __FUNCTION__, \
808  #cnd, \
809  buff \
810  ); \
811  } \
812  } while(0)
813 
814 #define VWARN_MSG2(cnd, msg, arg0, arg1) \
815  do { \
816  if( (cnd) == 0 ) { \
817  char buff[1000]; \
818  snprintf(buff, 1000, msg, arg0, arg1); \
819  Vnm_print( \
820  2, \
821  "%s:%d [%s()]: WARNING:\n" \
822  " Condition Failed (%s):\n %s\n\n", \
823  __FILE__, \
824  __LINE__, \
825  __FUNCTION__, \
826  #cnd, \
827  buff \
828  ); \
829  } \
830  } while(0)
831 #else
832 #define VWARN_MSG0(cnd, msg) \
833  do { \
834  if( (cnd) == 0 ) { \
835  Vnm_print( \
836  2, \
837  "[%s()]: WARNING:\n" \
838  " %s\n\n", \
839  __FUNCTION__, \
840  msg \
841  ); \
842  } \
843  } while(0)
844 
845 #define VWARN_MSG1(cnd, msg, arg0) \
846  do { \
847  if( (cnd) == 0 ) { \
848  char buff[1000]; \
849  snprintf(buff, 1000, msg, arg0); \
850  Vnm_print( \
851  2, \
852  "[%s()]: WARNING:\n" \
853  " %s\n\n", \
854  __FUNCTION__, \
855  buff \
856  ); \
857  } \
858  } while(0)
859 
860 #define VWARN_MSG2(cnd, msg, arg0, arg1) \
861  do { \
862  if( (cnd) == 0 ) { \
863  char buff[1000]; \
864  snprintf(buff, 1000, msg, arg0, arg1); \
865  Vnm_print( \
866  2, \
867  "[%s()]: WARNING:\n" \
868  " %s\n\n", \
869  __FUNCTION__, \
870  buff \
871  ); \
872  } \
873  } while(0)
874 #endif
875 
876 /* Utility Abort. Prints a message with optional arugments and aborts */
877 #ifdef DEBUG
878 #define VABORT_MSG0(msg) \
879  do { \
880  Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
881  " %s\n\n", \
882  __FILE__, __LINE__, __FUNCTION__, msg); \
883  abort(); \
884  } while(0)
885 
886 #define VABORT_MSG1(msg, arg) \
887  do { \
888  char buff[1000]; \
889  snprintf( buff, 1000, msg, arg ); \
890  Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
891  " %s\n\n", \
892  __FILE__, __LINE__, __FUNCTION__, buff); \
893  abort(); \
894  } while(0)
895 
896 #define VABORT_MSG2(msg, arg0, arg1) \
897  do { \
898  char buff[1000]; \
899  snprintf( buff, 1000, msg, arg0, arg1); \
900  Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
901  " %s\n\n", \
902  __FILE__, __LINE__, __FUNCTION__, buff); \
903  abort(); \
904  } while(0)
905 #else
906 #define VABORT_MSG0(msg) \
907  do { \
908  Vnm_print(2, "%[%s()]: ABORTING:\n" \
909  " %s\n\n", \
910  __FUNCTION__, msg); \
911  abort(); \
912  } while(0)
913 
914 #define VABORT_MSG1(msg, arg) \
915  do { \
916  char buff[1000]; \
917  snprintf( buff, 1000, msg, arg ); \
918  Vnm_print(2, "[%s()]: ABORTING:\n" \
919  " %s\n\n", \
920  __FUNCTION__, buff); \
921  abort(); \
922  } while(0)
923 
924 #define VABORT_MSG2(msg, arg0, arg1) \
925  do { \
926  char buff[1000]; \
927  snprintf( buff, 1000, msg, arg0, arg1); \
928  Vnm_print(2, "[%s()]: ABORTING:\n" \
929  " %s\n\n", \
930  __FUNCTION__, buff); \
931  abort(); \
932  } while(0)
933 #endif
934 
935 
936 
937 /* Utility expression printers. Print the expression and its value */
938 #ifdef DEBUG
939 #define PRINT_INT(expr) \
940  do { \
941  Vnm_print(2, "%s:%d [%s()]: %s == %d\n", \
942  __FILE__, __LINE__, __FUNCTION__, #expr, expr); \
943  } while(0)
944 
945 #define PRINT_DBL(expr) \
946  do { \
947  Vnm_print(2, "%s:%d [%s()]: %s == %f\n\n", \
948  __FILE__, __LINE__, __FUNCTION__, #expr, expr); \
949  } while(0)
950 #else
951 #define PRINT_INT(expr)
952 #define PRINT_DBL(expr)
953 #endif
954 
955 #define VMALLOC(vmem, n, type) ((type*)Vmem_malloc(vmem, n, sizeof(type)))
956 
957 #define VFREE(vmem, n, type, ptr) (Vmem_free(vmem, n, sizeof(type), (void **)&(ptr)))
958 
959 #define VFILL(vec, n, val) \
960  do { \
961  int fill_idx; \
962  for (fill_idx = 0; fill_idx < n; fill_idx++) \
963  vec[fill_idx] = val; \
964  } while(0)
965 
966 #define VCOPY(srcvec, dstvec, i, n) \
967  do { \
968  for (i = 0; i < n; i++) \
969  dstvec[i] = srcvec[i]; \
970  } while(0)
971 
972 
973 char* wrap_text( char* str, int right_margin, int left_padding );
974 
975 #define VAT(array, i) ((array)[(i) - 1])
976 #define RAT(array, i) ((array) + i - 1)
977 
978 #endif /* #ifndef _VAPBSHAL_H_ */
enum eVchrg_Src Vchrg_Src
Declaration of the Vchrg_Src type as the Vchrg_Meth enum.
Definition: vhal.h:264
Definition: vhal.h:273
Definition: vhal.h:233
Definition: vhal.h:316
Definition: vhal.h:217
eVhal_PBEType
Version of PBE to solve.
Definition: vhal.h:141
enum eVdata_Format Vdata_Format
Declaration of the Vdata_Format type as the Vdata_Format enum.
Definition: vhal.h:324
enum eVoutput_Format Voutput_Format
Declaration of the Voutput_Format type as the VOutput_Format enum.
Definition: vhal.h:202
enum eVsurf_Meth Vsurf_Meth
Declaration of the Vsurf_Meth type as the Vsurf_Meth enum.
Definition: vhal.h:135
enum eVhal_IPKEYType Vhal_IPKEYType
Declaration of the Vhal_IPKEYType type as the Vhal_IPKEYType enum.
Definition: vhal.h:169
eVsurf_Meth
Types of molecular surface definitions.
Definition: vhal.h:104
Definition: vhal.h:211
Definition: vhal.h:315
enum eVbcfl Vbcfl
Declare Vbcfl type.
Definition: vhal.h:225
Definition: vhal.h:317
eVchrg_Src
Charge source.
Definition: vhal.h:253
enum eVhal_PBEType Vhal_PBEType
Declaration of the Vhal_PBEType type as the Vhal_PBEType enum.
Definition: vhal.h:153
Definition: vhal.h:143
Definition: vhal.h:279
eVdata_Format
Format of data for APBS I/O.
Definition: vhal.h:311
Definition: vhal.h:281
Definition: vhal.h:314
Definition: vhal.h:312
Definition: vhal.h:105
eVbcfl
Types of boundary conditions.
Definition: vhal.h:209
eVrc_Codes
Return code enumerations.
Definition: vhal.h:68
Definition: vhal.h:277
Definition: vhal.h:218
Definition: vhal.h:275
Definition: vhal.h:313
Definition: vhal.h:213
Definition: vhal.h:142
eVsol_Meth
Solution Method enumerations.
Definition: vhal.h:83
Definition: vhal.h:283
eVoutput_Format
Output file format.
Definition: vhal.h:193
enum eVdata_Type Vdata_Type
Declaration of the Vdata_Type type as the Vdata_Type enum.
Definition: vhal.h:304
eVhal_NONLINType
Type of nonlinear to use for MG methods.
Definition: vhal.h:175
enum eVhal_NONLINType Vhal_NONLINType
Declaration of the Vhal_NONLINType type as the Vhal_NONLINType enum.
Definition: vhal.h:187
eVchrg_Meth
Types of charge discretization methods.
Definition: vhal.h:232
eVhal_IPKEYType
Type of ipkey to use for MG methods.
Definition: vhal.h:159
enum eVchrg_Meth Vchrg_Meth
Declaration of the Vchrg_Meth type as the Vchrg_Meth enum.
Definition: vhal.h:246
eVdata_Type
Types of (scalar) data that can be written out of APBS.
Definition: vhal.h:271