--- trunk/OOPSE/libBASS/Globals.cpp 2003/08/12 19:56:49 689 +++ trunk/OOPSE/libBASS/Globals.cpp 2003/10/28 16:03:06 828 @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include "Globals.hpp" #include "simError.h" @@ -48,11 +48,18 @@ #define G_TAUBAROSTAT 27 #define G_ZCONSTIME 28 #define G_NZCONSTRAINTS 29 -#define G_ZCONSTOL 30 +#define G_ZCONSTOL 30 +#define G_ZCONSFORCEPOLICY 31 +#define G_SEED 32 +#define G_RESETTIME 33 +#define G_USEINITTIME 34 Globals::Globals(){ int i; + + hash_size = 23; + hash_shift = 4; components = NULL; @@ -76,6 +83,7 @@ Globals::Globals(){ addHash( "boxY", G_BOXY ); addHash( "boxZ", G_BOXZ ); addHash( "sampleTime", G_SAMPLETIME ); + addHash( "resetTime", G_RESETTIME ); addHash( "statusTime", G_STATUSTIME ); addHash( "electrostaticCutoffRadius", G_ECR ); addHash( "dielectric", G_DIELECTRIC ); @@ -90,13 +98,18 @@ Globals::Globals(){ addHash( "tauBarostat", G_TAUBAROSTAT); addHash( "zconsTime", G_ZCONSTIME); addHash( "nZconstraints", G_NZCONSTRAINTS); - addHash( "zconsTol", G_ZCONSTOL); + addHash( "zconsTol", G_ZCONSTOL); + addHash( "zconsForcePolicy", G_ZCONSFORCEPOLICY); + addHash( "seed", G_SEED); + addHash( "useInitTime", G_USEINITTIME), + // define some default values strcpy( mixingRule,"standard"); //default mixing rules to standard. usePBC = 1; //default periodic boundry conditions to on useRF = 0; + useInitTime = 1; // default to pull init time from the init file have_force_field = 0; have_n_components = 0; @@ -116,6 +129,7 @@ Globals::Globals(){ have_box_z = 0; have_sample_time = 0; have_status_time = 0; + have_reset_time = 0; have_thermal_time = 0; have_ecr = 0; have_dielectric = 0; @@ -129,9 +143,7 @@ Globals::Globals(){ have_n_zConstraints = 0; have_zConstraints = 0; have_zcons_tol = 0; - - - strcpy( initial_config, "./fooBar" ); + have_seed = 0; } @@ -718,8 +730,37 @@ int Globals::globalAssign( event* the_event ){ default: the_event->err_msg = strdup( "Global error. statusTime unrecognized.\n" ); + return 0; + break; + } + break; + + case G_RESETTIME: + switch( the_type ){ + + case STRING: + the_event->err_msg = + strdup( "Global error. resetTime is not a double or int.\n" ); return 0; break; + + case DOUBLE: + resetTime = the_event->evt.asmt.rhs.dval; + have_reset_time = 1; + return 1; + break; + + case INT: + resetTime = (double)the_event->evt.asmt.rhs.ival; + have_reset_time = 1; + return 1; + break; + + default: + the_event->err_msg = + strdup( "Global error. resetTime unrecognized.\n" ); + return 0; + break; } break; @@ -857,7 +898,25 @@ int Globals::globalAssign( event* the_event ){ strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); return 0; break; + + case G_USEINITTIME: + if( the_type == STRING ){ + + if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1; + else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0; + else{ + the_event->err_msg = + strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); + return 0; + } + return 1; + } + the_event->err_msg = + strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); + return 0; + break; + case G_USEPBC: if( the_type == STRING ){ @@ -1039,8 +1098,70 @@ int Globals::globalAssign( event* the_event ){ } break; + case G_ZCONSFORCEPOLICY: + switch( the_type ){ + + case STRING: + strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); + for(int i = 0; zconsForcePolicy[i] != '\0'; i++) + { + zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); + } + have_zcons_force_policy = 1; + return 1; + break; + + case DOUBLE: + the_event->err_msg = + strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); + return 0; + break; + + case INT: + the_event->err_msg = + strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); + return 0; + break; + + default: + the_event->err_msg = + strdup( "Global error. zconsForcePolicy unrecognized.\n" ); + return 0; + break; + } + break; // add more token cases here. + case G_SEED: + switch( the_type ){ + + case STRING: + the_event->err_msg = + strdup( "Global error. seed is not a string.\n" ); + return 0; + return 0; + break; + + case DOUBLE: + have_seed = 1; + seed = (int)the_event->evt.asmt.rhs.dval; + return 1; + break; + + case INT: + have_seed = 1; + seed = the_event->evt.asmt.rhs.ival ; + return 1; + break; + + default: + the_event->err_msg = + strdup( "Global error. seed unrecognized.\n" ); + return 0; + break; + } + break; + // add more token cases here. } }