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 |
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(){ |
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 |
|
|
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; |
102 |
|
have_rrf = 0; |
103 |
|
have_dielectric = 0; |
104 |
|
have_tempSet = 0; |
105 |
< |
} |
105 |
> |
} |
106 |
|
|
107 |
|
Globals::~Globals(){ |
108 |
|
int i; |
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 |
+ |
|
296 |
|
case G_DT: |
297 |
|
switch( the_type ){ |
298 |
|
|
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 |
|
|
838 |
|
"There has been an overflow error in the Globals' hash key."); |
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; |