45#include "rnemd/RNEMDParameters.hpp"
51namespace OpenMD::RNEMD {
53 RNEMDParameters::RNEMDParameters() {
54 DefineOptionalParameterWithDefaultValue(UseRNEMD,
"useRNEMD",
false);
55 DefineOptionalParameterWithDefaultValue(ObjectSelection,
"objectSelection",
58 DefineOptionalParameterWithDefaultValue(Method,
"method",
"VSS");
59 DefineOptionalParameter(FluxType,
"fluxType");
61 DefineOptionalParameterWithDefaultValue(ExchangeTime,
"exchangeTime",
63 DefineOptionalParameter(KineticFlux,
"kineticFlux");
64 DefineOptionalParameter(ParticleFlux,
"particleFlux");
65 DefineOptionalParameter(MomentumFlux,
"momentumFlux");
66 DefineOptionalParameter(MomentumFluxVector,
"momentumFluxVector");
67 DefineOptionalParameter(AngularMomentumFlux,
"angularMomentumFlux");
68 DefineOptionalParameter(AngularMomentumFluxVector,
69 "angularMomentumFluxVector");
70 DefineOptionalParameter(SlabWidth,
"slabWidth");
71 DefineOptionalParameter(SlabACenter,
"slabAcenter");
72 DefineOptionalParameter(SlabBCenter,
"slabBcenter");
73 DefineOptionalParameter(SphereARadius,
"sphereAradius");
74 DefineOptionalParameter(SphereBRadius,
"sphereBradius");
75 DefineOptionalParameter(SelectionA,
"selectionA");
76 DefineOptionalParameter(SelectionB,
"selectionB");
77 DefineOptionalParameter(CoordinateOrigin,
"coordinateOrigin");
78 DefineOptionalParameter(OutputFileName,
"outputFileName");
79 DefineOptionalParameterWithDefaultValue(OutputBins,
"outputBins", 20);
80 DefineOptionalParameterWithDefaultValue(OutputBinWidth,
"outputBinWidth",
82 DefineOptionalParameter(OutputSelection,
"outputSelection");
83 DefineOptionalParameter(OutputFields,
"outputFields");
84 DefineOptionalParameter(DividingArea,
"dividingArea");
85 DefineOptionalParameterWithDefaultValue(PrivilegedAxis,
"privilegedAxis",
87 DefineOptionalParameterWithDefaultValue(SPFScalingPower,
"spfScalingPower",
89 DefineOptionalParameterWithDefaultValue(SPFUniformKineticScaling,
90 "spfUniformKineticScaling",
false);
93 void RNEMDParameters::validate() {
94 CheckParameter(ExchangeTime, isPositive());
95 CheckParameter(OutputBins, isPositive());
96 CheckParameter(OutputBinWidth, isPositive());
97 CheckParameter(Method,
98 isEqualIgnoreCase(
"Swap") || isEqualIgnoreCase(
"NIVS") ||
99 isEqualIgnoreCase(
"VSS") || isEqualIgnoreCase(
"SPF"));
102 isEqualIgnoreCase(
"KE") || isEqualIgnoreCase(
"Px") ||
103 isEqualIgnoreCase(
"Py") || isEqualIgnoreCase(
"Pz") ||
104 isEqualIgnoreCase(
"Lx") || isEqualIgnoreCase(
"Ly") ||
105 isEqualIgnoreCase(
"Lz") || isEqualIgnoreCase(
"Pvector") ||
106 isEqualIgnoreCase(
"Lvector") || isEqualIgnoreCase(
"KE+Px") ||
107 isEqualIgnoreCase(
"KE+Py") || isEqualIgnoreCase(
"KE+Lx") ||
108 isEqualIgnoreCase(
"KE+Ly") || isEqualIgnoreCase(
"KE+Lz") ||
109 isEqualIgnoreCase(
"KE+Pvector") ||
110 isEqualIgnoreCase(
"KE+Lvector") || isEqualIgnoreCase(
"Particle") ||
111 isEqualIgnoreCase(
"Particle+KE"));
112 CheckParameter(PrivilegedAxis, isEqualIgnoreCase(
"x") ||
113 isEqualIgnoreCase(
"y") ||
114 isEqualIgnoreCase(
"z"));
117 bool RNEMDParameters::requiresElectricField() {
118 static bool wasParsed {
false};
121 StringTokenizer tokenizer(getOutputFields(),
" ,;|\t\n\r");
123 while (tokenizer.hasMoreTokens()) {
124 std::string token(tokenizer.nextToken());
127 if (token ==
"ELECTRICFIELD" || token ==
"ELECTROSTATICPOTENTIAL") {
128 calculateElectricField_ =
true;
136 return calculateElectricField_;