Changeset d93d2c for src/Actions


Ignore:
Timestamp:
Feb 11, 2016, 8:03:36 AM (9 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:
cbd409
Parents:
45b45d
git-author:
Frederik Heber <heber@…> (02/08/16 15:47:17)
git-committer:
Frederik Heber <heber@…> (02/11/16 08:03:36)
Message:

FIX: Long-range forces were not added onto atom's forces.

  • this was with highest level forces obtained from fragmentation for the short-range interactions but not for the long-range interactions.
  • TESTS: added additional tests to Fragmentation AnalyseFragmentationResults to compare long-range forces written to tremolo file in the same way as is already done with short-range.
  • TESTFIX: Needed to re-calculate all Fragment result files, did for short-range and both long-range versions. Energies slightly changed and thus also derived values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp

    r45b45d rd93d2c  
    533533}
    534534
     535static void AddForces(
     536    const IndexedVectors::indexedvectors_t &_forces,
     537    const bool _IsAngstroem)
     538{
     539  for(IndexedVectors::indexedvectors_t::const_iterator iter = _forces.begin();
     540      iter != _forces.end(); ++iter) {
     541    const IndexedVectors::index_t &index = iter->first;
     542    const IndexedVectors::vector_t &forcevector = iter->second;
     543    ASSERT( forcevector.size() == NDIM,
     544        "printReceivedShortResults() - obtained force vector has incorrect dimension.");
     545    // note that mpqc calculates a gradient, hence force pointing into opposite direction
     546    // we have to mind different units here: MPQC has a_o, while we may have angstroem
     547    Vector ForceVector(-forcevector[0], -forcevector[1], -forcevector[2]);
     548    if (_IsAngstroem)
     549      for (size_t i=0;i<NDIM;++i)
     550        ForceVector[i] *= AtomicLengthToAngstroem;
     551    atom *_atom = World::getInstance().getAtom(AtomById(index));
     552    if(_atom != NULL)
     553      _atom->setAtomicForce(_atom->getAtomicForce() + ForceVector);
     554    else
     555      ELOG(2, "Could not find atom to id " << index << ".");
     556  }
     557}
     558
    535559ActionState::ptr FragmentationAnalyseFragmentationResultsAction::performCall() {
    536560
     
    617641  // adding obtained forces
    618642  if ( const_cast<const World &>(World::getInstance()).getAllAtoms().size() != 0) {
    619     const IndexedVectors::indexedvectors_t forces =
     643    const IndexedVectors::indexedvectors_t shortrange_forces =
    620644        boost::fusion::at_key<MPQCDataFused::forces>(
    621645            shortrangeresults.Result_Force_fused.back()
    622646            ).getVectors();
    623         ;
    624     for(IndexedVectors::indexedvectors_t::const_iterator iter = forces.begin();
    625         iter != forces.end(); ++iter) {
    626       const IndexedVectors::index_t &index = iter->first;
    627       const IndexedVectors::vector_t &forcevector = iter->second;
    628       ASSERT( forcevector.size() == NDIM,
    629           "printReceivedShortResults() - obtained force vector has incorrect dimension.");
    630       // note that mpqc calculates a gradient, hence force pointing into opposite direction
    631       // we have to mind different units here: MPQC has a_o, while we may have angstroem
    632       Vector ForceVector(-forcevector[0], -forcevector[1], -forcevector[2]);
    633       if (IsAngstroem)
    634         for (size_t i=0;i<NDIM;++i)
    635           ForceVector[i] *= AtomicLengthToAngstroem;
    636       atom *_atom = World::getInstance().getAtom(AtomById(index));
    637       if(_atom != NULL)
    638         _atom->setAtomicForce(_atom->getAtomicForce() + ForceVector);
    639       else
    640         ELOG(2, "Could not find atom to id " << index << ".");
    641     }
     647    AddForces(shortrange_forces,IsAngstroem);
    642648  } else {
    643649    LOG(1, "INFO: Full molecule not loaded, hence will not add forces to atoms.");
     
    675681    printReceivedFullResults(longrangeresults);
    676682
     683    // add long-range forces
     684    if ( const_cast<const World &>(World::getInstance()).getAllAtoms().size() != 0) {
     685      const IndexedVectors::indexedvectors_t longrange_forces =
     686          boost::fusion::at_key<VMGDataFused::forces_longrange>(
     687              longrangeresults.Result_ForcesLongRangeIntegrated_fused.back()
     688              ).getVectors();
     689      AddForces(longrange_forces,IsAngstroem);
     690    } else {
     691      LOG(1, "INFO: Full molecule not loaded, hence will not add forces to atoms.");
     692    }
     693
    677694    // append all keysets to homology file
    678695    appendToHomologies(shortrangeresults, longrangeresults, params.DoStoreGrids.get());
Note: See TracChangeset for help on using the changeset viewer.