Changeset 14c57a for src/atom_trajectoryparticle.cpp
- Timestamp:
- Aug 25, 2010, 12:04:11 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 51c3e4
- Parents:
- 8d1dd4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/atom_trajectoryparticle.cpp
r8d1dd4 r14c57a 144 144 }; 145 145 146 /** Scales velocity of atom according to Woodcock thermostat.147 * \param ScaleTempFactor factor to scale the velocities with (i.e. sqrt of energy scale factor)148 * \param Step MD step to scale149 * \param *ekin sum of kinetic energy150 */151 void TrajectoryParticle::Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin)152 {153 Vector &U = Trajectory.U.at(Step);154 if (FixedIon == 0) // even FixedIon moves, only not by other's forces155 for (int d=0; d<NDIM; d++) {156 U[d] *= ScaleTempFactor;157 *ekin += 0.5*getType()->mass * U[d]*U[d];158 }159 };160 161 /** Scales velocity of atom according to Gaussian thermostat.162 * \param Step MD step to scale163 * \param *G164 * \param *E165 */166 void TrajectoryParticle::Thermostat_Gaussian_init(int Step, double *G, double *E)167 {168 Vector &U = Trajectory.U.at(Step);169 Vector &F = Trajectory.F.at(Step);170 if (FixedIon == 0) // even FixedIon moves, only not by other's forces171 for (int d=0; d<NDIM; d++) {172 *G += U[d] * F[d];173 *E += U[d]*U[d]*getType()->mass;174 }175 };176 177 /** Determines scale factors according to Gaussian thermostat.178 * \param Step MD step to scale179 * \param GE G over E ratio180 * \param *ekin sum of kinetic energy181 * \param *configuration configuration class with TempFrequency and TargetTemp182 */183 void TrajectoryParticle::Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration)184 {185 Vector &U = Trajectory.U.at(Step);186 if (FixedIon == 0) // even FixedIon moves, only not by other's forces187 for (int d=0; d<NDIM; d++) {188 U[d] += configuration->Deltat/getType()->mass * ( (G_over_E) * (U[d]*getType()->mass) );189 *ekin += getType()->mass * U[d]*U[d];190 }191 };192 193 /** Scales velocity of atom according to Langevin thermostat.194 * \param Step MD step to scale195 * \param *r random number generator196 * \param *ekin sum of kinetic energy197 * \param *configuration configuration class with TempFrequency and TargetTemp198 */199 void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)200 {201 double sigma = sqrt(configuration->Thermostats->TargetTemp/getType()->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)202 Vector &U = Trajectory.U.at(Step);203 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces204 // throw a dice to determine whether it gets hit by a heat bath particle205 if (((((rand()/(double)RAND_MAX))*configuration->Thermostats->TempFrequency) < 1.)) {206 DoLog(3) && (Log() << Verbose(3) << "Particle " << *this << " was hit (sigma " << sigma << "): " << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << " -> ");207 // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis208 for (int d=0; d<NDIM; d++) {209 U[d] = gsl_ran_gaussian (r, sigma);210 }211 DoLog(2) && (Log() << Verbose(2) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl);212 }213 for (int d=0; d<NDIM; d++)214 *ekin += 0.5*getType()->mass * U[d]*U[d];215 }216 };217 218 /** Scales velocity of atom according to Berendsen thermostat.219 * \param Step MD step to scale220 * \param ScaleTempFactor factor to scale energy (not velocity!) with221 * \param *ekin sum of kinetic energy222 * \param *configuration configuration class with TempFrequency and Deltat223 */224 void TrajectoryParticle::Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration)225 {226 Vector &U = Trajectory.U.at(Step);227 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces228 for (int d=0; d<NDIM; d++) {229 U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));230 *ekin += 0.5*getType()->mass * U[d]*U[d];231 }232 }233 };234 235 /** Initializes current run of NoseHoover thermostat.236 * \param Step MD step to scale237 * \param *delta_alpha additional sum of kinetic energy on return238 */239 void TrajectoryParticle::Thermostat_NoseHoover_init(int Step, double *delta_alpha)240 {241 Vector &U = Trajectory.U.at(Step);242 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces243 for (int d=0; d<NDIM; d++) {244 *delta_alpha += U[d]*U[d]*getType()->mass;245 }246 }247 };248 249 /** Initializes current run of NoseHoover thermostat.250 * \param Step MD step to scale251 * \param *ekin sum of kinetic energy252 * \param *configuration configuration class with TempFrequency and Deltat253 */254 void TrajectoryParticle::Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration)255 {256 Vector &U = Trajectory.U.at(Step);257 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces258 for (int d=0; d<NDIM; d++) {259 U[d] += configuration->Deltat/getType()->mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass));260 *ekin += (0.5*getType()->mass) * U[d]*U[d];261 }262 }263 };264 265 266 146 std::ostream & TrajectoryParticle::operator << (std::ostream &ost) const 267 147 {
Note:
See TracChangeset
for help on using the changeset viewer.