Changeset 8f4df1 for src/atom_trajectoryparticle.cpp
- Timestamp:
- Aug 7, 2010, 12:07:04 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, Candidate_v1.7.0, 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:
- 2d292d
- Parents:
- 8d6d31 (diff), d74077 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/atom_trajectoryparticle.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/atom_trajectoryparticle.cpp
r8d6d31 r8f4df1 38 38 { 39 39 for (int i=NDIM;i--;) 40 *temperature += type->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];40 *temperature += getType()->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i]; 41 41 }; 42 42 … … 65 65 for(int d=0;d<NDIM;d++) { 66 66 Trajectory.U.at(Step)[d] -= CoGVelocity->at(d); 67 *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];67 *ActualTemp += 0.5 * getType()->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d]; 68 68 } 69 69 }; … … 113 113 Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d]; 114 114 Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2 115 Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/ type->mass); // F = m * a and s =115 Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->mass); // F = m * a and s = 116 116 } 117 117 // Update U 118 118 for (int d=0; d<NDIM; d++) { 119 119 Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d]; 120 Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/ type->mass); // v = F/m * t120 Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->mass); // v = F/m * t 121 121 } 122 122 // Update R (and F) … … 137 137 void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const 138 138 { 139 *TotalMass += type->mass; // sum up total mass139 *TotalMass += getType()->mass; // sum up total mass 140 140 for(int d=0;d<NDIM;d++) { 141 TotalVelocity->at(d) += Trajectory.U.at(Step)[d]* type->mass;141 TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->mass; 142 142 } 143 143 }; … … 154 154 for (int d=0; d<NDIM; d++) { 155 155 U[d] *= ScaleTempFactor; 156 *ekin += 0.5* type->mass * U[d]*U[d];156 *ekin += 0.5*getType()->mass * U[d]*U[d]; 157 157 } 158 158 }; … … 170 170 for (int d=0; d<NDIM; d++) { 171 171 *G += U[d] * F[d]; 172 *E += U[d]*U[d]* type->mass;172 *E += U[d]*U[d]*getType()->mass; 173 173 } 174 174 }; … … 185 185 if (FixedIon == 0) // even FixedIon moves, only not by other's forces 186 186 for (int d=0; d<NDIM; d++) { 187 U[d] += configuration->Deltat/ type->mass * ( (G_over_E) * (U[d]*type->mass) );188 *ekin += type->mass * U[d]*U[d];187 U[d] += configuration->Deltat/getType()->mass * ( (G_over_E) * (U[d]*getType()->mass) ); 188 *ekin += getType()->mass * U[d]*U[d]; 189 189 } 190 190 }; … … 198 198 void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration) 199 199 { 200 double sigma = sqrt(configuration->Thermostats->TargetTemp/ type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)200 double sigma = sqrt(configuration->Thermostats->TargetTemp/getType()->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime) 201 201 Vector &U = Trajectory.U.at(Step); 202 202 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces … … 211 211 } 212 212 for (int d=0; d<NDIM; d++) 213 *ekin += 0.5* type->mass * U[d]*U[d];213 *ekin += 0.5*getType()->mass * U[d]*U[d]; 214 214 } 215 215 }; … … 227 227 for (int d=0; d<NDIM; d++) { 228 228 U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1)); 229 *ekin += 0.5* type->mass * U[d]*U[d];229 *ekin += 0.5*getType()->mass * U[d]*U[d]; 230 230 } 231 231 } … … 241 241 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 242 242 for (int d=0; d<NDIM; d++) { 243 *delta_alpha += U[d]*U[d]* type->mass;243 *delta_alpha += U[d]*U[d]*getType()->mass; 244 244 } 245 245 } … … 256 256 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 257 257 for (int d=0; d<NDIM; d++) { 258 U[d] += configuration->Deltat/ type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));259 *ekin += (0.5* type->mass) * U[d]*U[d];258 U[d] += configuration->Deltat/getType()->mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass)); 259 *ekin += (0.5*getType()->mass) * U[d]*U[d]; 260 260 } 261 261 } 262 262 }; 263 264 265 std::ostream & TrajectoryParticle::operator << (std::ostream &ost) const 266 { 267 ParticleInfo::operator<<(ost); 268 ost << "," << getPosition(); 269 return ost; 270 } 271 272 std::ostream & operator << (std::ostream &ost, const TrajectoryParticle &a) 273 { 274 a.ParticleInfo::operator<<(ost); 275 ost << "," << a.getPosition(); 276 return ost; 277 } 278
Note:
See TracChangeset
for help on using the changeset viewer.
