Changeset 208237b for src/Analysis


Ignore:
Timestamp:
Oct 25, 2011, 3:28:06 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:
df8759
Parents:
5fd0f4
git-author:
Frederik Heber <heber@…> (02/11/11 22:28:51)
git-committer:
Frederik Heber <heber@…> (10/25/11 15:28:06)
Message:

Renamed DipoleAngularCorrelation(Action) -> DipoleCorrelation(Action) and new DipoleAngularCorrelation(Action).

Location:
src/Analysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Analysis/analysis_correlation.cpp

    r5fd0f4 r208237b  
    3030#include "CodePatterns/Info.hpp"
    3131#include "CodePatterns/Log.hpp"
     32#include "CodePatterns/Verbose.hpp"
    3233#include "Formula.hpp"
     34#include "LinearAlgebra/Vector.hpp"
     35#include "LinearAlgebra/RealSpaceMatrix.hpp"
    3336#include "molecule.hpp"
    3437#include "Tesselation/tesselation.hpp"
     
    3639#include "Tesselation/triangleintersectionlist.hpp"
    3740#include "World.hpp"
    38 #include "LinearAlgebra/Vector.hpp"
    39 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    40 #include "CodePatterns/Verbose.hpp"
    41 #include "World.hpp"
    42 #include "Box.hpp"
     41#include "WorldTime.hpp"
    4342
    4443#include "analysis_correlation.hpp"
     
    9089
    9190/** Calculates the dipole angular correlation for given molecule type.
     91 * Calculate the change of the dipole orientation angle over time.
    9292 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
    9393 * Angles are given in degrees.
     
    107107  }
    108108
    109   outmap = new DipoleAngularCorrelationMap;
     109  // store original time step
     110  const unsigned int oldtime = WorldTime::getTime();
     111  World::getInstance().setTime(0);
     112
     113  // get highest trajectory size
     114  size_t max_timesteps = 0;
     115  BOOST_FOREACH(molecule *_mol, molecules) {
     116    for(molecule::const_iterator iter = _mol->begin();
     117        iter != _mol->end();
     118        ++iter) {
     119      if ((*iter)->getTrajectorySize() > max_timesteps)
     120        max_timesteps  = (*iter)->getTrajectorySize();
     121    }
     122  }
     123  // get zero orientation for each molecule.
     124  std::vector<Vector> ZeroVector;
     125  ZeroVector.resize(molecules.size(), zeroVec);
     126  size_t i=0;
     127  BOOST_FOREACH(molecule *_mol, molecules) {
     128    const Vector Dipole = getDipole(_mol->begin(), _mol->end());
     129    ZeroVector[i] = Dipole;
     130    ++i;
     131  }
     132  // go through every time step
     133  for (size_t step = 1; step < max_timesteps; ++step) {
     134    World::getInstance().setTime(step);
     135    size_t i=0;
     136    BOOST_FOREACH(molecule *_mol, molecules) {
     137      const Vector Dipole = getDipole(_mol->begin(), _mol->end());
     138      const double angle = Dipole.Angle(ZeroVector[i]) * (180./M_PI);
     139      DoLog(1) && (Log() << Verbose(1) << "Angle for molecule "
     140          << _mol->getId() << " at time step " << step << " is " << angle << "." << endl);
     141      outmap->insert ( make_pair (angle, _mol ) );
     142      ++i;
     143    }
     144  }
     145
     146
     147  // set original time step again
     148  World::getInstance().setTime(oldtime);
     149
     150  // and return results
     151  return outmap;
     152};
     153
     154/** Calculates the dipole correlation for given molecule type.
     155 * I.e. we calculate how the angle between any two given dipoles in the
     156 * systems behaves. Sort of pair correlation but distance is replaced by
     157 * the orientation distance, i.e. an angle.
     158 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
     159 * Angles are given in degrees.
     160 * \param *molecules vector of molecules
     161 * \return Map of doubles with values the pair of the two atoms.
     162 */
     163DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules)
     164{
     165  Info FunctionInfo(__func__);
     166  DipoleCorrelationMap *outmap = new DipoleCorrelationMap;
     167//  double distance = 0.;
     168//  Box &domain = World::getInstance().getDomain();
     169//
     170  if (molecules.empty()) {
     171    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
     172    return outmap;
     173  }
     174
    110175  for (std::vector<molecule *>::const_iterator MolWalker = molecules.begin();
    111176      MolWalker != molecules.end(); ++MolWalker) {
     
    503568void OutputDipoleAngularCorrelation_Header( ofstream * const file )
    504569{
    505   *file << "\tAtom1\tAtom2";
    506 };
    507 
    508 /** Prints values stored in DipoleAngularCorrelationMap iterator.
     570  *file << "\tMolecule1\tMolecule2";
     571};
     572
     573/** Prints values stored in DipoleCorrelationMap iterator.
    509574 *
    510575 * @param file stream to print to
     
    512577 */
    513578void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner )
     579{
     580  *file << runner->second->getId();
     581};
     582
     583
     584/** Adds header part that is unique to DipoleAngularCorrelationMap.
     585 *
     586 * @param file stream to print to
     587 */
     588void OutputDipoleCorrelation_Header( ofstream * const file )
     589{
     590  *file << "\tMolecule";
     591};
     592
     593/** Prints values stored in DipoleCorrelationMap iterator.
     594 *
     595 * @param file stream to print to
     596 * @param runner iterator pointing at values to print
     597 */
     598void OutputDipoleCorrelation_Value( ofstream * const file, DipoleCorrelationMap::const_iterator &runner )
    514599{
    515600  *file << runner->second.first->getId() << "\t" << runner->second.second->getId();
  • src/Analysis/analysis_correlation.hpp

    r5fd0f4 r208237b  
    4646
    4747typedef multimap<double, pair<atom *, atom *> > PairCorrelationMap;
    48 typedef multimap<double, pair<molecule *, molecule *> > DipoleAngularCorrelationMap;
     48typedef multimap<double, molecule * > DipoleAngularCorrelationMap;
     49typedef multimap<double, pair<molecule *, molecule *> > DipoleCorrelationMap;
    4950typedef multimap<double, pair<atom *, const Vector *> > CorrelationToPointMap;
    5051typedef multimap<double, pair<atom *, BoundaryTriangleSet *> > CorrelationToSurfaceMap;
     
    5455
    5556DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<molecule *> &molecules);
     57DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules);
    5658PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
    5759CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point );
     
    6567void OutputDipoleAngularCorrelation_Header( ofstream * const file );
    6668void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner );
     69void OutputDipoleCorrelation_Header( ofstream * const file );
     70void OutputDipoleCorrelation_Value( ofstream * const file, DipoleCorrelationMap::const_iterator &runner );
    6771void OutputPairCorrelation_Header( ofstream * const file );
    6872void OutputPairCorrelation_Value( ofstream * const file, PairCorrelationMap::const_iterator &runner );
Note: See TracChangeset for help on using the changeset viewer.