Changeset 1cc661 for src/Analysis


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:
0a7fad
Parents:
be0c61
git-author:
Frederik Heber <heber@…> (05/11/11 07:37:35)
git-committer:
Frederik Heber <heber@…> (10/25/11 15:33:14)
Message:

Refactored part of DipoleAngularCorrelation into method getTrajectoryBounds().

Location:
src/Analysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Analysis/analysis_correlation.cpp

    rbe0c61 r1cc661  
    9595};
    9696
     97/** Calculate minimum and maximum amount of trajectory steps by going through given atomic trajectories.
     98 * \param vector of atoms whose trajectories to check for [min,max]
     99 * \return range with [min, max]
     100 */
     101range<size_t> getMaximumTrajectoryBounds(std::vector<atom *> &atoms)
     102{
     103  // get highest trajectory size
     104  LOG(0,"STATUS: Retrieving maximum amount of time steps ...");
     105  size_t max_timesteps = 0;
     106  size_t min_timesteps = -1;
     107  BOOST_FOREACH(atom *_atom, atoms) {
     108    if (_atom->getTrajectorySize() > max_timesteps)
     109      max_timesteps  = _atom->getTrajectorySize();
     110    if ((_atom->getTrajectorySize() <= max_timesteps) && (min_timesteps == (size_t)-1))
     111      min_timesteps = _atom->getTrajectorySize();
     112  }
     113  LOG(1,"INFO: Minimum number of time steps found is " << min_timesteps);
     114  LOG(1,"INFO: Maximum number of time steps found is " << max_timesteps);
     115
     116  return range<size_t>(min_timesteps, max_timesteps);
     117}
     118
     119
    97120/** Calculates the dipole angular correlation for given molecule type.
    98121 * Calculate the change of the dipole orientation angle over time.
     
    120143        << *dynamic_cast<AtomInfo *>(_atom) <<".");
    121144
    122   // get highest trajectory size
    123   LOG(0,"STATUS: Retrieving maximum amount of time steps ...");
    124   size_t max_timesteps = 0;
    125   size_t min_timesteps = -1;
    126   BOOST_FOREACH(molecule *_mol, molecules) {
    127     for(molecule::const_iterator iter = _mol->begin();
    128         iter != _mol->end();
    129         ++iter) {
    130       if ((*iter)->getTrajectorySize() > max_timesteps)
    131         max_timesteps  = (*iter)->getTrajectorySize();
    132       if (((*iter)->getTrajectorySize() <= max_timesteps) && (min_timesteps == (size_t)-1))
    133         min_timesteps = (*iter)->getTrajectorySize();
    134     }
    135   }
    136   LOG(1,"INFO: Minimum number of time steps found is " << min_timesteps);
    137   LOG(1,"INFO: Maximum number of time steps found is " << max_timesteps);
    138145
    139146  // get zero orientation for each molecule.
     
    150157  // go through every time step
    151158  LOG(0,"STATUS: Calculating dipoles of following time steps ...");
    152   for (size_t step = 1; step < max_timesteps; ++step) {
     159  range<size_t> timesteps = getMaximumTrajectoryBounds(atoms);
     160  for (size_t step = 1; step < timesteps.first; ++step) {
    153161    World::getInstance().setTime(step);
    154162    // recalculate molecules for this time step
  • src/Analysis/analysis_correlation.hpp

    rbe0c61 r1cc661  
    3131#include "CodePatterns/Info.hpp"
    3232#include "CodePatterns/Log.hpp"
     33#include "CodePatterns/Range.hpp"
    3334#include "CodePatterns/Verbose.hpp"
    3435#include "Helpers/helpers.hpp"
     
    5354
    5455/********************************************** declarations *******************************/
     56
     57range<size_t> getMaximumTrajectoryBounds(std::vector<atom *> &atoms);
    5558
    5659DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms);
Note: See TracChangeset for help on using the changeset viewer.