| 1 |
< |
#include <cstdlib> |
| 2 |
< |
#include <cstdio> |
| 3 |
< |
#include <cstring> |
| 1 |
> |
#include <stdlib.h> |
| 2 |
> |
#include <stdio.h> |
| 3 |
> |
#include <string.h> |
| 4 |
|
|
| 5 |
|
#include "Globals.hpp" |
| 6 |
|
#include "simError.h" |
| 17 |
|
*/ |
| 18 |
|
|
| 19 |
|
//required parameters |
| 20 |
< |
#define G_FORCEFIELD 1 |
| 21 |
< |
#define G_NCOMPONENTS 2 |
| 22 |
< |
#define G_TARGETTEMP 3 |
| 23 |
< |
#define G_ENSEMBLE 4 |
| 24 |
< |
#define G_DT 5 |
| 25 |
< |
#define G_RUNTIME 6 |
| 20 |
> |
#define G_FORCEFIELD 1 |
| 21 |
> |
#define G_NCOMPONENTS 2 |
| 22 |
> |
#define G_TARGETTEMP 3 |
| 23 |
> |
#define G_ENSEMBLE 4 |
| 24 |
> |
#define G_DT 5 |
| 25 |
> |
#define G_RUNTIME 6 |
| 26 |
|
|
| 27 |
|
//optional parameters |
| 28 |
< |
#define G_INITIALCONFIG 7 |
| 29 |
< |
#define G_FINALCONFIG 8 |
| 30 |
< |
#define G_NMOL 9 |
| 31 |
< |
#define G_DENSITY 10 |
| 32 |
< |
#define G_BOX 11 |
| 33 |
< |
#define G_BOXX 12 |
| 34 |
< |
#define G_BOXY 13 |
| 35 |
< |
#define G_BOXZ 14 |
| 36 |
< |
#define G_SAMPLETIME 15 |
| 37 |
< |
#define G_STATUSTIME 16 |
| 38 |
< |
#define G_RRF 17 |
| 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 |
| 28 |
> |
#define G_INITIALCONFIG 7 |
| 29 |
> |
#define G_FINALCONFIG 8 |
| 30 |
> |
#define G_NMOL 9 |
| 31 |
> |
#define G_DENSITY 10 |
| 32 |
> |
#define G_BOX 11 |
| 33 |
> |
#define G_BOXX 12 |
| 34 |
> |
#define G_BOXY 13 |
| 35 |
> |
#define G_BOXZ 14 |
| 36 |
> |
#define G_SAMPLETIME 15 |
| 37 |
> |
#define G_STATUSTIME 16 |
| 38 |
> |
#define G_ECR 17 |
| 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 |
> |
#define G_EST 23 |
| 45 |
> |
#define G_USERF 24 |
| 46 |
> |
#define G_TARGETPRESSURE 25 |
| 47 |
> |
#define G_TAUTHERMOSTAT 26 |
| 48 |
> |
#define G_TAUBAROSTAT 27 |
| 49 |
> |
#define G_ZCONSTIME 28 |
| 50 |
> |
#define G_NZCONSTRAINTS 29 |
| 51 |
> |
#define G_ZCONSTOL 30 |
| 52 |
> |
#define G_ZCONSFORCEPOLICY 31 |
| 53 |
> |
#define G_SEED 32 |
| 54 |
> |
#define G_RESETTIME 33 |
| 55 |
> |
#define G_USEINITTIME 34 |
| 56 |
> |
#define G_USEINIT_XS_STATE 35 |
| 57 |
> |
#define G_ORTHOBOXTOLERANCE 36 |
| 58 |
> |
#define G_LJRCUT 37 |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
Globals::Globals(){ |
| 62 |
|
|
| 63 |
|
int i; |
| 64 |
+ |
|
| 65 |
+ |
hash_size = 23; |
| 66 |
+ |
hash_shift = 4; |
| 67 |
|
|
| 68 |
|
components = NULL; |
| 69 |
|
|
| 87 |
|
addHash( "boxY", G_BOXY ); |
| 88 |
|
addHash( "boxZ", G_BOXZ ); |
| 89 |
|
addHash( "sampleTime", G_SAMPLETIME ); |
| 90 |
+ |
addHash( "resetTime", G_RESETTIME ); |
| 91 |
|
addHash( "statusTime", G_STATUSTIME ); |
| 92 |
< |
addHash( "rRF", G_RRF ); |
| 92 |
> |
addHash( "electrostaticCutoffRadius", G_ECR ); |
| 93 |
|
addHash( "dielectric", G_DIELECTRIC ); |
| 94 |
|
addHash( "tempSet", G_TEMPSET ); |
| 95 |
|
addHash( "thermalTime", G_THERMALTIME ); |
| 96 |
|
addHash( "mixingRule", G_MIXINGRULE); |
| 97 |
< |
addHash( "periodicBox", G_USEPBC); |
| 98 |
< |
|
| 97 |
> |
addHash( "usePeriodicBoundaryConditions", G_USEPBC); |
| 98 |
> |
addHash( "electrostaticSkinThickness", G_EST ); |
| 99 |
> |
addHash( "useReactionField", G_USERF ); |
| 100 |
> |
addHash( "targetPressure", G_TARGETPRESSURE); |
| 101 |
> |
addHash( "tauThermostat", G_TAUTHERMOSTAT); |
| 102 |
> |
addHash( "tauBarostat", G_TAUBAROSTAT); |
| 103 |
> |
addHash( "zconsTime", G_ZCONSTIME); |
| 104 |
> |
addHash( "nZconstraints", G_NZCONSTRAINTS); |
| 105 |
> |
addHash( "zconsTol", G_ZCONSTOL); |
| 106 |
> |
addHash( "zconsForcePolicy", G_ZCONSFORCEPOLICY); |
| 107 |
> |
addHash( "seed", G_SEED); |
| 108 |
> |
addHash( "useInitialTime", G_USEINITTIME); |
| 109 |
> |
addHash( "useInitialExtendedSystemState", G_USEINIT_XS_STATE); |
| 110 |
> |
addHash( "orthoBoxTolerance", G_ORTHOBOXTOLERANCE); |
| 111 |
> |
addHash( "LJrcut", G_LJRCUT); |
| 112 |
> |
|
| 113 |
> |
|
| 114 |
|
// define some default values |
| 115 |
|
|
| 116 |
|
strcpy( mixingRule,"standard"); //default mixing rules to standard. |
| 117 |
|
usePBC = 1; //default periodic boundry conditions to on |
| 118 |
< |
|
| 118 |
> |
useRF = 0; |
| 119 |
> |
useInitTime = 1; // default to pull init time from the init file |
| 120 |
> |
useInitXSstate = 1; // default to pull the extended state from the init file |
| 121 |
> |
orthoBoxTolerance = 1E-6; |
| 122 |
|
|
| 123 |
|
have_force_field = 0; |
| 124 |
|
have_n_components = 0; |
| 138 |
|
have_box_z = 0; |
| 139 |
|
have_sample_time = 0; |
| 140 |
|
have_status_time = 0; |
| 141 |
+ |
have_reset_time = 0; |
| 142 |
|
have_thermal_time = 0; |
| 143 |
< |
have_rrf = 0; |
| 143 |
> |
have_ecr = 0; |
| 144 |
|
have_dielectric = 0; |
| 145 |
|
have_tempSet = 0; |
| 146 |
< |
} |
| 146 |
> |
have_est = 0; |
| 147 |
> |
have_target_pressure =0; |
| 148 |
> |
have_q_mass = 0; |
| 149 |
> |
have_tau_thermostat = 0; |
| 150 |
> |
have_tau_barostat = 0; |
| 151 |
> |
have_zcons_time = 0; |
| 152 |
> |
have_n_zConstraints = 0; |
| 153 |
> |
have_zConstraints = 0; |
| 154 |
> |
have_zcons_tol = 0; |
| 155 |
> |
have_seed = 0; |
| 156 |
> |
have_ljrcut = 0; |
| 157 |
|
|
| 158 |
+ |
} |
| 159 |
+ |
|
| 160 |
|
Globals::~Globals(){ |
| 161 |
|
int i; |
| 162 |
|
|
| 229 |
|
return 0; |
| 230 |
|
} |
| 231 |
|
|
| 232 |
< |
int Globals::componentStartIndex( event* the_event ){ |
| 232 |
> |
int Globals::componentEnd( event* the_event ){ |
| 233 |
|
|
| 234 |
< |
current_component->startIndex( the_event->evt.si.array, |
| 235 |
< |
the_event->evt.si.n_elements ); |
| 234 |
> |
the_event->err_msg = current_component->checkMe(); |
| 235 |
> |
if( the_event->err_msg != NULL ) return 0; |
| 236 |
> |
|
| 237 |
|
return 1; |
| 238 |
|
} |
| 239 |
|
|
| 240 |
< |
int Globals::componentEnd( event* the_event ){ |
| 240 |
> |
int Globals::newZconstraint( event* the_event ){ |
| 241 |
> |
|
| 242 |
|
|
| 243 |
< |
the_event->err_msg = current_component->checkMe(); |
| 243 |
> |
int index = the_event->evt.blk_index; |
| 244 |
> |
char err[200]; |
| 245 |
> |
current_zConstraint = new ZconStamp( index ); |
| 246 |
> |
|
| 247 |
> |
have_zConstraints = 1; |
| 248 |
> |
|
| 249 |
> |
if( have_n_zConstraints && index < n_zConstraints ) |
| 250 |
> |
zConstraints[index] = current_zConstraint; |
| 251 |
> |
else{ |
| 252 |
> |
if( have_n_zConstraints ){ |
| 253 |
> |
sprintf( err, "Globals error, %d out of nZconstraints range", |
| 254 |
> |
index ); |
| 255 |
> |
the_event->err_msg = strdup( err ); |
| 256 |
> |
return 0; |
| 257 |
> |
} |
| 258 |
> |
else{ |
| 259 |
> |
the_event->err_msg = strdup("Globals error, nZconstraints" |
| 260 |
> |
" not given before" |
| 261 |
> |
" first zConstraint declaration." ); |
| 262 |
> |
return 0; |
| 263 |
> |
} |
| 264 |
> |
} |
| 265 |
> |
|
| 266 |
> |
return 1; |
| 267 |
> |
} |
| 268 |
> |
|
| 269 |
> |
|
| 270 |
> |
|
| 271 |
> |
int Globals::zConstraintAssign( event* the_event ){ |
| 272 |
> |
|
| 273 |
> |
switch( the_event->evt.asmt.asmt_type ){ |
| 274 |
> |
|
| 275 |
> |
case STRING: |
| 276 |
> |
return current_zConstraint->assignString( the_event->evt.asmt.lhs, |
| 277 |
> |
the_event->evt.asmt.rhs.sval, |
| 278 |
> |
&(the_event->err_msg)); |
| 279 |
> |
break; |
| 280 |
> |
|
| 281 |
> |
case DOUBLE: |
| 282 |
> |
return current_zConstraint->assignDouble( the_event->evt.asmt.lhs, |
| 283 |
> |
the_event->evt.asmt.rhs.dval, |
| 284 |
> |
&(the_event->err_msg)); |
| 285 |
> |
break; |
| 286 |
> |
|
| 287 |
> |
case INT: |
| 288 |
> |
return current_zConstraint->assignInt( the_event->evt.asmt.lhs, |
| 289 |
> |
the_event->evt.asmt.rhs.ival, |
| 290 |
> |
&(the_event->err_msg)); |
| 291 |
> |
break; |
| 292 |
> |
|
| 293 |
> |
default: |
| 294 |
> |
the_event->err_msg = strdup( "Globals error. Invalid zConstraint" |
| 295 |
> |
" assignment type" ); |
| 296 |
> |
return 0; |
| 297 |
> |
break; |
| 298 |
> |
} |
| 299 |
> |
return 0; |
| 300 |
> |
} |
| 301 |
> |
|
| 302 |
> |
int Globals::zConstraintEnd( event* the_event ){ |
| 303 |
> |
|
| 304 |
> |
the_event->err_msg = current_zConstraint->checkMe(); |
| 305 |
|
if( the_event->err_msg != NULL ) return 0; |
| 306 |
|
|
| 307 |
|
return 1; |
| 356 |
|
return 1; |
| 357 |
|
} |
| 358 |
|
break; |
| 359 |
+ |
|
| 360 |
+ |
case G_NZCONSTRAINTS: |
| 361 |
+ |
if( the_type == STRING ){ |
| 362 |
+ |
the_event->err_msg = |
| 363 |
+ |
strdup("Global error. nZconstraints is not a double or an int.\n" ); |
| 364 |
+ |
return 0; |
| 365 |
+ |
} |
| 366 |
|
|
| 367 |
+ |
else if( the_type == DOUBLE ){ |
| 368 |
+ |
n_zConstraints = (int)the_event->evt.asmt.rhs.dval; |
| 369 |
+ |
zConstraints = new ZconStamp*[n_zConstraints]; |
| 370 |
+ |
have_n_zConstraints = 1; |
| 371 |
+ |
return 1; |
| 372 |
+ |
} |
| 373 |
+ |
|
| 374 |
+ |
else{ |
| 375 |
+ |
n_zConstraints = the_event->evt.asmt.rhs.ival; |
| 376 |
+ |
zConstraints = new ZconStamp*[n_zConstraints]; |
| 377 |
+ |
have_n_zConstraints = 1; |
| 378 |
+ |
return 1; |
| 379 |
+ |
} |
| 380 |
+ |
break; |
| 381 |
+ |
|
| 382 |
|
case G_TARGETTEMP: |
| 383 |
|
switch( the_type ){ |
| 384 |
|
|
| 403 |
|
default: |
| 404 |
|
the_event->err_msg = |
| 405 |
|
strdup( "Global error. targetTemp unrecognized.\n" ); |
| 406 |
+ |
return 0; |
| 407 |
+ |
break; |
| 408 |
+ |
} |
| 409 |
+ |
break; |
| 410 |
+ |
|
| 411 |
+ |
case G_ORTHOBOXTOLERANCE: |
| 412 |
+ |
switch( the_type ){ |
| 413 |
+ |
|
| 414 |
+ |
case STRING: |
| 415 |
+ |
the_event->err_msg = |
| 416 |
+ |
strdup( "Global error. orthoBoxTolerance is not a double or int.\n" ); |
| 417 |
+ |
return 0; |
| 418 |
+ |
break; |
| 419 |
+ |
|
| 420 |
+ |
case DOUBLE: |
| 421 |
+ |
orthoBoxTolerance = the_event->evt.asmt.rhs.dval; |
| 422 |
+ |
have_target_temp = 1; |
| 423 |
+ |
return 1; |
| 424 |
+ |
break; |
| 425 |
+ |
|
| 426 |
+ |
case INT: |
| 427 |
+ |
orthoBoxTolerance = (double)the_event->evt.asmt.rhs.ival; |
| 428 |
+ |
have_target_temp = 1; |
| 429 |
+ |
return 1; |
| 430 |
+ |
break; |
| 431 |
+ |
|
| 432 |
+ |
default: |
| 433 |
+ |
the_event->err_msg = |
| 434 |
+ |
strdup( "Global error.orthoBoxTolerance unrecognized.\n" ); |
| 435 |
|
return 0; |
| 436 |
|
break; |
| 437 |
|
} |
| 774 |
|
} |
| 775 |
|
break; |
| 776 |
|
|
| 777 |
< |
case G_THERMALTIME: |
| 777 |
> |
case G_RESETTIME: |
| 778 |
> |
switch( the_type ){ |
| 779 |
> |
|
| 780 |
> |
case STRING: |
| 781 |
> |
the_event->err_msg = |
| 782 |
> |
strdup( "Global error. resetTime is not a double or int.\n" ); |
| 783 |
> |
return 0; |
| 784 |
> |
break; |
| 785 |
> |
|
| 786 |
> |
case DOUBLE: |
| 787 |
> |
resetTime = the_event->evt.asmt.rhs.dval; |
| 788 |
> |
have_reset_time = 1; |
| 789 |
> |
return 1; |
| 790 |
> |
break; |
| 791 |
> |
|
| 792 |
> |
case INT: |
| 793 |
> |
resetTime = (double)the_event->evt.asmt.rhs.ival; |
| 794 |
> |
have_reset_time = 1; |
| 795 |
> |
return 1; |
| 796 |
> |
break; |
| 797 |
> |
|
| 798 |
> |
default: |
| 799 |
> |
the_event->err_msg = |
| 800 |
> |
strdup( "Global error. resetTime unrecognized.\n" ); |
| 801 |
> |
return 0; |
| 802 |
> |
break; |
| 803 |
> |
} |
| 804 |
> |
break; |
| 805 |
> |
|
| 806 |
> |
case G_THERMALTIME: |
| 807 |
|
switch( the_type ){ |
| 808 |
|
|
| 809 |
|
case STRING: |
| 827 |
|
default: |
| 828 |
|
the_event->err_msg = |
| 829 |
|
strdup( "Global error. thermalTime unrecognized.\n" ); |
| 830 |
+ |
return 0; |
| 831 |
+ |
break; |
| 832 |
+ |
} |
| 833 |
+ |
break; |
| 834 |
+ |
|
| 835 |
+ |
case G_LJRCUT: |
| 836 |
+ |
switch( the_type ){ |
| 837 |
+ |
|
| 838 |
+ |
case STRING: |
| 839 |
+ |
the_event->err_msg = |
| 840 |
+ |
strdup( "Global error. LJrcut is not a double or int.\n" ); |
| 841 |
|
return 0; |
| 842 |
|
break; |
| 843 |
+ |
|
| 844 |
+ |
case DOUBLE: |
| 845 |
+ |
LJrcut = the_event->evt.asmt.rhs.dval; |
| 846 |
+ |
have_ljrcut = 1; |
| 847 |
+ |
return 1; |
| 848 |
+ |
break; |
| 849 |
+ |
|
| 850 |
+ |
case INT: |
| 851 |
+ |
LJrcut = (double)the_event->evt.asmt.rhs.ival; |
| 852 |
+ |
have_ljrcut = 1; |
| 853 |
+ |
return 1; |
| 854 |
+ |
break; |
| 855 |
+ |
|
| 856 |
+ |
default: |
| 857 |
+ |
the_event->err_msg = |
| 858 |
+ |
strdup( "Global error. LJrcut unrecognized.\n" ); |
| 859 |
+ |
return 0; |
| 860 |
+ |
break; |
| 861 |
|
} |
| 862 |
|
break; |
| 863 |
|
|
| 864 |
< |
case G_RRF: |
| 864 |
> |
case G_ECR: |
| 865 |
|
switch( the_type ){ |
| 866 |
|
|
| 867 |
|
case STRING: |
| 868 |
|
the_event->err_msg = |
| 869 |
< |
strdup( "Global error. rRF is not a double or int.\n" ); |
| 869 |
> |
strdup( "Global error. electrostaticCutoffRadius is not a double or int.\n" ); |
| 870 |
|
return 0; |
| 871 |
|
break; |
| 872 |
|
|
| 873 |
|
case DOUBLE: |
| 874 |
< |
rRF = the_event->evt.asmt.rhs.dval; |
| 875 |
< |
have_rrf = 1; |
| 874 |
> |
ecr = the_event->evt.asmt.rhs.dval; |
| 875 |
> |
have_ecr = 1; |
| 876 |
|
return 1; |
| 877 |
|
break; |
| 878 |
|
|
| 879 |
|
case INT: |
| 880 |
< |
rRF = (double)the_event->evt.asmt.rhs.ival; |
| 881 |
< |
have_rrf = 1; |
| 880 |
> |
ecr = (double)the_event->evt.asmt.rhs.ival; |
| 881 |
> |
have_ecr = 1; |
| 882 |
|
return 1; |
| 883 |
|
break; |
| 884 |
|
|
| 885 |
|
default: |
| 886 |
|
the_event->err_msg = |
| 887 |
< |
strdup( "Global error. rRF unrecognized.\n" ); |
| 887 |
> |
strdup( "Global error. electrostaticCutoffRadius unrecognized.\n" ); |
| 888 |
|
return 0; |
| 889 |
|
break; |
| 890 |
|
} |
| 891 |
|
break; |
| 892 |
+ |
|
| 893 |
+ |
case G_EST: |
| 894 |
+ |
switch( the_type ){ |
| 895 |
+ |
|
| 896 |
+ |
case STRING: |
| 897 |
+ |
the_event->err_msg = |
| 898 |
+ |
strdup( "Global error. electrostaticSkinThickness is not a double or int.\n" ); |
| 899 |
+ |
return 0; |
| 900 |
+ |
break; |
| 901 |
+ |
|
| 902 |
+ |
case DOUBLE: |
| 903 |
+ |
est = the_event->evt.asmt.rhs.dval; |
| 904 |
+ |
have_est = 1; |
| 905 |
+ |
return 1; |
| 906 |
+ |
break; |
| 907 |
+ |
|
| 908 |
+ |
case INT: |
| 909 |
+ |
est = (double)the_event->evt.asmt.rhs.ival; |
| 910 |
+ |
have_est = 1; |
| 911 |
+ |
return 1; |
| 912 |
+ |
break; |
| 913 |
+ |
|
| 914 |
+ |
default: |
| 915 |
+ |
the_event->err_msg = |
| 916 |
+ |
strdup( "Global error. electrostaticSkinThickness unrecognized.\n" ); |
| 917 |
+ |
return 0; |
| 918 |
+ |
break; |
| 919 |
+ |
} |
| 920 |
+ |
break; |
| 921 |
|
|
| 922 |
|
case G_DIELECTRIC: |
| 923 |
|
switch( the_type ){ |
| 951 |
|
case G_TEMPSET: |
| 952 |
|
if( the_type == STRING ){ |
| 953 |
|
|
| 954 |
< |
if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) tempSet = 1; |
| 955 |
< |
else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) tempSet = 0; |
| 954 |
> |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) tempSet = 1; |
| 955 |
> |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) tempSet = 0; |
| 956 |
|
else{ |
| 957 |
|
the_event->err_msg = |
| 958 |
|
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
| 966 |
|
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
| 967 |
|
return 0; |
| 968 |
|
break; |
| 969 |
+ |
|
| 970 |
+ |
case G_USEINITTIME: |
| 971 |
+ |
if( the_type == STRING ){ |
| 972 |
+ |
|
| 973 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1; |
| 974 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0; |
| 975 |
+ |
else{ |
| 976 |
+ |
the_event->err_msg = |
| 977 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
| 978 |
+ |
return 0; |
| 979 |
+ |
} |
| 980 |
+ |
return 1; |
| 981 |
+ |
} |
| 982 |
|
|
| 983 |
+ |
the_event->err_msg = |
| 984 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
| 985 |
+ |
return 0; |
| 986 |
+ |
break; |
| 987 |
+ |
|
| 988 |
+ |
case G_USEINIT_XS_STATE: |
| 989 |
+ |
if( the_type == STRING ){ |
| 990 |
+ |
|
| 991 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) |
| 992 |
+ |
useInitXSstate = 1; |
| 993 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) |
| 994 |
+ |
useInitXSstate = 0; |
| 995 |
+ |
else{ |
| 996 |
+ |
the_event->err_msg = |
| 997 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
| 998 |
+ |
return 0; |
| 999 |
+ |
} |
| 1000 |
+ |
return 1; |
| 1001 |
+ |
} |
| 1002 |
+ |
|
| 1003 |
+ |
the_event->err_msg = |
| 1004 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
| 1005 |
+ |
return 0; |
| 1006 |
+ |
break; |
| 1007 |
+ |
|
| 1008 |
|
case G_USEPBC: |
| 1009 |
|
if( the_type == STRING ){ |
| 1010 |
|
|
| 1011 |
< |
if( !strcmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
| 1012 |
< |
else if( !strcmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
| 1011 |
> |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
| 1012 |
> |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
| 1013 |
|
else{ |
| 1014 |
|
the_event->err_msg = |
| 1015 |
< |
strdup( "Global error. periodicBoundryConditions was not \"true\" or \"false\".\n" ); |
| 1015 |
> |
strdup( "Global error. usePeriodicBoundaryConditions was not \"true\" or \"false\".\n" ); |
| 1016 |
|
return 0; |
| 1017 |
|
} |
| 1018 |
|
return 1; |
| 1019 |
|
} |
| 1020 |
|
|
| 1021 |
|
the_event->err_msg = |
| 1022 |
< |
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
| 1022 |
> |
strdup( "Global error. usePeriodicBoundaryConditions was not \"true\" or \"false\".\n" ); |
| 1023 |
|
return 0; |
| 1024 |
+ |
break; |
| 1025 |
+ |
|
| 1026 |
+ |
case G_USERF: |
| 1027 |
+ |
if( the_type == STRING ){ |
| 1028 |
+ |
|
| 1029 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useRF = 1; |
| 1030 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useRF = 0; |
| 1031 |
+ |
else{ |
| 1032 |
+ |
the_event->err_msg = |
| 1033 |
+ |
strdup( "Global error. useReactionField was not \"true\" or \"false\".\n" ); |
| 1034 |
+ |
return 0; |
| 1035 |
+ |
} |
| 1036 |
+ |
return 1; |
| 1037 |
+ |
} |
| 1038 |
+ |
|
| 1039 |
+ |
the_event->err_msg = |
| 1040 |
+ |
strdup( "Global error. useReactionField was not \"true\" or \"false\".\n" ); |
| 1041 |
+ |
return 0; |
| 1042 |
+ |
break; |
| 1043 |
+ |
|
| 1044 |
+ |
case G_TARGETPRESSURE: |
| 1045 |
+ |
switch( the_type ){ |
| 1046 |
+ |
|
| 1047 |
+ |
case STRING: |
| 1048 |
+ |
the_event->err_msg = |
| 1049 |
+ |
strdup( "Global error. targetPressure is not a double or int.\n" ); |
| 1050 |
+ |
return 0; |
| 1051 |
+ |
break; |
| 1052 |
+ |
|
| 1053 |
+ |
case DOUBLE: |
| 1054 |
+ |
target_pressure = the_event->evt.asmt.rhs.dval; |
| 1055 |
+ |
have_target_pressure = 1; |
| 1056 |
+ |
return 1; |
| 1057 |
+ |
break; |
| 1058 |
+ |
|
| 1059 |
+ |
case INT: |
| 1060 |
+ |
target_pressure = (double)the_event->evt.asmt.rhs.ival; |
| 1061 |
+ |
have_target_pressure = 1; |
| 1062 |
+ |
return 1; |
| 1063 |
+ |
break; |
| 1064 |
+ |
|
| 1065 |
+ |
default: |
| 1066 |
+ |
the_event->err_msg = |
| 1067 |
+ |
strdup( "Global error. targetPressure unrecognized.\n" ); |
| 1068 |
+ |
return 0; |
| 1069 |
+ |
break; |
| 1070 |
+ |
} |
| 1071 |
+ |
break; |
| 1072 |
+ |
|
| 1073 |
+ |
case G_TAUTHERMOSTAT: |
| 1074 |
+ |
switch( the_type ){ |
| 1075 |
+ |
|
| 1076 |
+ |
case STRING: |
| 1077 |
+ |
the_event->err_msg = |
| 1078 |
+ |
strdup( "Global error. tauThermostat is not a double or int.\n" ); |
| 1079 |
+ |
return 0; |
| 1080 |
+ |
break; |
| 1081 |
+ |
|
| 1082 |
+ |
case DOUBLE: |
| 1083 |
+ |
tau_thermostat = the_event->evt.asmt.rhs.dval; |
| 1084 |
+ |
have_tau_thermostat = 1; |
| 1085 |
+ |
return 1; |
| 1086 |
+ |
break; |
| 1087 |
+ |
|
| 1088 |
+ |
case INT: |
| 1089 |
+ |
tau_thermostat = (double)the_event->evt.asmt.rhs.ival; |
| 1090 |
+ |
have_tau_thermostat = 1; |
| 1091 |
+ |
return 1; |
| 1092 |
+ |
break; |
| 1093 |
+ |
|
| 1094 |
+ |
default: |
| 1095 |
+ |
the_event->err_msg = |
| 1096 |
+ |
strdup( "Global error. tauThermostat unrecognized.\n" ); |
| 1097 |
+ |
return 0; |
| 1098 |
+ |
break; |
| 1099 |
+ |
} |
| 1100 |
|
break; |
| 1101 |
+ |
|
| 1102 |
+ |
case G_TAUBAROSTAT: |
| 1103 |
+ |
switch( the_type ){ |
| 1104 |
+ |
|
| 1105 |
+ |
case STRING: |
| 1106 |
+ |
the_event->err_msg = |
| 1107 |
+ |
strdup( "Global error. tauBarostat is not a double or int.\n" ); |
| 1108 |
+ |
return 0; |
| 1109 |
+ |
break; |
| 1110 |
+ |
|
| 1111 |
+ |
case DOUBLE: |
| 1112 |
+ |
tau_barostat = the_event->evt.asmt.rhs.dval; |
| 1113 |
+ |
have_tau_barostat = 1; |
| 1114 |
+ |
return 1; |
| 1115 |
+ |
break; |
| 1116 |
+ |
|
| 1117 |
+ |
case INT: |
| 1118 |
+ |
tau_barostat = (double)the_event->evt.asmt.rhs.ival; |
| 1119 |
+ |
have_tau_barostat = 1; |
| 1120 |
+ |
return 1; |
| 1121 |
+ |
break; |
| 1122 |
+ |
|
| 1123 |
+ |
default: |
| 1124 |
+ |
the_event->err_msg = |
| 1125 |
+ |
strdup( "Global error. tauBarostat unrecognized.\n" ); |
| 1126 |
+ |
return 0; |
| 1127 |
+ |
break; |
| 1128 |
+ |
} |
| 1129 |
+ |
break; |
| 1130 |
+ |
|
| 1131 |
+ |
case G_ZCONSTIME: |
| 1132 |
+ |
switch( the_type ){ |
| 1133 |
+ |
|
| 1134 |
+ |
case STRING: |
| 1135 |
+ |
the_event->err_msg = |
| 1136 |
+ |
strdup( "Global error. zcons_time is not a double or int.\n" ); |
| 1137 |
+ |
return 0; |
| 1138 |
+ |
break; |
| 1139 |
+ |
|
| 1140 |
+ |
case DOUBLE: |
| 1141 |
+ |
zcons_time = the_event->evt.asmt.rhs.dval; |
| 1142 |
+ |
have_zcons_time = 1; |
| 1143 |
+ |
return 1; |
| 1144 |
+ |
break; |
| 1145 |
+ |
|
| 1146 |
+ |
case INT: |
| 1147 |
+ |
zcons_time = (double)the_event->evt.asmt.rhs.ival; |
| 1148 |
+ |
have_zcons_time = 1; |
| 1149 |
+ |
return 1; |
| 1150 |
+ |
break; |
| 1151 |
+ |
|
| 1152 |
+ |
default: |
| 1153 |
+ |
the_event->err_msg = |
| 1154 |
+ |
strdup( "Global error. zcons_time unrecognized.\n" ); |
| 1155 |
+ |
return 0; |
| 1156 |
+ |
break; |
| 1157 |
+ |
} |
| 1158 |
+ |
break; |
| 1159 |
+ |
|
| 1160 |
+ |
case G_ZCONSTOL: |
| 1161 |
+ |
switch( the_type ){ |
| 1162 |
+ |
|
| 1163 |
+ |
case STRING: |
| 1164 |
+ |
the_event->err_msg = |
| 1165 |
+ |
strdup( "Global error. zcons_tol is not a double or int.\n" ); |
| 1166 |
+ |
return 0; |
| 1167 |
+ |
break; |
| 1168 |
+ |
|
| 1169 |
+ |
case DOUBLE: |
| 1170 |
+ |
zcons_tol = the_event->evt.asmt.rhs.dval; |
| 1171 |
+ |
have_zcons_tol = 1; |
| 1172 |
+ |
return 1; |
| 1173 |
+ |
break; |
| 1174 |
+ |
|
| 1175 |
+ |
case INT: |
| 1176 |
+ |
zcons_tol = (double)the_event->evt.asmt.rhs.ival; |
| 1177 |
+ |
have_zcons_tol = 1; |
| 1178 |
+ |
return 1; |
| 1179 |
+ |
break; |
| 1180 |
+ |
|
| 1181 |
+ |
default: |
| 1182 |
+ |
the_event->err_msg = |
| 1183 |
+ |
strdup( "Global error. zcons_ol unrecognized.\n" ); |
| 1184 |
+ |
return 0; |
| 1185 |
+ |
break; |
| 1186 |
+ |
} |
| 1187 |
+ |
break; |
| 1188 |
+ |
|
| 1189 |
+ |
case G_ZCONSFORCEPOLICY: |
| 1190 |
+ |
switch( the_type ){ |
| 1191 |
+ |
|
| 1192 |
+ |
case STRING: |
| 1193 |
+ |
strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); |
| 1194 |
+ |
|
| 1195 |
+ |
for(int i = 0; zconsForcePolicy[i] != '\0'; i++) |
| 1196 |
+ |
{ |
| 1197 |
+ |
zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); |
| 1198 |
+ |
} |
| 1199 |
+ |
have_zcons_force_policy = 1; |
| 1200 |
+ |
return 1; |
| 1201 |
+ |
break; |
| 1202 |
+ |
|
| 1203 |
+ |
case DOUBLE: |
| 1204 |
+ |
the_event->err_msg = |
| 1205 |
+ |
strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); |
| 1206 |
+ |
return 0; |
| 1207 |
+ |
break; |
| 1208 |
+ |
|
| 1209 |
+ |
case INT: |
| 1210 |
+ |
the_event->err_msg = |
| 1211 |
+ |
strdup( "Global error. zconsForcePolicy is not a double or int.\n" ); |
| 1212 |
+ |
return 0; |
| 1213 |
+ |
break; |
| 1214 |
+ |
|
| 1215 |
+ |
default: |
| 1216 |
+ |
the_event->err_msg = |
| 1217 |
+ |
strdup( "Global error. zconsForcePolicy unrecognized.\n" ); |
| 1218 |
+ |
return 0; |
| 1219 |
+ |
break; |
| 1220 |
+ |
} |
| 1221 |
+ |
break; |
| 1222 |
+ |
// add more token cases here. |
| 1223 |
+ |
case G_SEED: |
| 1224 |
+ |
switch( the_type ){ |
| 1225 |
+ |
|
| 1226 |
+ |
case STRING: |
| 1227 |
+ |
the_event->err_msg = |
| 1228 |
+ |
strdup( "Global error. seed is not a string.\n" ); |
| 1229 |
+ |
return 0; |
| 1230 |
+ |
return 0; |
| 1231 |
+ |
break; |
| 1232 |
+ |
|
| 1233 |
+ |
case DOUBLE: |
| 1234 |
+ |
have_seed = 1; |
| 1235 |
+ |
seed = (int)the_event->evt.asmt.rhs.dval; |
| 1236 |
+ |
return 1; |
| 1237 |
+ |
break; |
| 1238 |
+ |
|
| 1239 |
+ |
case INT: |
| 1240 |
+ |
have_seed = 1; |
| 1241 |
+ |
seed = the_event->evt.asmt.rhs.ival ; |
| 1242 |
+ |
return 1; |
| 1243 |
+ |
break; |
| 1244 |
+ |
|
| 1245 |
+ |
default: |
| 1246 |
+ |
the_event->err_msg = |
| 1247 |
+ |
strdup( "Global error. seed unrecognized.\n" ); |
| 1248 |
+ |
return 0; |
| 1249 |
+ |
break; |
| 1250 |
+ |
} |
| 1251 |
+ |
break; |
| 1252 |
+ |
// add more token cases here. |
| 1253 |
+ |
|
| 1254 |
|
} |
| 1255 |
|
} |
| 1256 |
|
|