Molmodel
|
00001 #ifndef SimTK_MOLMODEL_VELOCITY_RESCALING_THERMOSTAT_H_ 00002 #define SimTK_MOLMODEL_VELOCITY_RESCALING_THERMOSTAT_H_ 00003 /* -------------------------------------------------------------------------- * 00004 * SimTK Core: SimTK Simbody(tm) * 00005 * -------------------------------------------------------------------------- * 00006 * This is part of the SimTK Core biosimulation toolkit originating from * 00007 * Simbios, the NIH National Center for Physics-Based Simulation of * 00008 * Biological Structures at Stanford, funded under the NIH Roadmap for * 00009 * Medical Research, grant U54 GM072970. See https://simtk.org. * 00010 * * 00011 * Portions copyright (c) 2007-9 Stanford University and the Authors. * 00012 * Authors: Peter Eastman * 00013 * Contributors: Michael Sherman * 00014 * * 00015 * Permission is hereby granted, free of charge, to any person obtaining a * 00016 * copy of this software and associated documentation files (the "Software"), * 00017 * to deal in the Software without restriction, including without limitation * 00018 * the rights to use, copy, modify, merge, publish, distribute, sublicense, * 00019 * and/or sell copies of the Software, and to permit persons to whom the * 00020 * Software is furnished to do so, subject to the following conditions: * 00021 * * 00022 * The above copyright notice and this permission notice shall be included in * 00023 * all copies or substantial portions of the Software. * 00024 * * 00025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 00026 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 00027 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 00028 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 00029 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 00030 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * 00031 * USE OR OTHER DEALINGS IN THE SOFTWARE. * 00032 * -------------------------------------------------------------------------- */ 00033 00034 #include "SimTKsimbody.h" 00035 #include "molmodel/internal/common.h" 00036 #include "molmodel/internal/MolecularMechanicsSystem.h" 00037 00038 namespace SimTK { 00039 00076 class SimTK_MOLMODEL_EXPORT VelocityRescalingThermostat 00077 : public PeriodicEventHandler { 00078 public: 00107 explicit VelocityRescalingThermostat 00108 (const MolecularMechanicsSystem& system, 00109 Real bathTemperature = 293.15, 00110 Real rescalingInterval = 1, 00111 int numExcludedDofs = 6); 00112 00115 Real getBathTemperature() const; 00116 00126 VelocityRescalingThermostat& setBathTemperature(Real bathTemperature); 00127 00128 00133 int getNumExcludedDofs() const; 00134 00144 VelocityRescalingThermostat& setNumExcludedDofs(int numExcludedDofs); 00145 00146 00159 Real calcCurrentTemperature(const State& state) const; 00160 00171 int calcNumThermalDofs(const State& state) const; 00172 00189 void rescale(State& state) const; 00190 00191 // This is the concrete implementation of the handleEvent() virtual 00192 // method required by every EventHandler; don't call this directly, 00193 // use rescale() instead. 00195 void handleEvent(State& state, Real accuracy, 00196 const Vector& yWeights, const Vector& ooConstraintTols, 00197 Stage& lowestModified, bool& shouldTerminate) const; 00199 00200 ~VelocityRescalingThermostat(); 00201 00202 // Don't show these in Doxygen. 00204 // OBSOLETE, use getBathTemperature() instead. 00205 Real getTemperature() const {return getBathTemperature();} 00206 // OBSOLETE, use setBathTemperature() instead. 00207 void setTemperature(Real t) {setBathTemperature(t);} 00209 private: 00210 class VelocityRescalingThermostatImpl; 00211 VelocityRescalingThermostatImpl* impl; 00212 }; 00213 00214 } // namespace SimTK 00215 00216 #endif // SimTK_MOLMODEL_VELOCITY_RESCALING_THERMOSTAT_H_