Changeset 0a7fad


Ignore:
Timestamp:
Oct 25, 2011, 3:33:14 PM (13 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:
325687
Parents:
1cc661
git-author:
Frederik Heber <heber@…> (05/11/11 07:46:24)
git-committer:
Frederik Heber <heber@…> (10/25/11 15:33:14)
Message:

Refactored part of code in DipoleAngularCorrelation into new method CalculateZeroAngularDipole().

Location:
src/Analysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Analysis/analysis_correlation.cpp

    r1cc661 r0a7fad  
    117117}
    118118
    119 
    120 /** Calculates the dipole angular correlation for given molecule type.
    121  * Calculate the change of the dipole orientation angle over time.
    122  * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
    123  * Angles are given in degrees.
    124  * \param &atoms list of atoms of the molecules taking part (Note: molecules may
    125  * change over time as bond structure is recalculated, hence we need the atoms)
    126  * \return Map of doubles with values the pair of the two atoms.
    127  */
    128 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms)
    129 {
    130   Info FunctionInfo(__func__);
    131   DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap;
     119/** Calculates the angular dipole zero orientation from current time step.
     120 * \param atoms vector of atoms to calculate it for
     121 * \return map with orientation vector for each atomic id given in \a atoms.
     122 */
     123std::map<atomId_t, Vector> CalculateZeroAngularDipole(std::vector<atom *> &atoms)
     124{
     125  // calculate molecules for this time step
    132126  std::set<molecule *> molecules;
    133 
    134   // store original time step
    135   const unsigned int oldtime = WorldTime::getTime();
    136   World::getInstance().setTime(0);
    137   // calculate molecules for this time step
    138127  BOOST_FOREACH(atom *_atom, atoms)
    139128    molecules.insert(_atom->getMolecule());
    140 
    141   BOOST_FOREACH(atom *_atom, World::getInstance().getAllAtoms())
    142     LOG(2, "INFO: Atom " << _atom->getId() << " "
    143         << *dynamic_cast<AtomInfo *>(_atom) <<".");
    144 
    145129
    146130  // get zero orientation for each molecule.
     
    153137    LOG(2,"INFO: Zero alignment for molecule " << _mol->getId() << " is " << Dipole);
    154138  }
    155   LOG(1,"INFO: We calculated zero orientation for a total of " << molecules.size() << " molecules.");
     139  LOG(1,"INFO: We calculated zero orientation for a total of " << molecules.size() << " molecule(s).");
     140
     141  return ZeroVector;
     142}
     143
     144/** Calculates the dipole angular correlation for given molecule type.
     145 * Calculate the change of the dipole orientation angle over time.
     146 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
     147 * Angles are given in degrees.
     148 * \param &atoms list of atoms of the molecules taking part (Note: molecules may
     149 * change over time as bond structure is recalculated, hence we need the atoms)
     150 * \return Map of doubles with values the pair of the two atoms.
     151 */
     152DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms)
     153{
     154  Info FunctionInfo(__func__);
     155  DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap;
     156
     157  // store original time step
     158  const unsigned int oldtime = WorldTime::getTime();
     159  World::getInstance().setTime(0);
     160
     161  // calculate molecules for this time step
     162  std::set<molecule *> molecules;
     163  BOOST_FOREACH(atom *_atom, atoms)
     164    molecules.insert(_atom->getMolecule());
     165
     166  BOOST_FOREACH(atom *_atom, World::getInstance().getAllAtoms())
     167    LOG(2, "INFO: Atom " << _atom->getId() << " "
     168        << *dynamic_cast<AtomInfo *>(_atom) <<".");
     169
     170
     171  // get zero orientation for each molecule.
     172  std::map<atomId_t, Vector> ZeroVector = CalculateZeroAngularDipole(atoms);
    156173
    157174  // go through every time step
  • src/Analysis/analysis_correlation.hpp

    r1cc661 r0a7fad  
    5656
    5757range<size_t> getMaximumTrajectoryBounds(std::vector<atom *> &atoms);
     58std::map<atomId_t, Vector> CalculateZeroAngularDipole(std::vector<atom *> &atoms);
    5859
    5960DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms);
Note: See TracChangeset for help on using the changeset viewer.