1 |
+ |
/* |
2 |
+ |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
* |
4 |
+ |
* The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
* non-exclusive, royalty free, license to use, modify and |
6 |
+ |
* redistribute this software in source and binary code form, provided |
7 |
+ |
* that the following conditions are met: |
8 |
+ |
* |
9 |
+ |
* 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
* publication of scientific results based in part on use of the |
11 |
+ |
* program. An acceptable form of acknowledgement is citation of |
12 |
+ |
* the article in which the program was described (Matthew |
13 |
+ |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
* |
18 |
+ |
* 2. Redistributions of source code must retain the above copyright |
19 |
+ |
* notice, this list of conditions and the following disclaimer. |
20 |
+ |
* |
21 |
+ |
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
* notice, this list of conditions and the following disclaimer in the |
23 |
+ |
* documentation and/or other materials provided with the |
24 |
+ |
* distribution. |
25 |
+ |
* |
26 |
+ |
* This software is provided "AS IS," without a warranty of any |
27 |
+ |
* kind. All express or implied conditions, representations and |
28 |
+ |
* warranties, including any implied warranty of merchantability, |
29 |
+ |
* fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
* excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
* be liable for any damages suffered by licensee as a result of |
32 |
+ |
* using, modifying or distributing the software or its |
33 |
+ |
* derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
* licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
* direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
* damages, however caused and regardless of the theory of liability, |
37 |
+ |
* arising out of the use of or inability to use software, even if the |
38 |
+ |
* University of Notre Dame has been advised of the possibility of |
39 |
+ |
* such damages. |
40 |
+ |
*/ |
41 |
+ |
|
42 |
|
#include <stdlib.h> |
43 |
|
#include <stdio.h> |
44 |
|
#include <string.h> |
45 |
+ |
#include <string> |
46 |
|
|
47 |
< |
#include "Globals.hpp" |
48 |
< |
#include "simError.h" |
49 |
< |
#ifdef IS_MPI |
50 |
< |
#include "mpiBASS.h" |
9 |
< |
#endif // is_mpi |
47 |
> |
#include "io/Globals.hpp" |
48 |
> |
#include "io/ParamConstraint.hpp" |
49 |
> |
#include "utils/MemoryUtils.hpp" |
50 |
> |
#include "utils/simError.h" |
51 |
|
|
52 |
< |
/* |
53 |
< |
* The following section lists all of the defined tokens for the |
54 |
< |
* gloabal assignment statements. All are prefixed with a G_ to avoid |
55 |
< |
* stepping on any previously defined enumerations. |
56 |
< |
* |
57 |
< |
* NOTE: tokens start at 1, 0 is a resrved token number |
58 |
< |
*/ |
52 |
> |
namespace oopse { |
53 |
> |
Globals::Globals() { |
54 |
> |
DefineParameter(ForceField, "forceField") |
55 |
> |
|
56 |
> |
DefineOptionalParameter(TargetTemp, "targetTemp"); |
57 |
> |
DefineOptionalParameter(Ensemble, "ensemble"); |
58 |
> |
DefineOptionalParameter(Dt, "dt"); |
59 |
> |
DefineOptionalParameter(RunTime, "runTime"); |
60 |
> |
DefineOptionalParameter(FinalConfig, "finalConfig"); |
61 |
> |
DefineOptionalParameter(SampleTime, "sampleTime"); |
62 |
> |
DefineOptionalParameter(ResetTime, "resetTime"); |
63 |
> |
DefineOptionalParameter(StatusTime, "statusTime"); |
64 |
> |
DefineOptionalParameter(CutoffRadius, "cutoffRadius"); |
65 |
> |
DefineOptionalParameter(SwitchingRadius, "switchingRadius"); |
66 |
> |
DefineOptionalParameter(TempSet, "tempSet"); |
67 |
> |
DefineOptionalParameter(ThermalTime, "thermalTime"); |
68 |
> |
DefineOptionalParameter(TargetPressure, "targetPressure"); |
69 |
> |
DefineOptionalParameter(TauThermostat, "tauThermostat"); |
70 |
> |
DefineOptionalParameter(TauBarostat, "tauBarostat"); |
71 |
> |
DefineOptionalParameter(ZconsTime, "zconsTime"); |
72 |
> |
DefineOptionalParameter(ZconsTol, "zconsTol"); |
73 |
> |
DefineOptionalParameter(ZconsForcePolicy, "zconsForcePolicy"); |
74 |
> |
DefineOptionalParameter(Seed, "seed"); |
75 |
> |
DefineOptionalParameter(Minimizer, "minimizer"); |
76 |
> |
DefineOptionalParameter(MinimizerMaxIter,"minimizerMaxIter"); |
77 |
> |
DefineOptionalParameter(MinimizerWriteFrq, "minimizerWriteFrq"); |
78 |
> |
DefineOptionalParameter(MinimizerStepSize, "minimizerStepSize"); |
79 |
> |
DefineOptionalParameter(MinimizerFTol, "minimizerFTol"); |
80 |
> |
DefineOptionalParameter(MinimizerGTol, "minimizerGTol"); |
81 |
> |
DefineOptionalParameter(MinimizerLSTol, "minimizerLSTol"); |
82 |
> |
DefineOptionalParameter(MinimizerLSMaxIter, "minimizerLSMaxIter"); |
83 |
> |
DefineOptionalParameter(ZconsGap, "zconsGap"); |
84 |
> |
DefineOptionalParameter(ZconsFixtime, "zconsFixtime"); |
85 |
> |
DefineOptionalParameter(ZconsUsingSMD, "zconsUsingSMD"); |
86 |
> |
DefineOptionalParameter(ThermodynamicIntegrationLambda, "thermodynamicIntegrationLambda"); |
87 |
> |
DefineOptionalParameter(ThermodynamicIntegrationK, "thermodynamicIntegrationK"); |
88 |
> |
DefineOptionalParameter(ForceFieldVariant, "forceFieldVariant"); |
89 |
> |
DefineOptionalParameter(ForceFieldFileName, "forceFieldFileName"); |
90 |
> |
DefineOptionalParameter(DampingAlpha, "dampingAlpha"); |
91 |
> |
DefineOptionalParameter(ThermIntDistSpringConst, "thermIntDistSpringConst"); |
92 |
> |
DefineOptionalParameter(ThermIntThetaSpringConst, "thermIntThetaSpringConst"); |
93 |
> |
DefineOptionalParameter(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst"); |
94 |
> |
DefineOptionalParameter(SurfaceTension, "surfaceTension"); |
95 |
> |
DefineOptionalParameter(PrintPressureTensor, "printPressureTensor"); |
96 |
> |
DefineOptionalParameter(TaggedAtomPair, "taggedAtomPair"); |
97 |
> |
DefineOptionalParameter(PrintTaggedPairDistance, "printTaggedPairDistance"); |
98 |
> |
DefineOptionalParameter(CutoffPolicy, "cutoffPolicy"); |
99 |
> |
DefineOptionalParameter(SwitchingFunctionType, "switchingFunctionType"); |
100 |
> |
DefineOptionalParameter(HydroPropFile, "HydroPropFile"); |
101 |
> |
DefineOptionalParameter(Viscosity, "viscosity"); |
102 |
> |
DefineOptionalParameter(BeadSize, "beadSize"); |
103 |
> |
DefineOptionalParameter(FrozenBufferRadius, "frozenBufferRadius"); |
104 |
> |
DefineOptionalParameter(LangevinBufferRadius, "langevinBufferRadius"); |
105 |
> |
DefineOptionalParameter(NeighborListNeighbors,"NeighborListNeighbors"); |
106 |
> |
DefineOptionalParameter(UseMultipleTemperatureMethod, "useMultipleTemperatureMethod"); |
107 |
> |
DefineOptionalParameter(MTM_Ce, "MTM_Ce"); |
108 |
> |
DefineOptionalParameter(MTM_G, "MTM_G"); |
109 |
> |
DefineOptionalParameter(MTM_Io, "MTM_Io"); |
110 |
> |
DefineOptionalParameter(MTM_Sigma, "MTM_Sigma"); |
111 |
> |
DefineOptionalParameter(MTM_R, "MTM_R"); |
112 |
> |
|
113 |
|
|
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 |
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_RCUT 17 |
39 |
– |
#define G_RSW 18 |
40 |
– |
#define G_DIELECTRIC 19 |
41 |
– |
#define G_TEMPSET 20 |
42 |
– |
#define G_THERMALTIME 21 |
43 |
– |
#define G_USEPBC 22 |
44 |
– |
#define G_MIXINGRULE 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_MINIMIZER 37 |
59 |
– |
#define G_MIN_MAXITER 38 |
60 |
– |
#define G_MIN_WRITEFRQ 39 |
61 |
– |
#define G_MIN_STEPSIZE 40 |
62 |
– |
#define G_MIN_FTOL 41 |
63 |
– |
#define G_MIN_GTOL 42 |
64 |
– |
#define G_MIN_LSTOL 43 |
65 |
– |
#define G_MIN_LSMAXITER 44 |
66 |
– |
#define G_ZCONSGAP 45 |
67 |
– |
#define G_ZCONSFIXTIME 46 |
68 |
– |
#define G_ZCONSUSINGSMD 47 |
69 |
– |
#define G_USE_SOLID_THERM_INT 48 |
70 |
– |
#define G_USE_LIQUID_THERM_INT 49 |
71 |
– |
#define G_THERM_INT_LAMBDA 50 |
72 |
– |
#define G_THERM_INT_K 51 |
73 |
– |
#define G_FORCEFIELD_VARIANT 52 |
74 |
– |
|
75 |
– |
Globals::Globals(){ |
76 |
– |
initalize(); |
77 |
– |
} |
78 |
– |
|
79 |
– |
Globals::~Globals(){ |
80 |
– |
int i; |
81 |
– |
|
82 |
– |
for( i=0; i<hash_size; i++ ){ |
83 |
– |
if( command_table[i] != NULL ) delete command_table[i]; |
84 |
– |
} |
85 |
– |
delete[] command_table; |
86 |
– |
|
87 |
– |
if( components != NULL ){ |
88 |
– |
for( i=0; i<n_components; i++ ) delete components[i]; |
89 |
– |
delete[] components; |
90 |
– |
} |
91 |
– |
} |
92 |
– |
|
93 |
– |
void Globals::initalize(){ |
94 |
– |
int i; |
114 |
|
|
115 |
< |
hash_size = 23; |
116 |
< |
hash_shift = 4; |
117 |
< |
|
118 |
< |
components = NULL; |
119 |
< |
|
120 |
< |
command_table = new LinkedCommand*[hash_size]; |
121 |
< |
for( i=0; i<hash_size; i++ ) command_table[i] = NULL; |
122 |
< |
|
123 |
< |
addHash( "forceField", G_FORCEFIELD ); |
124 |
< |
addHash( "nComponents", G_NCOMPONENTS ); |
125 |
< |
addHash( "targetTemp", G_TARGETTEMP ); |
126 |
< |
addHash( "ensemble", G_ENSEMBLE ); |
127 |
< |
|
128 |
< |
addHash( "dt", G_DT ); |
129 |
< |
addHash( "runTime", G_RUNTIME ); |
130 |
< |
|
131 |
< |
addHash( "initialConfig", G_INITIALCONFIG ); |
132 |
< |
addHash( "finalConfig", G_FINALCONFIG ); |
133 |
< |
addHash( "nMol", G_NMOL ); |
115 |
< |
addHash( "density", G_DENSITY ); |
116 |
< |
addHash( "box", G_BOX ); |
117 |
< |
addHash( "boxX", G_BOXX ); |
118 |
< |
addHash( "boxY", G_BOXY ); |
119 |
< |
addHash( "boxZ", G_BOXZ ); |
120 |
< |
addHash( "sampleTime", G_SAMPLETIME ); |
121 |
< |
addHash( "resetTime", G_RESETTIME ); |
122 |
< |
addHash( "statusTime", G_STATUSTIME ); |
123 |
< |
addHash( "cutoffRadius", G_RCUT ); |
124 |
< |
addHash( "switchingRadius", G_RSW ); |
125 |
< |
addHash( "dielectric", G_DIELECTRIC ); |
126 |
< |
addHash( "tempSet", G_TEMPSET ); |
127 |
< |
addHash( "thermalTime", G_THERMALTIME ); |
128 |
< |
addHash( "mixingRule", G_MIXINGRULE); |
129 |
< |
addHash( "usePeriodicBoundaryConditions", G_USEPBC); |
130 |
< |
addHash( "useReactionField", G_USERF ); |
131 |
< |
addHash( "targetPressure", G_TARGETPRESSURE); |
132 |
< |
addHash( "tauThermostat", G_TAUTHERMOSTAT); |
133 |
< |
addHash( "tauBarostat", G_TAUBAROSTAT); |
134 |
< |
addHash( "zconsTime", G_ZCONSTIME); |
135 |
< |
addHash( "nZconstraints", G_NZCONSTRAINTS); |
136 |
< |
addHash( "zconsTol", G_ZCONSTOL); |
137 |
< |
addHash( "zconsForcePolicy", G_ZCONSFORCEPOLICY); |
138 |
< |
addHash( "seed", G_SEED); |
139 |
< |
addHash( "useInitialTime", G_USEINITTIME); |
140 |
< |
addHash( "useInitialExtendedSystemState", G_USEINIT_XS_STATE); |
141 |
< |
addHash( "orthoBoxTolerance", G_ORTHOBOXTOLERANCE); |
142 |
< |
addHash( "minimizer", G_MINIMIZER); |
143 |
< |
addHash( "minimizerMaxIter", G_MIN_MAXITER); |
144 |
< |
addHash( "minimizerWriteFrq", G_MIN_WRITEFRQ); |
145 |
< |
addHash( "minimizerStepSize", G_MIN_STEPSIZE); |
146 |
< |
addHash( "minimizerFTol", G_MIN_FTOL); |
147 |
< |
addHash( "minimizerGTol", G_MIN_GTOL); |
148 |
< |
addHash( "minimizerLSTol", G_MIN_LSTOL); |
149 |
< |
addHash( "minimizerLSMaxIter", G_MIN_LSMAXITER); |
150 |
< |
addHash( "zconsGap", G_ZCONSGAP); |
151 |
< |
addHash( "zconsFixtime", G_ZCONSFIXTIME); |
152 |
< |
addHash( "zconsUsingSMD", G_ZCONSUSINGSMD); |
153 |
< |
addHash( "useSolidThermInt", G_USE_SOLID_THERM_INT); |
154 |
< |
addHash( "useLiquidThermInt", G_USE_LIQUID_THERM_INT); |
155 |
< |
addHash( "thermodynamicIntegrationLambda", G_THERM_INT_LAMBDA); |
156 |
< |
addHash( "thermodynamicIntegrationK", G_THERM_INT_K); |
157 |
< |
addHash( "forceFieldVariant", G_FORCEFIELD_VARIANT); |
115 |
> |
DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); |
116 |
> |
DefineOptionalParameterWithDefaultValue(UseAtomicVirial, "useAtomicVirial", true); |
117 |
> |
DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); |
118 |
> |
DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, "useInitialExtendedSystemState", false); |
119 |
> |
DefineOptionalParameterWithDefaultValue(OrthoBoxTolerance, "orthoBoxTolerance", 1E-6); |
120 |
> |
DefineOptionalParameterWithDefaultValue(UseSolidThermInt, "useSolidThermInt", false); |
121 |
> |
DefineOptionalParameterWithDefaultValue(UseLiquidThermInt, "useLiquidThermInt", false); |
122 |
> |
DefineOptionalParameterWithDefaultValue(ThermIntDistSpringConst, "thermIntDistSpringConst", 6.0); |
123 |
> |
DefineOptionalParameterWithDefaultValue(ThermIntThetaSpringConst, "thermIntThetaSpringConst", 7.5); |
124 |
> |
DefineOptionalParameterWithDefaultValue(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst", 13.5); |
125 |
> |
DefineOptionalParameterWithDefaultValue(ElectrostaticSummationMethod, "electrostaticSummationMethod", "SHIFTED_FORCE"); |
126 |
> |
DefineOptionalParameterWithDefaultValue(ElectrostaticScreeningMethod, "electrostaticScreeningMethod", "DAMPED"); |
127 |
> |
DefineOptionalParameterWithDefaultValue(Dielectric, "dielectric", 78.5); |
128 |
> |
DefineOptionalParameterWithDefaultValue(CompressDumpFile, "compressDumpFile", 0); |
129 |
> |
DefineOptionalParameterWithDefaultValue(OutputForceVector, "outputForceVector", 0); |
130 |
> |
DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); |
131 |
> |
DefineOptionalParameterWithDefaultValue(StatFileFormat, "statFileFormat", "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|PRESSURE|VOLUME|CONSERVED_QUANTITY"); |
132 |
> |
DefineOptionalParameterWithDefaultValue(UseSphericalBoundaryConditions, "useSphericalBoundaryConditions", false); |
133 |
> |
DefineOptionalParameterWithDefaultValue(AccumulateBoxDipole, "accumulateBoxDipole", false); |
134 |
|
|
135 |
< |
strcpy( mixingRule,"standard"); //default mixing rules to standard. |
136 |
< |
usePBC = 1; //default periodic boundry conditions to on |
137 |
< |
useRF = 0; |
138 |
< |
useInitTime = 0; // default to pull init time from the init file |
139 |
< |
useInitXSstate = 0; // default to pull the extended state from the init file |
164 |
< |
orthoBoxTolerance = 1E-6; |
165 |
< |
useSolidThermInt = 0; // default solid-state thermodynamic integration to off |
166 |
< |
useLiquidThermInt = 0; // default liquid thermodynamic integration to off |
167 |
< |
|
168 |
< |
have_force_field = 0; |
169 |
< |
have_n_components = 0; |
170 |
< |
have_target_temp = 0; |
171 |
< |
have_ensemble = 0; |
172 |
< |
have_dt = 0; |
173 |
< |
have_run_time = 0; |
135 |
> |
DefineOptionalParameterWithDefaultValue(UseRNEMD, "useRNEMD", false); |
136 |
> |
DefineOptionalParameterWithDefaultValue(RNEMD_swapTime, "RNEMD_swapTime", 100.0); |
137 |
> |
DefineOptionalParameterWithDefaultValue(RNEMD_nBins, "RNEMD_nBins", 15); |
138 |
> |
DefineOptionalParameterWithDefaultValue(RNEMD_swapType, "RNEMD_swapType", "Kinetic"); |
139 |
> |
DefineOptionalParameterWithDefaultValue(RNEMD_objectSelection, "RNEMD_objectSelection", "select all"); |
140 |
|
|
175 |
– |
have_initial_config = 0; |
176 |
– |
have_final_config = 0; |
177 |
– |
have_n_mol = 0; |
178 |
– |
have_density = 0; |
179 |
– |
have_box = 0; |
180 |
– |
have_box_x = 0; |
181 |
– |
have_box_y = 0; |
182 |
– |
have_box_y = 0; |
183 |
– |
have_box_z = 0; |
184 |
– |
have_sample_time = 0; |
185 |
– |
have_status_time = 0; |
186 |
– |
have_reset_time = 0; |
187 |
– |
have_thermal_time = 0; |
188 |
– |
have_rcut = 0; |
189 |
– |
have_rsw = 0; |
190 |
– |
have_dielectric = 0; |
191 |
– |
have_tempSet = 0; |
192 |
– |
have_target_pressure =0; |
193 |
– |
have_q_mass = 0; |
194 |
– |
have_tau_thermostat = 0; |
195 |
– |
have_tau_barostat = 0; |
196 |
– |
have_zcons_time = 0; |
197 |
– |
have_n_zConstraints = 0; |
198 |
– |
have_zConstraints = 0; |
199 |
– |
have_zcons_tol = 0; |
200 |
– |
have_zcons_gap = 0; |
201 |
– |
have_zcons_fixtime = 0; |
202 |
– |
have_zcons_using_smd = 0; |
203 |
– |
have_seed = 0; |
204 |
– |
have_minimizer = 0; |
205 |
– |
have_minimizer_maxiteration = 0; |
206 |
– |
have_minimizer_writefrq = 0; |
207 |
– |
have_minimizer_stepsize = 0; |
208 |
– |
have_minimizer_ftol = 0; |
209 |
– |
have_minimizer_gtol = 0; |
210 |
– |
have_minimizer_ls_tol = 0; |
211 |
– |
have_minimizer_ls_maxiteration = 0; |
212 |
– |
have_thermodynamic_integration_lambda = 0; |
213 |
– |
have_thermodynamic_integration_k = 0; |
214 |
– |
have_forcefield_variant = 0; |
141 |
|
|
142 |
< |
} |
143 |
< |
|
144 |
< |
int Globals::newComponent( event* the_event ){ |
219 |
< |
|
220 |
< |
current_component = new Component; |
221 |
< |
int index = the_event->evt.blk_index; |
222 |
< |
char err[200]; |
223 |
< |
|
224 |
< |
if( have_n_components && index < n_components ) |
225 |
< |
components[index] = current_component; |
226 |
< |
else{ |
227 |
< |
if( have_n_components ){ |
228 |
< |
sprintf( err, "meta-data parsing error: %d out of nComponents range", |
229 |
< |
index ); |
230 |
< |
the_event->err_msg = strdup( err ); |
231 |
< |
return 0; |
232 |
< |
} |
233 |
< |
else{ |
234 |
< |
the_event->err_msg = strdup("meta-data parsing error: nComponents not given before" |
235 |
< |
" first component declaration." ); |
236 |
< |
return 0; |
237 |
< |
} |
238 |
< |
} |
239 |
< |
|
240 |
< |
return 1; |
241 |
< |
} |
242 |
< |
|
243 |
< |
|
244 |
< |
|
245 |
< |
int Globals::componentAssign( event* the_event ){ |
246 |
< |
|
247 |
< |
switch( the_event->evt.asmt.asmt_type ){ |
142 |
> |
deprecatedKeywords_.insert("nComponents"); |
143 |
> |
deprecatedKeywords_.insert("nZconstraints"); |
144 |
> |
deprecatedKeywords_.insert("initialConfig"); |
145 |
|
|
249 |
– |
case STRING: |
250 |
– |
return current_component->assignString( the_event->evt.asmt.lhs, |
251 |
– |
the_event->evt.asmt.rhs.sval, |
252 |
– |
&(the_event->err_msg)); |
253 |
– |
break; |
254 |
– |
|
255 |
– |
case DOUBLE: |
256 |
– |
return current_component->assignDouble( the_event->evt.asmt.lhs, |
257 |
– |
the_event->evt.asmt.rhs.dval, |
258 |
– |
&(the_event->err_msg)); |
259 |
– |
break; |
260 |
– |
|
261 |
– |
case INT: |
262 |
– |
return current_component->assignInt( the_event->evt.asmt.lhs, |
263 |
– |
the_event->evt.asmt.rhs.ival, |
264 |
– |
&(the_event->err_msg)); |
265 |
– |
break; |
266 |
– |
|
267 |
– |
default: |
268 |
– |
the_event->err_msg = strdup( "Globals error. Invalid component" |
269 |
– |
" assignment type" ); |
270 |
– |
return 0; |
271 |
– |
break; |
272 |
– |
} |
273 |
– |
return 0; |
146 |
|
} |
147 |
|
|
148 |
< |
int Globals::componentEnd( event* the_event ){ |
149 |
< |
|
150 |
< |
the_event->err_msg = current_component->checkMe(); |
279 |
< |
if( the_event->err_msg != NULL ) return 0; |
280 |
< |
|
281 |
< |
return 1; |
148 |
> |
Globals::~Globals() { |
149 |
> |
MemoryUtils::deletePointers(components_); |
150 |
> |
MemoryUtils::deletePointers(zconstraints_); |
151 |
|
} |
152 |
|
|
153 |
< |
int Globals::newZconstraint( event* the_event ){ |
154 |
< |
|
153 |
> |
void Globals::validate() { |
154 |
> |
DataHolder::validate(); |
155 |
|
|
156 |
< |
int index = the_event->evt.blk_index; |
157 |
< |
char err[200]; |
158 |
< |
current_zConstraint = new ZconStamp( index ); |
159 |
< |
|
160 |
< |
have_zConstraints = 1; |
156 |
> |
CheckParameter(ForceField, isNotEmpty()); |
157 |
> |
CheckParameter(TargetTemp, isPositive()); |
158 |
> |
CheckParameter(Ensemble, isEqualIgnoreCase("NVE") || isEqualIgnoreCase("NVT") || isEqualIgnoreCase("NPTi") || isEqualIgnoreCase("NPTf") || isEqualIgnoreCase("NPTxyz") || isEqualIgnoreCase("NPAT") || isEqualIgnoreCase("LANGEVINDYNAMICS") || isEqualIgnoreCase("LD") || isEqualIgnoreCase("NPRT") || isEqualIgnoreCase("NPGT") || isEqualIgnoreCase("NGammaT") || isEqualIgnoreCase("NGT") || isEqualIgnoreCase("SMIPD")); |
159 |
> |
CheckParameter(Dt, isPositive()); |
160 |
> |
CheckParameter(RunTime, isPositive()); |
161 |
> |
CheckParameter(FinalConfig, isNotEmpty()); |
162 |
> |
CheckParameter(SampleTime, isNonNegative()); |
163 |
> |
CheckParameter(ResetTime, isNonNegative()); |
164 |
> |
CheckParameter(StatusTime, isNonNegative()); |
165 |
> |
CheckParameter(CutoffRadius, isPositive()); |
166 |
> |
CheckParameter(SwitchingRadius, isNonNegative()); |
167 |
> |
CheckParameter(Dielectric, isPositive()); |
168 |
> |
CheckParameter(ThermalTime, isNonNegative()); |
169 |
> |
CheckParameter(TauThermostat, isPositive()); |
170 |
> |
CheckParameter(TauBarostat, isPositive()); |
171 |
> |
CheckParameter(ZconsTime, isPositive()); |
172 |
> |
CheckParameter(ZconsTol, isPositive()); |
173 |
> |
CheckParameter(Seed, isPositive()); |
174 |
> |
CheckParameter(Minimizer, isEqualIgnoreCase("SD") || isEqualIgnoreCase("CG")); |
175 |
> |
CheckParameter(MinimizerMaxIter, isPositive()); |
176 |
> |
CheckParameter(MinimizerWriteFrq, isPositive()); |
177 |
> |
CheckParameter(MinimizerStepSize, isPositive()); |
178 |
> |
CheckParameter(MinimizerFTol, isPositive()); |
179 |
> |
CheckParameter(MinimizerGTol, isPositive()); |
180 |
> |
CheckParameter(MinimizerLSTol, isPositive()); |
181 |
> |
CheckParameter(MinimizerLSMaxIter, isPositive()); |
182 |
> |
CheckParameter(ZconsGap, isPositive()); |
183 |
> |
CheckParameter(ZconsFixtime, isPositive()); |
184 |
> |
CheckParameter(ThermodynamicIntegrationLambda, isNonNegative()); |
185 |
> |
CheckParameter(ThermodynamicIntegrationK, isPositive()); |
186 |
> |
CheckParameter(ForceFieldVariant, isNotEmpty()); |
187 |
> |
CheckParameter(ForceFieldFileName, isNotEmpty()); |
188 |
> |
CheckParameter(ThermIntDistSpringConst, isPositive()); |
189 |
> |
CheckParameter(ThermIntThetaSpringConst, isPositive()); |
190 |
> |
CheckParameter(ThermIntOmegaSpringConst, isPositive()); |
191 |
> |
CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); |
192 |
> |
CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); |
193 |
> |
CheckParameter(CutoffPolicy, isEqualIgnoreCase("MIX") || isEqualIgnoreCase("MAX") || isEqualIgnoreCase("TRADITIONAL")); |
194 |
> |
CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); |
195 |
> |
//CheckParameter(StatFileFormat,); |
196 |
> |
CheckParameter(OrthoBoxTolerance, isPositive()); |
197 |
> |
CheckParameter(ThermIntDistSpringConst, isPositive()); |
198 |
> |
CheckParameter(ThermIntThetaSpringConst, isPositive()); |
199 |
> |
CheckParameter(ThermIntOmegaSpringConst, isPositive()); |
200 |
> |
CheckParameter(DampingAlpha,isNonNegative()); |
201 |
> |
CheckParameter(SkinThickness, isPositive()); |
202 |
> |
CheckParameter(Viscosity, isNonNegative()); |
203 |
> |
CheckParameter(BeadSize, isPositive()); |
204 |
> |
CheckParameter(FrozenBufferRadius, isPositive()); |
205 |
> |
CheckParameter(LangevinBufferRadius, isPositive()); |
206 |
> |
CheckParameter(NeighborListNeighbors, isPositive()); |
207 |
> |
CheckParameter(RNEMD_swapTime, isPositive()); |
208 |
> |
CheckParameter(RNEMD_nBins, isPositive()); |
209 |
> |
CheckParameter(RNEMD_swapType, isEqualIgnoreCase("Kinetic") || isEqualIgnoreCase("Px") || isEqualIgnoreCase("Py") || isEqualIgnoreCase("Pz")); |
210 |
|
|
211 |
< |
if( have_n_zConstraints && index < n_zConstraints ) |
212 |
< |
zConstraints[index] = current_zConstraint; |
213 |
< |
else{ |
214 |
< |
if( have_n_zConstraints ){ |
215 |
< |
sprintf( err, "meta-data parsing error: %d out of nZconstraints range", |
298 |
< |
index ); |
299 |
< |
the_event->err_msg = strdup( err ); |
300 |
< |
return 0; |
211 |
> |
for(std::vector<Component*>::iterator i = components_.begin(); i != components_.end(); ++i) { |
212 |
> |
if (!(*i)->findMoleculeStamp(moleculeStamps_)) { |
213 |
> |
std::ostringstream oss; |
214 |
> |
oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; |
215 |
> |
throw OOPSEException(oss.str()); |
216 |
|
} |
217 |
< |
else{ |
303 |
< |
the_event->err_msg = strdup("meta-data parsing error: nZconstraints" |
304 |
< |
" not given before" |
305 |
< |
" first zConstraint declaration." ); |
306 |
< |
return 0; |
307 |
< |
} |
308 |
< |
} |
309 |
< |
|
310 |
< |
return 1; |
217 |
> |
} |
218 |
|
} |
312 |
– |
|
313 |
– |
|
314 |
– |
|
315 |
– |
int Globals::zConstraintAssign( event* the_event ){ |
316 |
– |
|
317 |
– |
switch( the_event->evt.asmt.asmt_type ){ |
219 |
|
|
220 |
< |
case STRING: |
221 |
< |
return current_zConstraint->assignString( the_event->evt.asmt.lhs, |
222 |
< |
the_event->evt.asmt.rhs.sval, |
322 |
< |
&(the_event->err_msg)); |
323 |
< |
break; |
324 |
< |
|
325 |
< |
case DOUBLE: |
326 |
< |
return current_zConstraint->assignDouble( the_event->evt.asmt.lhs, |
327 |
< |
the_event->evt.asmt.rhs.dval, |
328 |
< |
&(the_event->err_msg)); |
329 |
< |
break; |
330 |
< |
|
331 |
< |
case INT: |
332 |
< |
return current_zConstraint->assignInt( the_event->evt.asmt.lhs, |
333 |
< |
the_event->evt.asmt.rhs.ival, |
334 |
< |
&(the_event->err_msg)); |
335 |
< |
break; |
336 |
< |
|
337 |
< |
default: |
338 |
< |
the_event->err_msg = strdup( "Globals error. Invalid zConstraint" |
339 |
< |
" assignment type" ); |
340 |
< |
return 0; |
341 |
< |
break; |
342 |
< |
} |
343 |
< |
return 0; |
220 |
> |
bool Globals::addComponent(Component* comp) { |
221 |
> |
components_.push_back(comp); |
222 |
> |
return true; |
223 |
|
} |
224 |
|
|
225 |
< |
int Globals::zConstraintEnd( event* the_event ){ |
226 |
< |
|
227 |
< |
the_event->err_msg = current_zConstraint->checkMe(); |
349 |
< |
if( the_event->err_msg != NULL ) return 0; |
350 |
< |
|
351 |
< |
return 1; |
225 |
> |
bool Globals::addZConsStamp(ZConsStamp* zcons) { |
226 |
> |
zconstraints_.push_back(zcons); |
227 |
> |
return true; |
228 |
|
} |
353 |
– |
|
354 |
– |
int Globals::globalAssign( event* the_event ){ |
355 |
– |
|
356 |
– |
int key; |
357 |
– |
int token; |
358 |
– |
interface_assign_type the_type = the_event->evt.asmt.asmt_type; |
359 |
– |
char* lhs = the_event->evt.asmt.lhs; |
360 |
– |
char err[300]; |
361 |
– |
|
362 |
– |
token = 0; |
363 |
– |
key = hash( lhs ); |
364 |
– |
if( command_table[key] != NULL ) token = command_table[key]->match( lhs ); |
365 |
– |
|
366 |
– |
if( token ){ |
367 |
– |
|
368 |
– |
switch( token ){ |
369 |
– |
|
370 |
– |
case G_FORCEFIELD: |
371 |
– |
if( the_type == STRING ){ |
372 |
– |
strcpy( force_field, the_event->evt.asmt.rhs.sval ); |
373 |
– |
have_force_field = 1; |
374 |
– |
return 1; |
375 |
– |
} |
376 |
– |
|
377 |
– |
the_event->err_msg = |
378 |
– |
strdup( "Error in parsing meta-data file!\n\tforceField was not a string assignment.\n" ); |
379 |
– |
return 0; |
380 |
– |
break; |
381 |
– |
|
382 |
– |
case G_NCOMPONENTS: |
383 |
– |
if( the_type == STRING ){ |
384 |
– |
the_event->err_msg = |
385 |
– |
strdup("Error in parsing meta-data file!\n\tnComponents is not a double or an int.\n" ); |
386 |
– |
return 0; |
387 |
– |
} |
388 |
– |
|
389 |
– |
else if( the_type == DOUBLE ){ |
390 |
– |
n_components = (int)the_event->evt.asmt.rhs.dval; |
391 |
– |
components = new Component*[n_components]; |
392 |
– |
have_n_components = 1; |
393 |
– |
return 1; |
394 |
– |
} |
395 |
– |
|
396 |
– |
else{ |
397 |
– |
n_components = the_event->evt.asmt.rhs.ival; |
398 |
– |
components = new Component*[n_components]; |
399 |
– |
have_n_components = 1; |
400 |
– |
return 1; |
401 |
– |
} |
402 |
– |
break; |
403 |
– |
|
404 |
– |
case G_NZCONSTRAINTS: |
405 |
– |
if( the_type == STRING ){ |
406 |
– |
the_event->err_msg = |
407 |
– |
strdup("Error in parsing meta-data file!\n\tnZconstraints is not a double or an int.\n" ); |
408 |
– |
return 0; |
409 |
– |
} |
410 |
– |
|
411 |
– |
else if( the_type == DOUBLE ){ |
412 |
– |
n_zConstraints = (int)the_event->evt.asmt.rhs.dval; |
413 |
– |
zConstraints = new ZconStamp*[n_zConstraints]; |
414 |
– |
have_n_zConstraints = 1; |
415 |
– |
return 1; |
416 |
– |
} |
417 |
– |
|
418 |
– |
else{ |
419 |
– |
n_zConstraints = the_event->evt.asmt.rhs.ival; |
420 |
– |
zConstraints = new ZconStamp*[n_zConstraints]; |
421 |
– |
have_n_zConstraints = 1; |
422 |
– |
return 1; |
423 |
– |
} |
424 |
– |
break; |
425 |
– |
|
426 |
– |
case G_TARGETTEMP: |
427 |
– |
switch( the_type ){ |
428 |
– |
|
429 |
– |
case STRING: |
430 |
– |
the_event->err_msg = |
431 |
– |
strdup( "Error in parsing meta-data file!\n\ttargetTemp is not a double or int.\n" ); |
432 |
– |
return 0; |
433 |
– |
break; |
434 |
– |
|
435 |
– |
case DOUBLE: |
436 |
– |
target_temp = the_event->evt.asmt.rhs.dval; |
437 |
– |
have_target_temp = 1; |
438 |
– |
return 1; |
439 |
– |
break; |
440 |
– |
|
441 |
– |
case INT: |
442 |
– |
target_temp = (double)the_event->evt.asmt.rhs.ival; |
443 |
– |
have_target_temp = 1; |
444 |
– |
return 1; |
445 |
– |
break; |
446 |
– |
|
447 |
– |
default: |
448 |
– |
the_event->err_msg = |
449 |
– |
strdup( "Error in parsing meta-data file!\n\ttargetTemp unrecognized.\n" ); |
450 |
– |
return 0; |
451 |
– |
break; |
452 |
– |
} |
453 |
– |
break; |
454 |
– |
|
455 |
– |
case G_ORTHOBOXTOLERANCE: |
456 |
– |
switch( the_type ){ |
457 |
– |
|
458 |
– |
case STRING: |
459 |
– |
the_event->err_msg = |
460 |
– |
strdup( "Error in parsing meta-data file!\n\torthoBoxTolerance is not a double or int.\n" ); |
461 |
– |
return 0; |
462 |
– |
break; |
463 |
– |
|
464 |
– |
case DOUBLE: |
465 |
– |
orthoBoxTolerance = the_event->evt.asmt.rhs.dval; |
466 |
– |
have_target_temp = 1; |
467 |
– |
return 1; |
468 |
– |
break; |
469 |
– |
|
470 |
– |
case INT: |
471 |
– |
orthoBoxTolerance = (double)the_event->evt.asmt.rhs.ival; |
472 |
– |
have_target_temp = 1; |
473 |
– |
return 1; |
474 |
– |
break; |
475 |
– |
|
476 |
– |
default: |
477 |
– |
the_event->err_msg = |
478 |
– |
strdup( "Global error.orthoBoxTolerance unrecognized.\n" ); |
479 |
– |
return 0; |
480 |
– |
break; |
481 |
– |
} |
482 |
– |
break; |
483 |
– |
|
484 |
– |
case G_ENSEMBLE: |
485 |
– |
if( the_type == STRING ){ |
486 |
– |
strcpy( ensemble, the_event->evt.asmt.rhs.sval ); |
487 |
– |
have_ensemble = 1; |
488 |
– |
return 1; |
489 |
– |
} |
490 |
– |
|
491 |
– |
the_event->err_msg = |
492 |
– |
strdup( "Error in parsing meta-data file!\n\tensemble was not assigned to a string\n" ); |
493 |
– |
return 0; |
494 |
– |
break; |
495 |
– |
|
496 |
– |
case G_MIXINGRULE: |
497 |
– |
if( the_type == STRING ){ |
498 |
– |
strcpy( mixingRule, the_event->evt.asmt.rhs.sval ); |
499 |
– |
return 1; |
500 |
– |
} |
501 |
– |
|
502 |
– |
the_event->err_msg = |
503 |
– |
strdup( "Error in parsing meta-data file!\n\tmixing rule was not assigned to a string\n" ); |
504 |
– |
return 0; |
505 |
– |
break; |
506 |
– |
|
507 |
– |
case G_DT: |
508 |
– |
switch( the_type ){ |
509 |
– |
|
510 |
– |
case STRING: |
511 |
– |
the_event->err_msg = |
512 |
– |
strdup( "Error in parsing meta-data file!\n\tdt is not a double or int.\n" ); |
513 |
– |
return 0; |
514 |
– |
break; |
515 |
– |
|
516 |
– |
case DOUBLE: |
517 |
– |
dt = the_event->evt.asmt.rhs.dval; |
518 |
– |
have_dt = 1; |
519 |
– |
return 1; |
520 |
– |
break; |
521 |
– |
|
522 |
– |
case INT: |
523 |
– |
dt = (double)the_event->evt.asmt.rhs.ival; |
524 |
– |
have_dt = 1; |
525 |
– |
return 1; |
526 |
– |
break; |
527 |
– |
|
528 |
– |
default: |
529 |
– |
the_event->err_msg = |
530 |
– |
strdup( "Error in parsing meta-data file!\n\tdt unrecognized.\n" ); |
531 |
– |
return 0; |
532 |
– |
break; |
533 |
– |
} |
534 |
– |
break; |
535 |
– |
|
536 |
– |
case G_RUNTIME: |
537 |
– |
switch( the_type ){ |
538 |
– |
|
539 |
– |
case STRING: |
540 |
– |
the_event->err_msg = |
541 |
– |
strdup( "Error in parsing meta-data file!\n\trunTime is not a double or int.\n" ); |
542 |
– |
return 0; |
543 |
– |
break; |
544 |
– |
|
545 |
– |
case DOUBLE: |
546 |
– |
run_time = the_event->evt.asmt.rhs.dval; |
547 |
– |
have_run_time = 1; |
548 |
– |
return 1; |
549 |
– |
break; |
550 |
– |
|
551 |
– |
case INT: |
552 |
– |
run_time = (double)the_event->evt.asmt.rhs.ival; |
553 |
– |
have_run_time = 1; |
554 |
– |
return 1; |
555 |
– |
break; |
556 |
– |
|
557 |
– |
default: |
558 |
– |
the_event->err_msg = |
559 |
– |
strdup( "Error in parsing meta-data file!\n\trunTime unrecognized.\n" ); |
560 |
– |
return 0; |
561 |
– |
break; |
562 |
– |
} |
563 |
– |
break; |
564 |
– |
|
565 |
– |
case G_INITIALCONFIG: |
566 |
– |
if( the_type == STRING ){ |
567 |
– |
strcpy( initial_config, the_event->evt.asmt.rhs.sval ); |
568 |
– |
have_initial_config = 1; |
569 |
– |
return 1; |
570 |
– |
} |
571 |
– |
|
572 |
– |
the_event->err_msg = |
573 |
– |
strdup( "Error in parsing meta-data file!\n\tinitialConfig was not a string assignment.\n" ); |
574 |
– |
return 0; |
575 |
– |
break; |
576 |
– |
|
577 |
– |
case G_FINALCONFIG: |
578 |
– |
if( the_type == STRING ){ |
579 |
– |
strcpy( final_config, the_event->evt.asmt.rhs.sval ); |
580 |
– |
have_final_config = 1; |
581 |
– |
return 1; |
582 |
– |
} |
583 |
– |
|
584 |
– |
the_event->err_msg = |
585 |
– |
strdup( "Error in parsing meta-data file!\n\tfinalConfig was not a string assignment.\n" ); |
586 |
– |
return 0; |
587 |
– |
break; |
588 |
– |
|
589 |
– |
case G_NMOL: |
590 |
– |
switch( the_type ){ |
591 |
– |
|
592 |
– |
case STRING: |
593 |
– |
the_event->err_msg = |
594 |
– |
strdup( "Error in parsing meta-data file!\n\tnMol is not a double or int.\n" ); |
595 |
– |
return 0; |
596 |
– |
break; |
597 |
– |
|
598 |
– |
case DOUBLE: |
599 |
– |
n_mol = (int)the_event->evt.asmt.rhs.dval; |
600 |
– |
have_n_mol = 1; |
601 |
– |
return 1; |
602 |
– |
break; |
603 |
– |
|
604 |
– |
case INT: |
605 |
– |
n_mol = the_event->evt.asmt.rhs.ival; |
606 |
– |
have_n_mol = 1; |
607 |
– |
return 1; |
608 |
– |
break; |
609 |
– |
|
610 |
– |
default: |
611 |
– |
the_event->err_msg = |
612 |
– |
strdup( "Error in parsing meta-data file!\n\tnMol unrecognized.\n" ); |
613 |
– |
return 0; |
614 |
– |
break; |
615 |
– |
} |
616 |
– |
break; |
617 |
– |
|
618 |
– |
case G_DENSITY: |
619 |
– |
switch( the_type ){ |
620 |
– |
|
621 |
– |
case STRING: |
622 |
– |
the_event->err_msg = |
623 |
– |
strdup( "Error in parsing meta-data file!\n\tdensity is not a double or int.\n" ); |
624 |
– |
return 0; |
625 |
– |
break; |
626 |
– |
|
627 |
– |
case DOUBLE: |
628 |
– |
density = the_event->evt.asmt.rhs.dval; |
629 |
– |
have_density = 1; |
630 |
– |
return 1; |
631 |
– |
break; |
632 |
– |
|
633 |
– |
case INT: |
634 |
– |
density = (double)the_event->evt.asmt.rhs.ival; |
635 |
– |
have_density = 1; |
636 |
– |
return 1; |
637 |
– |
break; |
638 |
– |
|
639 |
– |
default: |
640 |
– |
the_event->err_msg = |
641 |
– |
strdup( "Error in parsing meta-data file!\n\tdensity unrecognized.\n" ); |
642 |
– |
return 0; |
643 |
– |
break; |
644 |
– |
} |
645 |
– |
break; |
646 |
– |
|
647 |
– |
case G_BOX: |
648 |
– |
switch( the_type ){ |
649 |
– |
|
650 |
– |
case STRING: |
651 |
– |
the_event->err_msg = |
652 |
– |
strdup( "Error in parsing meta-data file!\n\tbox is not a double or int.\n" ); |
653 |
– |
return 0; |
654 |
– |
break; |
655 |
– |
|
656 |
– |
case DOUBLE: |
657 |
– |
box = the_event->evt.asmt.rhs.dval; |
658 |
– |
have_box = 1; |
659 |
– |
return 1; |
660 |
– |
break; |
661 |
– |
|
662 |
– |
case INT: |
663 |
– |
box = (double)the_event->evt.asmt.rhs.ival; |
664 |
– |
have_box = 1; |
665 |
– |
return 1; |
666 |
– |
break; |
667 |
– |
|
668 |
– |
default: |
669 |
– |
the_event->err_msg = |
670 |
– |
strdup( "Error in parsing meta-data file!\n\tbox unrecognized.\n" ); |
671 |
– |
return 0; |
672 |
– |
break; |
673 |
– |
} |
674 |
– |
break; |
675 |
– |
|
676 |
– |
case G_BOXX: |
677 |
– |
switch( the_type ){ |
678 |
– |
|
679 |
– |
case STRING: |
680 |
– |
the_event->err_msg = |
681 |
– |
strdup( "Error in parsing meta-data file!\n\tboxX is not a double or int.\n" ); |
682 |
– |
return 0; |
683 |
– |
break; |
684 |
– |
|
685 |
– |
case DOUBLE: |
686 |
– |
box_x = the_event->evt.asmt.rhs.dval; |
687 |
– |
have_box_x = 1; |
688 |
– |
return 1; |
689 |
– |
break; |
690 |
– |
|
691 |
– |
case INT: |
692 |
– |
box_x = (double)the_event->evt.asmt.rhs.ival; |
693 |
– |
have_box_x = 1; |
694 |
– |
return 1; |
695 |
– |
break; |
696 |
– |
|
697 |
– |
default: |
698 |
– |
the_event->err_msg = |
699 |
– |
strdup( "Error in parsing meta-data file!\n\tboxX unrecognized.\n" ); |
700 |
– |
return 0; |
701 |
– |
break; |
702 |
– |
} |
703 |
– |
break; |
704 |
– |
|
705 |
– |
case G_BOXY: |
706 |
– |
switch( the_type ){ |
707 |
– |
|
708 |
– |
case STRING: |
709 |
– |
the_event->err_msg = |
710 |
– |
strdup( "Error in parsing meta-data file!\n\tboxY is not a double or int.\n" ); |
711 |
– |
return 0; |
712 |
– |
break; |
713 |
– |
|
714 |
– |
case DOUBLE: |
715 |
– |
box_y = the_event->evt.asmt.rhs.dval; |
716 |
– |
have_box_y = 1; |
717 |
– |
return 1; |
718 |
– |
break; |
719 |
– |
|
720 |
– |
case INT: |
721 |
– |
box_y = (double)the_event->evt.asmt.rhs.ival; |
722 |
– |
have_box_y = 1; |
723 |
– |
return 1; |
724 |
– |
break; |
725 |
– |
|
726 |
– |
default: |
727 |
– |
the_event->err_msg = |
728 |
– |
strdup( "Error in parsing meta-data file!\n\tboxY unrecognized.\n" ); |
729 |
– |
return 0; |
730 |
– |
break; |
731 |
– |
} |
732 |
– |
break; |
733 |
– |
|
734 |
– |
case G_BOXZ: |
735 |
– |
switch( the_type ){ |
736 |
– |
|
737 |
– |
case STRING: |
738 |
– |
the_event->err_msg = |
739 |
– |
strdup( "Error in parsing meta-data file!\n\tboxZ is not a double or int.\n" ); |
740 |
– |
return 0; |
741 |
– |
break; |
742 |
– |
|
743 |
– |
case DOUBLE: |
744 |
– |
box_z = the_event->evt.asmt.rhs.dval; |
745 |
– |
have_box_z = 1; |
746 |
– |
return 1; |
747 |
– |
break; |
748 |
– |
|
749 |
– |
case INT: |
750 |
– |
box_z = (double)the_event->evt.asmt.rhs.ival; |
751 |
– |
have_box_z = 1; |
752 |
– |
return 1; |
753 |
– |
break; |
754 |
– |
|
755 |
– |
default: |
756 |
– |
the_event->err_msg = |
757 |
– |
strdup( "Error in parsing meta-data file!\n\tboxZ unrecognized.\n" ); |
758 |
– |
return 0; |
759 |
– |
break; |
760 |
– |
} |
761 |
– |
break; |
762 |
– |
|
763 |
– |
case G_SAMPLETIME: |
764 |
– |
switch( the_type ){ |
765 |
– |
|
766 |
– |
case STRING: |
767 |
– |
the_event->err_msg = |
768 |
– |
strdup( "Error in parsing meta-data file!\n\tsampleTime is not a double or int.\n" ); |
769 |
– |
return 0; |
770 |
– |
break; |
771 |
– |
|
772 |
– |
case DOUBLE: |
773 |
– |
sample_time = the_event->evt.asmt.rhs.dval; |
774 |
– |
have_sample_time = 1; |
775 |
– |
return 1; |
776 |
– |
break; |
777 |
– |
|
778 |
– |
case INT: |
779 |
– |
sample_time = (double)the_event->evt.asmt.rhs.ival; |
780 |
– |
have_sample_time = 1; |
781 |
– |
return 1; |
782 |
– |
break; |
783 |
– |
|
784 |
– |
default: |
785 |
– |
the_event->err_msg = |
786 |
– |
strdup( "Error in parsing meta-data file!\n\tsampleTime unrecognized.\n" ); |
787 |
– |
return 0; |
788 |
– |
break; |
789 |
– |
} |
790 |
– |
break; |
791 |
– |
|
792 |
– |
case G_STATUSTIME: |
793 |
– |
switch( the_type ){ |
794 |
– |
|
795 |
– |
case STRING: |
796 |
– |
the_event->err_msg = |
797 |
– |
strdup( "Error in parsing meta-data file!\n\tstatusTime is not a double or int.\n" ); |
798 |
– |
return 0; |
799 |
– |
break; |
800 |
– |
|
801 |
– |
case DOUBLE: |
802 |
– |
status_time = the_event->evt.asmt.rhs.dval; |
803 |
– |
have_status_time = 1; |
804 |
– |
return 1; |
805 |
– |
break; |
806 |
– |
|
807 |
– |
case INT: |
808 |
– |
status_time = (double)the_event->evt.asmt.rhs.ival; |
809 |
– |
have_status_time = 1; |
810 |
– |
return 1; |
811 |
– |
break; |
812 |
– |
|
813 |
– |
default: |
814 |
– |
the_event->err_msg = |
815 |
– |
strdup( "Error in parsing meta-data file!\n\tstatusTime unrecognized.\n" ); |
816 |
– |
return 0; |
817 |
– |
break; |
818 |
– |
} |
819 |
– |
break; |
820 |
– |
|
821 |
– |
case G_RESETTIME: |
822 |
– |
switch( the_type ){ |
823 |
– |
|
824 |
– |
case STRING: |
825 |
– |
the_event->err_msg = |
826 |
– |
strdup( "Error in parsing meta-data file!\n\tresetTime is not a double or int.\n" ); |
827 |
– |
return 0; |
828 |
– |
break; |
829 |
– |
|
830 |
– |
case DOUBLE: |
831 |
– |
resetTime = the_event->evt.asmt.rhs.dval; |
832 |
– |
have_reset_time = 1; |
833 |
– |
return 1; |
834 |
– |
break; |
835 |
– |
|
836 |
– |
case INT: |
837 |
– |
resetTime = (double)the_event->evt.asmt.rhs.ival; |
838 |
– |
have_reset_time = 1; |
839 |
– |
return 1; |
840 |
– |
break; |
841 |
– |
|
842 |
– |
default: |
843 |
– |
the_event->err_msg = |
844 |
– |
strdup( "Error in parsing meta-data file!\n\tresetTime unrecognized.\n" ); |
845 |
– |
return 0; |
846 |
– |
break; |
847 |
– |
} |
848 |
– |
break; |
229 |
|
|
230 |
< |
case G_THERMALTIME: |
231 |
< |
switch( the_type ){ |
232 |
< |
|
233 |
< |
case STRING: |
234 |
< |
the_event->err_msg = |
235 |
< |
strdup( "Error in parsing meta-data file!\n\tthermalTime is not a double or int.\n" ); |
236 |
< |
return 0; |
237 |
< |
break; |
858 |
< |
|
859 |
< |
case DOUBLE: |
860 |
< |
thermal_time = the_event->evt.asmt.rhs.dval; |
861 |
< |
have_thermal_time = 1; |
862 |
< |
return 1; |
863 |
< |
break; |
864 |
< |
|
865 |
< |
case INT: |
866 |
< |
thermal_time = (double)the_event->evt.asmt.rhs.ival; |
867 |
< |
have_thermal_time = 1; |
868 |
< |
return 1; |
869 |
< |
break; |
870 |
< |
|
871 |
< |
default: |
872 |
< |
the_event->err_msg = |
873 |
< |
strdup( "Error in parsing meta-data file!\n\tthermalTime unrecognized.\n" ); |
874 |
< |
return 0; |
875 |
< |
break; |
876 |
< |
} |
877 |
< |
break; |
878 |
< |
|
879 |
< |
case G_RCUT: |
880 |
< |
switch( the_type ){ |
881 |
< |
|
882 |
< |
case STRING: |
883 |
< |
the_event->err_msg = |
884 |
< |
strdup( "Error in parsing meta-data file!\n\tcutoffRadius is not a double or int.\n" ); |
885 |
< |
return 0; |
886 |
< |
break; |
887 |
< |
|
888 |
< |
case DOUBLE: |
889 |
< |
rcut = the_event->evt.asmt.rhs.dval; |
890 |
< |
have_rcut = 1; |
891 |
< |
return 1; |
892 |
< |
break; |
893 |
< |
|
894 |
< |
case INT: |
895 |
< |
rcut = (double)the_event->evt.asmt.rhs.ival; |
896 |
< |
have_rcut = 1; |
897 |
< |
return 1; |
898 |
< |
break; |
899 |
< |
|
900 |
< |
default: |
901 |
< |
the_event->err_msg = |
902 |
< |
strdup( "Error in parsing meta-data file!\n\tcutoffRadius unrecognized.\n" ); |
903 |
< |
return 0; |
904 |
< |
break; |
905 |
< |
} |
906 |
< |
break; |
907 |
< |
|
908 |
< |
case G_RSW: |
909 |
< |
switch( the_type ){ |
910 |
< |
|
911 |
< |
case STRING: |
912 |
< |
the_event->err_msg = |
913 |
< |
strdup( "Error in parsing meta-data file!\n\tswitchingRadius is not a double or int.\n" ); |
914 |
< |
return 0; |
915 |
< |
break; |
916 |
< |
|
917 |
< |
case DOUBLE: |
918 |
< |
rsw = the_event->evt.asmt.rhs.dval; |
919 |
< |
have_rsw = 1; |
920 |
< |
return 1; |
921 |
< |
break; |
922 |
< |
|
923 |
< |
case INT: |
924 |
< |
rsw = (double)the_event->evt.asmt.rhs.ival; |
925 |
< |
have_rsw = 1; |
926 |
< |
return 1; |
927 |
< |
break; |
928 |
< |
|
929 |
< |
default: |
930 |
< |
the_event->err_msg = |
931 |
< |
strdup( "Error in parsing meta-data file!\n\tswitchingRadius unrecognized.\n" ); |
932 |
< |
return 0; |
933 |
< |
break; |
934 |
< |
} |
935 |
< |
break; |
936 |
< |
|
937 |
< |
case G_DIELECTRIC: |
938 |
< |
switch( the_type ){ |
939 |
< |
|
940 |
< |
case STRING: |
941 |
< |
the_event->err_msg = |
942 |
< |
strdup( "Error in parsing meta-data file!\n\tdielectric is not a double or int.\n" ); |
943 |
< |
return 0; |
944 |
< |
break; |
945 |
< |
|
946 |
< |
case DOUBLE: |
947 |
< |
dielectric = the_event->evt.asmt.rhs.dval; |
948 |
< |
have_dielectric = 1; |
949 |
< |
return 1; |
950 |
< |
break; |
951 |
< |
|
952 |
< |
case INT: |
953 |
< |
dielectric = (double)the_event->evt.asmt.rhs.ival; |
954 |
< |
have_dielectric = 1; |
955 |
< |
return 1; |
956 |
< |
break; |
957 |
< |
|
958 |
< |
default: |
959 |
< |
the_event->err_msg = |
960 |
< |
strdup( "Error in parsing meta-data file!\n\tdielectric unrecognized.\n" ); |
961 |
< |
return 0; |
962 |
< |
break; |
963 |
< |
} |
964 |
< |
break; |
965 |
< |
|
966 |
< |
case G_TEMPSET: |
967 |
< |
if( the_type == STRING ){ |
968 |
< |
|
969 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) tempSet = 1; |
970 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) tempSet = 0; |
971 |
< |
else{ |
972 |
< |
the_event->err_msg = |
973 |
< |
strdup( "Error in parsing meta-data file!\n\ttempSet was not \"true\" or \"false\".\n" ); |
974 |
< |
return 0; |
975 |
< |
} |
976 |
< |
have_tempSet = 1; |
977 |
< |
return 1; |
978 |
< |
} |
979 |
< |
|
980 |
< |
the_event->err_msg = |
981 |
< |
strdup( "Error in parsing meta-data file!\n\ttempSet was not \"true\" or \"false\".\n" ); |
982 |
< |
return 0; |
983 |
< |
break; |
984 |
< |
|
985 |
< |
case G_USEINITTIME: |
986 |
< |
if( the_type == STRING ){ |
987 |
< |
|
988 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1; |
989 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0; |
990 |
< |
else{ |
991 |
< |
the_event->err_msg = |
992 |
< |
strdup( "Error in parsing meta-data file!\n\tuseInitTime was not \"true\" or \"false\".\n" ); |
993 |
< |
return 0; |
994 |
< |
} |
995 |
< |
return 1; |
996 |
< |
} |
997 |
< |
|
998 |
< |
the_event->err_msg = |
999 |
< |
strdup( "Error in parsing meta-data file!\n\tuseInitTime was not \"true\" or \"false\".\n" ); |
1000 |
< |
return 0; |
1001 |
< |
break; |
1002 |
< |
|
1003 |
< |
case G_USEINIT_XS_STATE: |
1004 |
< |
if( the_type == STRING ){ |
1005 |
< |
|
1006 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) |
1007 |
< |
useInitXSstate = 1; |
1008 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) |
1009 |
< |
useInitXSstate = 0; |
1010 |
< |
else{ |
1011 |
< |
the_event->err_msg = |
1012 |
< |
strdup( "Error in parsing meta-data file!\n\tuseInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
1013 |
< |
return 0; |
1014 |
< |
} |
1015 |
< |
return 1; |
1016 |
< |
} |
1017 |
< |
|
1018 |
< |
the_event->err_msg = |
1019 |
< |
strdup( "Error in parsing meta-data file!\n\tuseInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
1020 |
< |
return 0; |
1021 |
< |
break; |
1022 |
< |
|
1023 |
< |
case G_USEPBC: |
1024 |
< |
if( the_type == STRING ){ |
1025 |
< |
|
1026 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) usePBC = 1; |
1027 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) usePBC = 0; |
1028 |
< |
else{ |
1029 |
< |
the_event->err_msg = |
1030 |
< |
strdup( "Error in parsing meta-data file!\n\tusePeriodicBoundaryConditions was not \"true\" or \"false\".\n" ); |
1031 |
< |
return 0; |
1032 |
< |
} |
1033 |
< |
return 1; |
1034 |
< |
} |
1035 |
< |
|
1036 |
< |
the_event->err_msg = |
1037 |
< |
strdup( "Error in parsing meta-data file!\n\tusePeriodicBoundaryConditions was not \"true\" or \"false\".\n" ); |
1038 |
< |
return 0; |
1039 |
< |
break; |
1040 |
< |
|
1041 |
< |
case G_USERF: |
1042 |
< |
if( the_type == STRING ){ |
1043 |
< |
|
1044 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useRF = 1; |
1045 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useRF = 0; |
1046 |
< |
else{ |
1047 |
< |
the_event->err_msg = |
1048 |
< |
strdup( "Error in parsing meta-data file!\n\tuseReactionField was not \"true\" or \"false\".\n" ); |
1049 |
< |
return 0; |
1050 |
< |
} |
1051 |
< |
return 1; |
1052 |
< |
} |
1053 |
< |
|
1054 |
< |
the_event->err_msg = |
1055 |
< |
strdup( "Error in parsing meta-data file!\n\tuseReactionField was not \"true\" or \"false\".\n" ); |
1056 |
< |
return 0; |
1057 |
< |
break; |
1058 |
< |
|
1059 |
< |
case G_TARGETPRESSURE: |
1060 |
< |
switch( the_type ){ |
1061 |
< |
|
1062 |
< |
case STRING: |
1063 |
< |
the_event->err_msg = |
1064 |
< |
strdup( "Error in parsing meta-data file!\n\ttargetPressure is not a double or int.\n" ); |
1065 |
< |
return 0; |
1066 |
< |
break; |
1067 |
< |
|
1068 |
< |
case DOUBLE: |
1069 |
< |
target_pressure = the_event->evt.asmt.rhs.dval; |
1070 |
< |
have_target_pressure = 1; |
1071 |
< |
return 1; |
1072 |
< |
break; |
1073 |
< |
|
1074 |
< |
case INT: |
1075 |
< |
target_pressure = (double)the_event->evt.asmt.rhs.ival; |
1076 |
< |
have_target_pressure = 1; |
1077 |
< |
return 1; |
1078 |
< |
break; |
1079 |
< |
|
1080 |
< |
default: |
1081 |
< |
the_event->err_msg = |
1082 |
< |
strdup( "Error in parsing meta-data file!\n\ttargetPressure unrecognized.\n" ); |
1083 |
< |
return 0; |
1084 |
< |
break; |
1085 |
< |
} |
1086 |
< |
break; |
1087 |
< |
|
1088 |
< |
case G_TAUTHERMOSTAT: |
1089 |
< |
switch( the_type ){ |
1090 |
< |
|
1091 |
< |
case STRING: |
1092 |
< |
the_event->err_msg = |
1093 |
< |
strdup( "Error in parsing meta-data file!\n\ttauThermostat is not a double or int.\n" ); |
1094 |
< |
return 0; |
1095 |
< |
break; |
1096 |
< |
|
1097 |
< |
case DOUBLE: |
1098 |
< |
tau_thermostat = the_event->evt.asmt.rhs.dval; |
1099 |
< |
have_tau_thermostat = 1; |
1100 |
< |
return 1; |
1101 |
< |
break; |
1102 |
< |
|
1103 |
< |
case INT: |
1104 |
< |
tau_thermostat = (double)the_event->evt.asmt.rhs.ival; |
1105 |
< |
have_tau_thermostat = 1; |
1106 |
< |
return 1; |
1107 |
< |
break; |
1108 |
< |
|
1109 |
< |
default: |
1110 |
< |
the_event->err_msg = |
1111 |
< |
strdup( "Error in parsing meta-data file!\n\ttauThermostat unrecognized.\n" ); |
1112 |
< |
return 0; |
1113 |
< |
break; |
1114 |
< |
} |
1115 |
< |
break; |
1116 |
< |
|
1117 |
< |
case G_TAUBAROSTAT: |
1118 |
< |
switch( the_type ){ |
1119 |
< |
|
1120 |
< |
case STRING: |
1121 |
< |
the_event->err_msg = |
1122 |
< |
strdup( "Error in parsing meta-data file!\n\ttauBarostat is not a double or int.\n" ); |
1123 |
< |
return 0; |
1124 |
< |
break; |
1125 |
< |
|
1126 |
< |
case DOUBLE: |
1127 |
< |
tau_barostat = the_event->evt.asmt.rhs.dval; |
1128 |
< |
have_tau_barostat = 1; |
1129 |
< |
return 1; |
1130 |
< |
break; |
1131 |
< |
|
1132 |
< |
case INT: |
1133 |
< |
tau_barostat = (double)the_event->evt.asmt.rhs.ival; |
1134 |
< |
have_tau_barostat = 1; |
1135 |
< |
return 1; |
1136 |
< |
break; |
1137 |
< |
|
1138 |
< |
default: |
1139 |
< |
the_event->err_msg = |
1140 |
< |
strdup( "Error in parsing meta-data file!\n\ttauBarostat unrecognized.\n" ); |
1141 |
< |
return 0; |
1142 |
< |
break; |
1143 |
< |
} |
1144 |
< |
break; |
1145 |
< |
|
1146 |
< |
case G_ZCONSTIME: |
1147 |
< |
switch( the_type ){ |
1148 |
< |
|
1149 |
< |
case STRING: |
1150 |
< |
the_event->err_msg = |
1151 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_time is not a double or int.\n" ); |
1152 |
< |
return 0; |
1153 |
< |
break; |
1154 |
< |
|
1155 |
< |
case DOUBLE: |
1156 |
< |
zcons_time = the_event->evt.asmt.rhs.dval; |
1157 |
< |
have_zcons_time = 1; |
1158 |
< |
return 1; |
1159 |
< |
break; |
1160 |
< |
|
1161 |
< |
case INT: |
1162 |
< |
zcons_time = (double)the_event->evt.asmt.rhs.ival; |
1163 |
< |
have_zcons_time = 1; |
1164 |
< |
return 1; |
1165 |
< |
break; |
1166 |
< |
|
1167 |
< |
default: |
1168 |
< |
the_event->err_msg = |
1169 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_time unrecognized.\n" ); |
1170 |
< |
return 0; |
1171 |
< |
break; |
1172 |
< |
} |
1173 |
< |
break; |
1174 |
< |
|
1175 |
< |
case G_ZCONSTOL: |
1176 |
< |
switch( the_type ){ |
1177 |
< |
|
1178 |
< |
case STRING: |
1179 |
< |
the_event->err_msg = |
1180 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_tol is not a double or int.\n" ); |
1181 |
< |
return 0; |
1182 |
< |
break; |
1183 |
< |
|
1184 |
< |
case DOUBLE: |
1185 |
< |
zcons_tol = the_event->evt.asmt.rhs.dval; |
1186 |
< |
have_zcons_tol = 1; |
1187 |
< |
return 1; |
1188 |
< |
break; |
1189 |
< |
|
1190 |
< |
case INT: |
1191 |
< |
zcons_tol = (double)the_event->evt.asmt.rhs.ival; |
1192 |
< |
have_zcons_tol = 1; |
1193 |
< |
return 1; |
1194 |
< |
break; |
1195 |
< |
|
1196 |
< |
default: |
1197 |
< |
the_event->err_msg = |
1198 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_ol unrecognized.\n" ); |
1199 |
< |
return 0; |
1200 |
< |
break; |
1201 |
< |
} |
1202 |
< |
break; |
1203 |
< |
|
1204 |
< |
case G_ZCONSFORCEPOLICY: |
1205 |
< |
switch( the_type ){ |
1206 |
< |
|
1207 |
< |
case STRING: |
1208 |
< |
strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval); |
1209 |
< |
|
1210 |
< |
for(int i = 0; zconsForcePolicy[i] != '\0'; i++) |
1211 |
< |
{ |
1212 |
< |
zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); |
1213 |
< |
} |
1214 |
< |
have_zcons_force_policy = 1; |
1215 |
< |
return 1; |
1216 |
< |
break; |
1217 |
< |
|
1218 |
< |
case DOUBLE: |
1219 |
< |
the_event->err_msg = |
1220 |
< |
strdup( "Error in parsing meta-data file!\n\tzconsForcePolicy is not a double or int.\n" ); |
1221 |
< |
return 0; |
1222 |
< |
break; |
1223 |
< |
|
1224 |
< |
case INT: |
1225 |
< |
the_event->err_msg = |
1226 |
< |
strdup( "Error in parsing meta-data file!\n\tzconsForcePolicy is not a double or int.\n" ); |
1227 |
< |
return 0; |
1228 |
< |
break; |
1229 |
< |
|
1230 |
< |
default: |
1231 |
< |
the_event->err_msg = |
1232 |
< |
strdup( "Error in parsing meta-data file!\n\tzconsForcePolicy unrecognized.\n" ); |
1233 |
< |
return 0; |
1234 |
< |
break; |
1235 |
< |
} |
1236 |
< |
break; |
1237 |
< |
|
1238 |
< |
case G_ZCONSGAP: |
1239 |
< |
switch( the_type ){ |
1240 |
< |
|
1241 |
< |
case STRING: |
1242 |
< |
the_event->err_msg = |
1243 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_gap is not a double or int.\n" ); |
1244 |
< |
return 0; |
1245 |
< |
break; |
1246 |
< |
|
1247 |
< |
case DOUBLE: |
1248 |
< |
zcons_gap = the_event->evt.asmt.rhs.dval; |
1249 |
< |
have_zcons_gap= 1; |
1250 |
< |
return 1; |
1251 |
< |
break; |
1252 |
< |
|
1253 |
< |
case INT: |
1254 |
< |
zcons_gap= (double)the_event->evt.asmt.rhs.ival; |
1255 |
< |
have_zcons_gap= 1; |
1256 |
< |
return 1; |
1257 |
< |
break; |
1258 |
< |
|
1259 |
< |
default: |
1260 |
< |
the_event->err_msg = |
1261 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_gap unrecognized.\n" ); |
1262 |
< |
return 0; |
1263 |
< |
break; |
1264 |
< |
} |
1265 |
< |
break; |
1266 |
< |
|
1267 |
< |
case G_ZCONSFIXTIME: |
1268 |
< |
switch( the_type ){ |
1269 |
< |
|
1270 |
< |
case STRING: |
1271 |
< |
the_event->err_msg = |
1272 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_fixtime is not a double or int.\n" ); |
1273 |
< |
return 0; |
1274 |
< |
break; |
1275 |
< |
|
1276 |
< |
case DOUBLE: |
1277 |
< |
zcons_fixtime= the_event->evt.asmt.rhs.dval; |
1278 |
< |
have_zcons_fixtime= 1; |
1279 |
< |
return 1; |
1280 |
< |
break; |
1281 |
< |
|
1282 |
< |
case INT: |
1283 |
< |
zcons_fixtime= (double)the_event->evt.asmt.rhs.ival; |
1284 |
< |
have_zcons_fixtime= 1; |
1285 |
< |
return 1; |
1286 |
< |
break; |
1287 |
< |
|
1288 |
< |
default: |
1289 |
< |
the_event->err_msg = |
1290 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_fixtime unrecognized.\n" ); |
1291 |
< |
return 0; |
1292 |
< |
break; |
1293 |
< |
} |
1294 |
< |
break; |
1295 |
< |
|
1296 |
< |
case G_ZCONSUSINGSMD: |
1297 |
< |
switch( the_type ){ |
1298 |
< |
|
1299 |
< |
case STRING: |
1300 |
< |
the_event->err_msg = |
1301 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_fixtime is not an int.\n" ); |
1302 |
< |
return 0; |
1303 |
< |
break; |
1304 |
< |
|
1305 |
< |
case DOUBLE: |
1306 |
< |
the_event->err_msg = |
1307 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_fixtime is not an int.\n" ); |
1308 |
< |
return 0; |
1309 |
< |
break; |
1310 |
< |
|
1311 |
< |
case INT: |
1312 |
< |
zcons_using_smd= the_event->evt.asmt.rhs.ival; |
1313 |
< |
have_zcons_using_smd= 1; |
1314 |
< |
return 1; |
1315 |
< |
break; |
1316 |
< |
|
1317 |
< |
default: |
1318 |
< |
the_event->err_msg = |
1319 |
< |
strdup( "Error in parsing meta-data file!\n\tzcons_usingsmd unrecognized.\n" ); |
1320 |
< |
return 0; |
1321 |
< |
break; |
1322 |
< |
} |
1323 |
< |
break; |
1324 |
< |
|
1325 |
< |
case G_MINIMIZER: |
1326 |
< |
switch( the_type ){ |
1327 |
< |
|
1328 |
< |
case STRING: |
1329 |
< |
strcpy(minimizer_name, the_event->evt.asmt.rhs.sval); |
1330 |
< |
|
1331 |
< |
for(int i = 0; zconsForcePolicy[i] != '\0'; i++){ |
1332 |
< |
zconsForcePolicy[i] = toupper(zconsForcePolicy[i]); |
1333 |
< |
} |
1334 |
< |
have_minimizer= 1; |
1335 |
< |
return 1; |
1336 |
< |
break; |
1337 |
< |
|
1338 |
< |
case DOUBLE: |
1339 |
< |
the_event->err_msg = |
1340 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_name is not a double or int.\n" ); |
1341 |
< |
return 0; |
1342 |
< |
break; |
1343 |
< |
|
1344 |
< |
case INT: |
1345 |
< |
the_event->err_msg = |
1346 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_name is not a double or int.\n" ); |
1347 |
< |
return 0; |
1348 |
< |
break; |
1349 |
< |
|
1350 |
< |
default: |
1351 |
< |
the_event->err_msg = |
1352 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_name unrecognized.\n" ); |
1353 |
< |
return 0; |
1354 |
< |
break; |
1355 |
< |
} |
1356 |
< |
break; |
1357 |
< |
|
1358 |
< |
case G_MIN_MAXITER: |
1359 |
< |
switch( the_type ){ |
1360 |
< |
|
1361 |
< |
case STRING: |
1362 |
< |
the_event->err_msg = |
1363 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_maxiteration is not a double or int.\n" ); |
1364 |
< |
return 1; |
1365 |
< |
break; |
1366 |
< |
|
1367 |
< |
case DOUBLE: |
1368 |
< |
minimizer_maxiteration = (int)the_event->evt.asmt.rhs.dval; |
1369 |
< |
have_minimizer_maxiteration = 1; |
1370 |
< |
return 1; |
1371 |
< |
break; |
1372 |
< |
|
1373 |
< |
case INT: |
1374 |
< |
minimizer_maxiteration = the_event->evt.asmt.rhs.ival; |
1375 |
< |
have_minimizer_maxiteration = 1; |
1376 |
< |
return 1; |
1377 |
< |
break; |
1378 |
< |
|
1379 |
< |
default: |
1380 |
< |
the_event->err_msg = |
1381 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_maxiteration unrecognized.\n" ); |
1382 |
< |
return 0; |
1383 |
< |
break; |
1384 |
< |
} |
1385 |
< |
break; |
1386 |
< |
|
1387 |
< |
case G_MIN_WRITEFRQ: |
1388 |
< |
switch( the_type ){ |
1389 |
< |
|
1390 |
< |
case STRING: |
1391 |
< |
the_event->err_msg = |
1392 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not a double or int.\n" ); |
1393 |
< |
return 1; |
1394 |
< |
break; |
1395 |
< |
|
1396 |
< |
case DOUBLE: |
1397 |
< |
minimizer_writefrq= the_event->evt.asmt.rhs.dval; |
1398 |
< |
have_minimizer_writefrq = 1; |
1399 |
< |
return 1; |
1400 |
< |
break; |
1401 |
< |
|
1402 |
< |
case INT: |
1403 |
< |
minimizer_writefrq= the_event->evt.asmt.rhs.ival; |
1404 |
< |
have_minimizer_writefrq = 1; |
1405 |
< |
return 1; |
1406 |
< |
break; |
1407 |
< |
|
1408 |
< |
default: |
1409 |
< |
the_event->err_msg = |
1410 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq unrecognized.\n" ); |
1411 |
< |
return 0; |
1412 |
< |
break; |
1413 |
< |
} |
1414 |
< |
break; |
1415 |
< |
|
1416 |
< |
case G_MIN_STEPSIZE: |
1417 |
< |
switch( the_type ){ |
1418 |
< |
|
1419 |
< |
case STRING: |
1420 |
< |
the_event->err_msg = |
1421 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_resetfrq is not a double or int.\n" ); |
1422 |
< |
return 1; |
1423 |
< |
break; |
1424 |
< |
|
1425 |
< |
case DOUBLE: |
1426 |
< |
minimizer_stepsize= the_event->evt.asmt.rhs.dval; |
1427 |
< |
have_minimizer_stepsize = 1; |
1428 |
< |
return 1; |
1429 |
< |
break; |
1430 |
< |
|
1431 |
< |
case INT: |
1432 |
< |
minimizer_stepsize= the_event->evt.asmt.rhs.ival; |
1433 |
< |
have_minimizer_stepsize = 1; |
1434 |
< |
return 1; |
1435 |
< |
break; |
1436 |
< |
|
1437 |
< |
default: |
1438 |
< |
the_event->err_msg = |
1439 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_resetfrq unrecognized.\n" ); |
1440 |
< |
return 0; |
1441 |
< |
break; |
1442 |
< |
} |
1443 |
< |
break; |
1444 |
< |
|
1445 |
< |
case G_MIN_FTOL: |
1446 |
< |
switch( the_type ){ |
1447 |
< |
|
1448 |
< |
case STRING: |
1449 |
< |
the_event->err_msg = |
1450 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ftol is not a double or int.\n" ); |
1451 |
< |
return 1; |
1452 |
< |
break; |
1453 |
< |
|
1454 |
< |
case DOUBLE: |
1455 |
< |
minimizer_ftol= the_event->evt.asmt.rhs.dval; |
1456 |
< |
have_minimizer_ftol = 1; |
1457 |
< |
return 1; |
1458 |
< |
break; |
1459 |
< |
|
1460 |
< |
case INT: |
1461 |
< |
minimizer_ftol= the_event->evt.asmt.rhs.ival; |
1462 |
< |
have_minimizer_ftol = 1; |
1463 |
< |
return 1; |
1464 |
< |
break; |
1465 |
< |
|
1466 |
< |
default: |
1467 |
< |
the_event->err_msg = |
1468 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ftol unrecognized.\n" ); |
1469 |
< |
return 0; |
1470 |
< |
break; |
1471 |
< |
} |
1472 |
< |
break; |
1473 |
< |
|
1474 |
< |
case G_MIN_GTOL: |
1475 |
< |
switch( the_type ){ |
1476 |
< |
|
1477 |
< |
case STRING: |
1478 |
< |
the_event->err_msg = |
1479 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_gtol is not a double or int.\n" ); |
1480 |
< |
return 1; |
1481 |
< |
break; |
1482 |
< |
|
1483 |
< |
case DOUBLE: |
1484 |
< |
minimizer_gtol= the_event->evt.asmt.rhs.dval; |
1485 |
< |
have_minimizer_gtol = 1; |
1486 |
< |
return 1; |
1487 |
< |
break; |
1488 |
< |
|
1489 |
< |
case INT: |
1490 |
< |
minimizer_gtol= the_event->evt.asmt.rhs.ival; |
1491 |
< |
have_minimizer_gtol = 1; |
1492 |
< |
return 1; |
1493 |
< |
break; |
1494 |
< |
|
1495 |
< |
default: |
1496 |
< |
the_event->err_msg = |
1497 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_gtol unrecognized.\n" ); |
1498 |
< |
return 0; |
1499 |
< |
break; |
1500 |
< |
} |
1501 |
< |
break; |
1502 |
< |
|
1503 |
< |
case G_MIN_LSMAXITER: |
1504 |
< |
switch( the_type ){ |
1505 |
< |
|
1506 |
< |
case STRING: |
1507 |
< |
the_event->err_msg = |
1508 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not a double or int.\n" ); |
1509 |
< |
return 1; |
1510 |
< |
break; |
1511 |
< |
|
1512 |
< |
case DOUBLE: |
1513 |
< |
minimizer_ls_maxiteration = the_event->evt.asmt.rhs.dval; |
1514 |
< |
have_minimizer_ls_maxiteration = 1; |
1515 |
< |
return 1; |
1516 |
< |
break; |
1517 |
< |
|
1518 |
< |
case INT: |
1519 |
< |
minimizer_ls_maxiteration = the_event->evt.asmt.rhs.ival; |
1520 |
< |
have_minimizer_ls_maxiteration = 1; |
1521 |
< |
return 1; |
1522 |
< |
break; |
1523 |
< |
|
1524 |
< |
default: |
1525 |
< |
the_event->err_msg = |
1526 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration unrecognized.\n" ); |
1527 |
< |
return 0; |
1528 |
< |
break; |
1529 |
< |
} |
1530 |
< |
break; |
1531 |
< |
|
1532 |
< |
case G_MIN_LSTOL: |
1533 |
< |
switch( the_type ){ |
1534 |
< |
|
1535 |
< |
case STRING: |
1536 |
< |
the_event->err_msg = |
1537 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ls_tol is not a double or int.\n" ); |
1538 |
< |
return 1; |
1539 |
< |
break; |
1540 |
< |
|
1541 |
< |
case DOUBLE: |
1542 |
< |
minimizer_ls_tol= the_event->evt.asmt.rhs.dval; |
1543 |
< |
have_minimizer_ls_tol = 1; |
1544 |
< |
return 1; |
1545 |
< |
break; |
1546 |
< |
|
1547 |
< |
case INT: |
1548 |
< |
minimizer_ls_tol= the_event->evt.asmt.rhs.ival; |
1549 |
< |
have_minimizer_ls_tol = 1; |
1550 |
< |
return 1; |
1551 |
< |
break; |
1552 |
< |
|
1553 |
< |
default: |
1554 |
< |
the_event->err_msg = |
1555 |
< |
strdup( "Error in parsing meta-data file!\n\tminimizer_ls_tol unrecognized.\n" ); |
1556 |
< |
return 0; |
1557 |
< |
break; |
1558 |
< |
} |
1559 |
< |
break; |
1560 |
< |
|
1561 |
< |
// add more token cases here. |
1562 |
< |
case G_SEED: |
1563 |
< |
switch( the_type ){ |
1564 |
< |
|
1565 |
< |
case STRING: |
1566 |
< |
the_event->err_msg = |
1567 |
< |
strdup( "Error in parsing meta-data file!\n\tseed is not a string.\n" ); |
1568 |
< |
return 0; |
1569 |
< |
return 0; |
1570 |
< |
break; |
1571 |
< |
|
1572 |
< |
case DOUBLE: |
1573 |
< |
have_seed = 1; |
1574 |
< |
seed = (int)the_event->evt.asmt.rhs.dval; |
1575 |
< |
return 1; |
1576 |
< |
break; |
1577 |
< |
|
1578 |
< |
case INT: |
1579 |
< |
have_seed = 1; |
1580 |
< |
seed = the_event->evt.asmt.rhs.ival ; |
1581 |
< |
return 1; |
1582 |
< |
break; |
1583 |
< |
|
1584 |
< |
default: |
1585 |
< |
the_event->err_msg = |
1586 |
< |
strdup( "Error in parsing meta-data file!\n\tseed unrecognized.\n" ); |
1587 |
< |
return 0; |
1588 |
< |
break; |
1589 |
< |
} |
1590 |
< |
break; |
1591 |
< |
|
1592 |
< |
case G_USE_SOLID_THERM_INT: |
1593 |
< |
if( the_type == STRING ){ |
1594 |
< |
|
1595 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useSolidThermInt = 1; |
1596 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useSolidThermInt = 0; |
1597 |
< |
else{ |
1598 |
< |
the_event->err_msg = |
1599 |
< |
strdup( "Error in parsing meta-data file!\n\tuseSolidThermInt was not \"true\" or \"false\".\n" ); |
1600 |
< |
return 0; |
1601 |
< |
} |
1602 |
< |
return 1; |
1603 |
< |
} |
1604 |
< |
|
1605 |
< |
the_event->err_msg = |
1606 |
< |
strdup( "Error in parsing meta-data file!\n\tuseSolidThermInt was not \"true\" or \"false\".\n" ); |
1607 |
< |
return 0; |
1608 |
< |
break; |
1609 |
< |
|
1610 |
< |
case G_USE_LIQUID_THERM_INT: |
1611 |
< |
if( the_type == STRING ){ |
1612 |
< |
|
1613 |
< |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useLiquidThermInt = 1; |
1614 |
< |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useLiquidThermInt = 0; |
1615 |
< |
else{ |
1616 |
< |
the_event->err_msg = |
1617 |
< |
strdup( "Error in parsing meta-data file!\n\tuseLiquidThermInt was not \"true\" or \"false\".\n" ); |
1618 |
< |
return 0; |
1619 |
< |
} |
1620 |
< |
return 1; |
1621 |
< |
} |
1622 |
< |
|
1623 |
< |
the_event->err_msg = |
1624 |
< |
strdup( "Error in parsing meta-data file!\n\tuseLiquidThermInt was not \"true\" or \"false\".\n" ); |
1625 |
< |
return 0; |
1626 |
< |
break; |
1627 |
< |
|
1628 |
< |
case G_THERM_INT_LAMBDA: |
1629 |
< |
switch( the_type ){ |
1630 |
< |
|
1631 |
< |
case STRING: |
1632 |
< |
the_event->err_msg = |
1633 |
< |
strdup( "Error in parsing meta-data file!\n\tthermodynamicIntegrationLambda is not a double or int.\n" ); |
1634 |
< |
return 1; |
1635 |
< |
break; |
1636 |
< |
|
1637 |
< |
case DOUBLE: |
1638 |
< |
thermodynamic_integration_lambda = the_event->evt.asmt.rhs.dval; |
1639 |
< |
have_thermodynamic_integration_lambda = 1; |
1640 |
< |
return 1; |
1641 |
< |
break; |
1642 |
< |
|
1643 |
< |
case INT: |
1644 |
< |
thermodynamic_integration_lambda = (double)the_event->evt.asmt.rhs.dval; |
1645 |
< |
have_thermodynamic_integration_lambda = 1; |
1646 |
< |
return 1; |
1647 |
< |
break; |
1648 |
< |
|
1649 |
< |
default: |
1650 |
< |
the_event->err_msg = |
1651 |
< |
strdup( "Error in parsing meta-data file!\n\tthermodynamicIntegrationLambda unrecognized.\n" ); |
1652 |
< |
return 0; |
1653 |
< |
break; |
1654 |
< |
} |
1655 |
< |
break; |
1656 |
< |
|
1657 |
< |
case G_THERM_INT_K: |
1658 |
< |
switch( the_type ){ |
1659 |
< |
|
1660 |
< |
case STRING: |
1661 |
< |
the_event->err_msg = |
1662 |
< |
strdup( "Error in parsing meta-data file!\n\tthermodynamicIntegrationK is not a double or int.\n" ); |
1663 |
< |
return 1; |
1664 |
< |
break; |
1665 |
< |
|
1666 |
< |
case DOUBLE: |
1667 |
< |
thermodynamic_integration_k = the_event->evt.asmt.rhs.dval; |
1668 |
< |
have_thermodynamic_integration_k = 1; |
1669 |
< |
return 1; |
1670 |
< |
break; |
1671 |
< |
|
1672 |
< |
case INT: |
1673 |
< |
thermodynamic_integration_k = (double)the_event->evt.asmt.rhs.dval; |
1674 |
< |
have_thermodynamic_integration_k = 1; |
1675 |
< |
return 1; |
1676 |
< |
break; |
1677 |
< |
|
1678 |
< |
default: |
1679 |
< |
the_event->err_msg = |
1680 |
< |
strdup( "Error in parsing meta-data file!\n\tthermodynamicIntegrationK unrecognized.\n" ); |
1681 |
< |
return 0; |
1682 |
< |
break; |
1683 |
< |
} |
1684 |
< |
break; |
1685 |
< |
case G_FORCEFIELD_VARIANT: |
1686 |
< |
if( the_type == STRING ){ |
1687 |
< |
strcpy( forcefield_variant, the_event->evt.asmt.rhs.sval ); |
1688 |
< |
have_forcefield_variant = 1; |
1689 |
< |
return 1; |
1690 |
< |
} |
1691 |
< |
|
1692 |
< |
the_event->err_msg = |
1693 |
< |
strdup( "Error in parsing meta-data file!\n\tforceFieldVariant was not a string assignment.\n" ); |
1694 |
< |
return 0; |
1695 |
< |
break; |
1696 |
< |
// add more token cases here. |
1697 |
< |
} |
1698 |
< |
} |
1699 |
< |
|
1700 |
< |
switch( the_type ){ |
1701 |
< |
|
1702 |
< |
case STRING: |
1703 |
< |
sprintf( err, |
1704 |
< |
"\tUnrecognized assignment:\n" |
1705 |
< |
"\t\t-> %s = %s\n", |
1706 |
< |
lhs, the_event->evt.asmt.rhs.sval ); |
1707 |
< |
break; |
1708 |
< |
|
1709 |
< |
case DOUBLE: |
1710 |
< |
sprintf( err, |
1711 |
< |
"\tUnrecognized assignment:\n" |
1712 |
< |
"\t\t-> %s = %lf\n", |
1713 |
< |
lhs, the_event->evt.asmt.rhs.dval ); |
1714 |
< |
break; |
1715 |
< |
|
1716 |
< |
case INT: |
1717 |
< |
sprintf( err, |
1718 |
< |
"\tUnrecognized assignment:\n" |
1719 |
< |
"\t\t-> %s = %d\n", |
1720 |
< |
lhs, the_event->evt.asmt.rhs.ival ); |
1721 |
< |
break; |
1722 |
< |
|
1723 |
< |
default: |
1724 |
< |
sprintf( err, |
1725 |
< |
"\tUnrecognized assignment:\n" |
1726 |
< |
"\t\t-> %s = ?\n", |
1727 |
< |
lhs ); |
1728 |
< |
break; |
1729 |
< |
} |
1730 |
< |
|
1731 |
< |
the_event->err_msg = strdup( err ); |
1732 |
< |
return 0; |
1733 |
< |
} |
1734 |
< |
|
1735 |
< |
char* Globals::checkMe( void ){ |
1736 |
< |
|
1737 |
< |
char err[300]; |
1738 |
< |
short int have_err = 0; |
1739 |
< |
|
1740 |
< |
strcpy( err, "The following required keywords are missing:\n" ); |
1741 |
< |
|
1742 |
< |
if( !have_force_field ){ |
1743 |
< |
strcat( err, "\t\t->forceField\n" ); |
1744 |
< |
have_err= 1; |
1745 |
< |
} |
1746 |
< |
|
1747 |
< |
if( !have_n_components ){ |
1748 |
< |
strcat( err, "\t\t->nComponents\n" ); |
1749 |
< |
have_err= 1; |
1750 |
< |
} |
1751 |
< |
|
1752 |
< |
|
1753 |
< |
if ( !have_ensemble ) { |
1754 |
< |
// I'm not doing MD: |
1755 |
< |
if ( !have_minimizer ) { |
1756 |
< |
// I'm not doing MD or minimization: |
1757 |
< |
strcat( err, "\t\t->either ensemble or minimizer must be set!\n" ); |
1758 |
< |
have_err = 1; |
230 |
> |
bool Globals::addMoleculeStamp(MoleculeStamp* molStamp) { |
231 |
> |
std::string molStampName = molStamp->getName(); |
232 |
> |
std::map<std::string, MoleculeStamp*>::iterator i; |
233 |
> |
bool ret = false; |
234 |
> |
i = moleculeStamps_.find(molStampName); |
235 |
> |
if (i == moleculeStamps_.end()) { |
236 |
> |
moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(molStampName, molStamp)); |
237 |
> |
ret = true; |
238 |
|
} else { |
239 |
< |
// I'm a minimizer: |
239 |
> |
std::ostringstream oss; |
240 |
> |
oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; |
241 |
> |
throw OOPSEException(oss.str()); |
242 |
|
} |
243 |
< |
} else { |
1763 |
< |
// I *am* doing MD: |
1764 |
< |
if( !have_dt ){ |
1765 |
< |
strcat( err, "\t\t->dt (timestep in fs)\n" ); |
1766 |
< |
have_err= 1; |
1767 |
< |
} |
1768 |
< |
if( !have_run_time ){ |
1769 |
< |
strcat( err, "\t\t->runTime (total run time in fs)\n" ); |
1770 |
< |
have_err= 1; |
1771 |
< |
} |
1772 |
< |
} |
1773 |
< |
|
1774 |
< |
if( have_err ) return strdup( err ); |
1775 |
< |
|
1776 |
< |
return NULL; |
243 |
> |
return ret; |
244 |
|
} |
245 |
+ |
|
246 |
|
|
1779 |
– |
int Globals::globalEnd( event* the_event ){ |
1780 |
– |
|
1781 |
– |
the_event->err_msg = checkMe(); |
1782 |
– |
if( the_event->err_msg != NULL ) return 0; |
1783 |
– |
|
1784 |
– |
return 1; |
247 |
|
} |
1786 |
– |
|
1787 |
– |
int Globals::hash( char* text ){ |
1788 |
– |
|
1789 |
– |
register unsigned short int i = 0; // loop counter |
1790 |
– |
int key = 0; // the hash key |
1791 |
– |
|
1792 |
– |
while( text[i] != '\0' ){ |
1793 |
– |
|
1794 |
– |
key = ( ( key << hash_shift ) + text[i] ) % hash_size; |
1795 |
– |
|
1796 |
– |
i++; |
1797 |
– |
} |
1798 |
– |
|
1799 |
– |
if( key < 0 ){ |
1800 |
– |
|
1801 |
– |
// if the key is less than zero, we've had an overflow error |
1802 |
– |
|
1803 |
– |
sprintf( painCave.errMsg, |
1804 |
– |
"There has been an overflow error in the Globals' hash key."); |
1805 |
– |
painCave.isFatal = 1; |
1806 |
– |
simError(); |
1807 |
– |
#ifdef IS_MPI |
1808 |
– |
if( painCave.isEventLoop ){ |
1809 |
– |
if( worldRank == 0 ) mpiInterfaceExit(); |
1810 |
– |
} |
1811 |
– |
#endif //is_mpi |
1812 |
– |
} |
1813 |
– |
|
1814 |
– |
return key; |
1815 |
– |
} |
1816 |
– |
|
1817 |
– |
void Globals::addHash( char* text, int token ){ |
1818 |
– |
|
1819 |
– |
int key; |
1820 |
– |
LinkedCommand* the_element; |
1821 |
– |
|
1822 |
– |
the_element = new LinkedCommand; |
1823 |
– |
the_element->setValues( text, token ); |
1824 |
– |
|
1825 |
– |
key = hash( text ); |
1826 |
– |
|
1827 |
– |
the_element->setNext( command_table[key] ); |
1828 |
– |
command_table[key] = the_element; |
1829 |
– |
} |