Changeset 4882d5 for src/Atom


Ignore:
Timestamp:
Dec 14, 2012, 5:39:30 PM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
5251af
Parents:
8b886f
git-author:
Frederik Heber <heber@…> (10/05/12 07:59:22)
git-committer:
Frederik Heber <heber@…> (12/14/12 17:39:30)
Message:

Rewrote VerletIntegrationAction to diminish dependence on ForceMatrix.

  • atom::VelocityVerletUpdate() now works on the forces stored in AtomicForces.
  • ThermoStatContainer::getActive() getter for the currently active thermostat.
  • VerletForceIntegration::operator() split up into several smaller functions.
Location:
src/Atom
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Atom/atom_atominfo.cpp

    r8b886f r4882d5  
    584584 * \param Deltat time step width
    585585 * \param IsAngstroem whether the force's underlying unit of length is angstroem or bohr radii
    586  * \param *Force matrix with forces
    587  */
    588 void AtomInfo::VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem, ForceMatrix *Force, const size_t offset)
    589 {
     586 */
     587void AtomInfo::VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem)
     588{
     589  const unsigned int LastStep = NextStep == 0 ? 0 : NextStep-1;
     590
    590591  LOG(2, "INFO: Particle that currently " << *this);
    591592  LOG(2, "INFO: Integrating with mass=" << getMass() << " and Deltat="
     
    593594  // update force
    594595  // (F+F_old)/2m = a and thus: v = (F+F_old)/2m * t = (F + F_old) * a
    595   Vector tempVector;
    596   for (int d=0; d<NDIM; d++) {
    597     ASSERT(Force->RowCounter[0] > nr,
    598         "AtomInfo::VelocityVerletUpdate() - "+toString(nr)
    599         +" out of bounds [0,"+toString(Force->RowCounter[0])
    600         +"] access on force matrix.");
    601     ASSERT(Force->ColumnCounter[0] > d+(int)offset,
    602         "AtomInfo::VelocityVerletUpdate() - "+toString(d+offset)
    603         +" out of bounds [0,"+toString(Force->ColumnCounter[0])
    604         +"] access on force matrix.");
    605     tempVector[d] = -Force->Matrix[0][nr][d+offset]*(IsAngstroem ? AtomicLengthToAngstroem : 1.);
    606   }
    607   LOG(3, "INFO: Force at step " << NextStep << " set to " << tempVector);
    608   setAtomicForceAtStep(NextStep, tempVector);
     596  LOG(3, "INFO: Force at step " << NextStep << " is " << getAtomicForceAtStep(NextStep));
    609597
    610598  // update position
    611   tempVector = getPositionAtStep(NextStep-1);
    612   LOG(4, "INFO: initial position from last step " << setprecision(4) << tempVector);
    613   tempVector += Deltat*(getAtomicVelocityAtStep(NextStep-1));     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
    614   LOG(4, "INFO: position with velocity " << getAtomicVelocityAtStep(NextStep-1) << " from last step " << tempVector);
    615   tempVector += 0.5*Deltat*Deltat*(getAtomicForceAtStep(NextStep))*(1./getMass());     // F = m * a and s =
    616   LOG(4, "INFO: position with force " << getAtomicForceAtStep(NextStep) << " from last step " << tempVector);
    617   setPositionAtStep(NextStep, tempVector);
    618   LOG(3, "INFO: Position at step " << NextStep << " set to " << tempVector);
     599  {
     600    Vector tempVector = getPositionAtStep(LastStep);
     601    LOG(4, "INFO: initial position from last step " << setprecision(4) << tempVector);
     602    tempVector += Deltat*(getAtomicVelocityAtStep(LastStep));     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
     603    LOG(4, "INFO: position with velocity " << getAtomicVelocityAtStep(LastStep) << " from last step " << tempVector);
     604    tempVector += .5*Deltat*Deltat*(getAtomicForceAtStep(LastStep))*(1./getMass());     // F = m * a and s =
     605    LOG(4, "INFO: position with force " << getAtomicForceAtStep(NextStep) << " from last step " << tempVector);
     606    setPositionAtStep(NextStep, tempVector);
     607    LOG(3, "INFO: Position at step " << NextStep << " set to " << tempVector);
     608  }
    619609
    620610  // Update U
    621   tempVector = getAtomicVelocityAtStep(NextStep-1);
    622   LOG(4, "INFO: initial velocity from last step " << tempVector);
    623   tempVector += Deltat * (getAtomicForceAtStep(NextStep)+getAtomicForceAtStep(NextStep-1))*(1./getMass()); // v = F/m * t
    624   LOG(4, "INFO: Velocity with force from last " << getAtomicForceAtStep(NextStep-1)
    625       << " and present " << getAtomicForceAtStep(NextStep) << " step " << tempVector);
    626   setAtomicVelocityAtStep(NextStep, tempVector);
    627   LOG(3, "INFO: Velocity at step " << NextStep << " set to " << tempVector);
     611  {
     612    Vector tempVector = getAtomicVelocityAtStep(LastStep);
     613    LOG(4, "INFO: initial velocity from last step " << tempVector);
     614    tempVector += Deltat * .5*(getAtomicForceAtStep(LastStep)+getAtomicForceAtStep(NextStep))*(1./getMass()); // v = F/m * t
     615    LOG(4, "INFO: Velocity with force from last " << getAtomicForceAtStep(LastStep)
     616        << " and present " << getAtomicForceAtStep(NextStep) << " step " << tempVector);
     617    setAtomicVelocityAtStep(NextStep, tempVector);
     618    LOG(3, "INFO: Velocity at step " << NextStep << " set to " << tempVector);
     619  }
    628620};
    629621
  • src/Atom/atom_atominfo.hpp

    r8b886f r4882d5  
    267267  size_t getTrajectorySize() const;
    268268  void CopyStepOnStep(const unsigned int dest, const unsigned int src);
    269   void VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem, ForceMatrix *Force, const size_t offset);
     269  void VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem);
    270270  double getKineticEnergy(const unsigned int step) const;
    271271  Vector getMomentum(const unsigned int step) const;
Note: See TracChangeset for help on using the changeset viewer.