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

MEMFIX: ForceMatrix in VelocityVerletIntegration had a stupid offset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.