# | Line 3 | Line 3 | |
---|---|---|
3 | #include <cstring> | |
4 | ||
5 | #include "Globals.hpp" | |
6 | + | #include "simError.h" |
7 | + | #ifdef IS_MPI |
8 | + | #include "mpiBASS.h" |
9 | + | #endif // is_mpi |
10 | ||
11 | /* | |
12 | * The following section lists all of the defined tokens for the | |
# | Line 35 | Line 39 | |
39 | #define G_DIELECTRIC 18 | |
40 | #define G_TEMPSET 19 | |
41 | #define G_THERMALTIME 20 | |
42 | + | #define G_USEPBC 21 |
43 | + | #define G_MIXINGRULE 22 |
44 | ||
45 | ||
46 | Globals::Globals(){ | |
# | Line 50 | Line 56 | Globals::Globals(){ | |
56 | addHash( "nComponents", G_NCOMPONENTS ); | |
57 | addHash( "targetTemp", G_TARGETTEMP ); | |
58 | addHash( "ensemble", G_ENSEMBLE ); | |
59 | + | |
60 | addHash( "dt", G_DT ); | |
61 | addHash( "runTime", G_RUNTIME ); | |
62 | ||
# | Line 67 | Line 74 | Globals::Globals(){ | |
74 | addHash( "dielectric", G_DIELECTRIC ); | |
75 | addHash( "tempSet", G_TEMPSET ); | |
76 | addHash( "thermalTime", G_THERMALTIME ); | |
77 | + | addHash("mixingRule", G_MIXINGRULE); |
78 | + | mixingRule = "standard"; //default mixing rules to standard. |
79 | + | addHash("periodicBoundryConditions", G_USEPBC); |
80 | + | usePBC = 1; //default periodic boundry conditions to on |
81 | + | |
82 | ||
83 | have_force_field = 0; | |
84 | have_n_components = 0; | |
# | Line 90 | Line 102 | Globals::Globals(){ | |
102 | have_rrf = 0; | |
103 | have_dielectric = 0; | |
104 | have_tempSet = 0; | |
105 | < | } |
105 | > | } |
106 | ||
107 | Globals::~Globals(){ | |
108 | int i; | |
# | Line 267 | Line 279 | int Globals::globalAssign( event* the_event ){ | |
279 | ||
280 | the_event->err_msg = | |
281 | strdup( "Global error. ensemble was not assigned to a string\n" ); | |
282 | + | return 0; |
283 | + | break; |
284 | + | |
285 | + | case G_MIXINGRULE: |
286 | + | if( the_type == STRING ){ |
287 | + | strcpy( mixingRule, the_event->evt.asmt.rhs.sval ); |
288 | + | return 1; |
289 | + | } |
290 | + | |
291 | + | the_event->err_msg = |
292 | + | strdup( "Global error. mixing rule was not assigned to a string\n" ); |
293 | return 0; | |
294 | break; | |
295 | ||
# | Line 689 | Line 712 | int Globals::globalAssign( event* the_event ){ | |
712 | strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); | |
713 | return 0; | |
714 | break; | |
715 | + | |
716 | + | case G_USEPBC: |
717 | + | if( the_type == STRING ){ |
718 | + | |
719 | + | if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
720 | + | else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
721 | + | else{ |
722 | + | the_event->err_msg = |
723 | + | strdup( "Global error. periodicBoundryConditions was not \"true\" or \"false\".\n" ); |
724 | + | return 0; |
725 | + | } |
726 | + | return 1; |
727 | + | } |
728 | + | |
729 | + | the_event->err_msg = |
730 | + | strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
731 | + | return 0; |
732 | + | break; |
733 | } | |
734 | } | |
735 | ||
# | Line 793 | Line 834 | int Globals::hash( char* text ){ | |
834 | ||
835 | // if the key is less than zero, we've had an overflow error | |
836 | ||
837 | < | fprintf( stderr, |
837 | > | sprintf( painCave.errMsg, |
838 | "There has been an overflow error in the Globals' hash key."); | |
839 | < | exit(0); |
839 | > | painCave.isFatal = 1; |
840 | > | simError(); |
841 | > | #ifdef IS_MPI |
842 | > | if( painCave.isEventLoop ){ |
843 | > | if( worldRank == 0 ) mpiInterfaceExit(); |
844 | > | } |
845 | > | #endif //is_mpi |
846 | } | |
847 | ||
848 | return key; | |
# | Line 812 | Line 859 | void Globals::addHash( char* text, int token ){ | |
859 | key = hash( text ); | |
860 | the_element->setNext( command_table[key] ); | |
861 | command_table[key] = the_element; | |
862 | < | }; |
862 | > | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |