Changeset ef7d30


Ignore:
Timestamp:
Jun 29, 2010, 1:04:40 PM (15 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:
8e0c63
Parents:
52d777
Message:

MEMFIX: ForceMatrix in VelocityVerletIntegration had a stupid offset.

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/VerletIntegrationAction.cpp

    r52d777 ref7d30  
    6262    char outputname[MAXSTRINGSIZE];
    6363    strcpy(outputname, filename.c_str());
    64     if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig())))
     64    if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig()), 0))
    6565      DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    6666    else
  • src/atom_trajectoryparticle.cpp

    r52d777 ref7d30  
    106106 * \param *Force matrix with forces
    107107 */
    108 void TrajectoryParticle::VelocityVerletUpdate(int NextStep, config *configuration, ForceMatrix *Force)
     108void TrajectoryParticle::VelocityVerletUpdate(int NextStep, config *configuration, ForceMatrix *Force, const size_t offset)
    109109{
    110110  //a = configuration.Deltat*0.5/walker->type->mass;        // (F+F_old)/2m = a and thus: v = (F+F_old)/2m * t = (F + F_old) * a
    111111  for (int d=0; d<NDIM; d++) {
    112     Trajectory.F.at(NextStep)[d] = -Force->Matrix[0][nr][d+5]*(configuration->GetIsAngstroem() ? AtomicLengthToAngstroem : 1.);
     112    Trajectory.F.at(NextStep)[d] = -Force->Matrix[0][nr][d+offset]*(configuration->GetIsAngstroem() ? AtomicLengthToAngstroem : 1.);
    113113    Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d];
    114114    Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]);     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
  • src/atom_trajectoryparticle.hpp

    r52d777 ref7d30  
    5050  void ResizeTrajectory(int MaxSteps);
    5151  void CopyStepOnStep(int dest, int src);
    52   void VelocityVerletUpdate(int MDSteps, config *configuration, ForceMatrix *Force);
     52  void VelocityVerletUpdate(int MDSteps, config *configuration, ForceMatrix *Force, const size_t offset);
    5353  void SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const;
    5454
  • src/molecule.hpp

    r52d777 ref7d30  
    279279  void SetBoxDimension(Vector *dim);
    280280  void ScanForPeriodicCorrection();
    281   bool VerletForceIntegration(char *file, config &configuration);
     281  bool VerletForceIntegration(char *file, config &configuration, const size_t offset);
    282282  void Thermostats(config &configuration, double ActualTemp, int Thermostat);
    283283  void PrincipalAxisSystem(bool DoRotate);
  • src/molecule_dynamics.cpp

    r52d777 ref7d30  
    540540 * have to transform them).
    541541 * This adds a new MD step to the config file.
    542  * \param *out output stream for debugging
    543542 * \param *file filename
    544543 * \param config structure with config::Deltat, config::IsAngstroem, config::DoConstrained
    545  * \param delta_t time step width in atomic units
    546  * \param IsAngstroem whether coordinates are in angstroem (true) or bohrradius (false)
    547  * \param DoConstrained whether we perform a constrained (>0, target step in molecule::trajectories) or unconstrained (0) molecular dynamics, \sa molecule::MinimiseConstrainedPotential()
     544 * \param offset offset in matrix file to the first force component
    548545 * \return true - file found and parsed, false - file not found or imparsable
    549546 * \todo This is not yet checked if it is correctly working with DoConstrained set to true.
    550547 */
    551 bool molecule::VerletForceIntegration(char *file, config &configuration)
     548bool molecule::VerletForceIntegration(char *file, config &configuration, const size_t offset)
    552549{
    553550  Info FunctionInfo(__func__);
     
    561558  CountElements();  // make sure ElementsInMolecule is up to date
    562559
     560  const int AtomCount = getAtomCount();
    563561  // check file
    564562  if (input == NULL) {
     
    571569      return false;
    572570    }
    573     if (Force.RowCounter[0] != getAtomCount()) {
     571    if (Force.RowCounter[0] != AtomCount) {
    574572      DoeLog(0) && (eLog()<< Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << getAtomCount() << "." << endl);
    575573      performCriticalExit();
     
    578576    // correct Forces
    579577    Velocity.Zero();
    580     for(int i=0;i<getAtomCount();i++)
     578    for(int i=0;i<AtomCount;i++)
    581579      for(int d=0;d<NDIM;d++) {
    582         Velocity[d] += Force.Matrix[0][i][d+5];
     580        Velocity[d] += Force.Matrix[0][i][d+offset];
    583581      }
    584     for(int i=0;i<getAtomCount();i++)
     582    for(int i=0;i<AtomCount;i++)
    585583      for(int d=0;d<NDIM;d++) {
    586         Force.Matrix[0][i][d+5] -= Velocity[d]/static_cast<double>(getAtomCount());
     584        Force.Matrix[0][i][d+offset] -= Velocity[d]/static_cast<double>(AtomCount);
    587585      }
    588586    // solve a constrained potential if we are meant to
     
    599597    //ActOnAllAtoms( &atom::ResizeTrajectory, MDSteps+10 );
    600598
    601     ActOnAllAtoms( &atom::VelocityVerletUpdate, MDSteps+1, &configuration, &Force);
     599    ActOnAllAtoms( &atom::VelocityVerletUpdate, MDSteps+1, &configuration, &Force, (const size_t) 0);
    602600  }
    603601  // correct velocities (rather momenta) so that center of mass remains motionless
Note: See TracChangeset for help on using the changeset viewer.