Changeset e5ebaf


Ignore:
Timestamp:
Jul 9, 2013, 6:21:05 AM (11 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:
f73351
Parents:
ec5d0c
git-author:
Frederik Heber <heber@…> (06/18/13 14:29:50)
git-committer:
Frederik Heber <heber@…> (07/09/13 06:21:05)
Message:

Forces obtained from fragmentation summation are now set.

Files:
1 added
3 edited

Legend:

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

    rec5d0c re5ebaf  
    4141#include "CodePatterns/MemDebug.hpp"
    4242
     43#include <boost/foreach.hpp>
    4344#include <boost/mpl/remove.hpp>
    4445
     
    5859#endif
    5960
     61#include "Descriptors/AtomIdDescriptor.hpp"
    6062#include "Fragmentation/Summation/Containers/FragmentationChargeDensity.hpp"
    6163#include "Fragmentation/Summation/Containers/FragmentationLongRangeResults.hpp"
     
    7981#include "Fragmentation/Summation/Containers/VMGData_printKeyNames.hpp"
    8082#endif
     83#include "Helpers/defs.hpp"
    8184#include "World.hpp"
    8285
     
    248251  IndexSetContainer::Container_t::const_iterator iter = Indices.begin();
    249252  IndexSetContainer::Container_t::const_iterator forceiter = ForceIndices.begin();
     253
    250254  /// go through all fragments
    251255  for (;iter != Indices.end(); ++iter, ++forceiter) // go through each IndexSet
     
    338342  const KeySetsContainer &forcekeysets = container.getForceKeySets();
    339343  const bool DoLongrange = container.areFullRangeResultsPresent();
     344  const bool IsAngstroem = true;
    340345
    341346  if (keysets.KeySets.empty()) {
     
    347352  shortrangeresults(shortrangedata);
    348353  printReceivedShortResults(shortrangeresults);
     354
     355  // adding obtained forces
     356  if ( World::getInstance().getAllAtoms().size() != 0) {
     357    const IndexedVectors::indexedvectors_t forces =
     358        boost::fusion::at_key<MPQCDataFused::forces>(
     359            shortrangeresults.Result_Force_fused.back()
     360            ).getVectors();
     361        ;
     362    for(IndexedVectors::indexedvectors_t::const_iterator iter = forces.begin();
     363        iter != forces.end(); ++iter) {
     364      const IndexedVectors::index_t &index = iter->first;
     365      const IndexedVectors::vector_t &forcevector = iter->second;
     366      ASSERT( forcevector.size() == NDIM,
     367          "printReceivedShortResults() - obtained force vector has incorrect dimension.");
     368      // note that mpqc calculates a gradient, hence force pointing into opposite direction
     369      // we have to mind different units here: MPQC has a_o, while we may have angstroem
     370      Vector ForceVector(-forcevector[0], -forcevector[1], -forcevector[2]);
     371      if (IsAngstroem)
     372        for (size_t i=0;i<NDIM;++i)
     373          ForceVector[i] *= AtomicLengthToAngstroem;
     374      atom *_atom = World::getInstance().getAtom(AtomById(index));
     375      if(_atom != NULL)
     376        _atom->setAtomicForce(_atom->getAtomicForce() + ForceVector);
     377      else
     378        ELOG(2, "Could not find atom to id " << index << ".");
     379    }
     380  } else {
     381    LOG(1, "INFO: Full molecule not loaded, hence will not add forces to atoms.");
     382  }
    349383
    350384#ifdef HAVE_VMG
  • src/Fragmentation/Summation/SetValues/IndexedVectors.hpp

    rec5d0c re5ebaf  
    9595  }
    9696
     97  /** Const getter to index vectors.
     98   *
     99   * \return const reference to indexed vectors
     100   */
     101  const indexedvectors_t& getVectors() const
     102  { return vectors; }
     103
    97104private:
    98105  /** Helper function that contains all the logic of how to superpose two
  • tests/regression/Fragmentation/AnalyseFragmentationResults/testsuite-fragmentation-analyse-fragment-results.at

    rec5d0c re5ebaf  
    3737AT_CLEANUP
    3838
     39AT_SETUP([Fragmentation - Analyse short-range fragmentation results with forces])
     40AT_KEYWORDS([fragmentation analyse-fragment-results forces])
     41
     42file=BondFragmentShortRangeResults.dat
     43AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/$file $file], 0)
     44AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
     45AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/alkane-3.pdb -o tremolo --set-tremolo-atomdata "Id type x=3 u=3 F=3" --reset 1 --analyse-fragment-results --fragment-resultfile $file], 0, [ignore], [ignore])
     46AT_CHECK([diff alkane-3.data ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/alkane-3.data], 0, [ignore], [ignore])
     47
     48AT_CLEANUP
     49
    3950#
    4051# BondFragmentLongRangeResults.dat is created like this:
     
    4758AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/$file $file], 0)
    4859AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    49 AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/alkane-3.pdb --analyse-fragment-results --fragment-resultfile $file], 0, [ignore], [stderr])
     60AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/pre/alkane-3.pdb -o tremolo --set-tremolo-atomdata "Id type x=3 u=3 F=3" --reset 1 --analyse-fragment-results --fragment-resultfile $file], 0, [ignore], [stderr])
     61AT_CHECK([diff alkane-3.data ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/alkane-3.data], 0, [ignore], [ignore])
    5062AT_CHECK([output=BondFragment_Energy.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
    5163AT_CHECK([output=BondFragment_Forces.dat; diff $output ${abs_top_srcdir}/tests/regression/Fragmentation/AnalyseFragmentationResults/post/LongRange/$output], 0, [ignore], [ignore])
Note: See TracChangeset for help on using the changeset viewer.