Changeset cda81d for src/Analysis
- Timestamp:
- Oct 27, 2011, 4:45:47 PM (13 years ago)
- 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:
- a2b0ce
- Parents:
- 9e1709
- git-author:
- Frederik Heber <heber@…> (05/11/11 08:10:27)
- git-committer:
- Frederik Heber <heber@…> (10/27/11 16:45:47)
- Location:
- src/Analysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/analysis_correlation.cpp
r9e1709 rcda81d 148 148 * \param &atoms list of atoms of the molecules taking part (Note: molecules may 149 149 * change over time as bond structure is recalculated, hence we need the atoms) 150 * \param timestep time step to calculate angular correlation for (relative to 151 * \a ZeroVector) 150 152 * \param ZeroVector map with Zero orientation vector for each atom in \a atoms. 151 * Is filled if size of map does not match size of \a atoms.153 * Is filled from initial time step if size of map does not match size of \a atoms. 152 154 * \return Map of doubles with values the pair of the two atoms. 153 155 */ 154 156 DipoleAngularCorrelationMap *DipoleAngularCorrelation( 155 157 std::vector<atom *> &atoms, 158 const size_t timestep, 156 159 std::map<atomId_t, Vector> &ZeroVector 157 160 ) … … 160 163 DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap; 161 164 165 // get zero orientation for each molecule if not given 166 if (ZeroVector.size() != atoms.size()) { 167 ZeroVector.clear(); 168 ZeroVector = CalculateZeroAngularDipole(atoms); 169 } 170 162 171 // store original time step 163 172 const unsigned int oldtime = WorldTime::getTime(); 164 World::getInstance().setTime(0); 165 166 // calculate molecules for this time step 173 174 // set time step 175 World::getInstance().setTime(timestep); 176 177 // get all molecules for this time step 178 LOG(0,"STATUS: Gathering molecules for time step " << timestep << " ..."); 167 179 std::set<molecule *> molecules; 168 180 BOOST_FOREACH(atom *_atom, atoms) 169 181 molecules.insert(_atom->getMolecule()); 170 182 171 BOOST_FOREACH(atom *_atom, World::getInstance().getAllAtoms()) 172 LOG(2, "INFO: Atom " << _atom->getId() << " " 173 << *dynamic_cast<AtomInfo *>(_atom) <<"."); 174 175 176 // get zero orientation for each atom if not given 177 if (ZeroVector.size() != atoms.size()) { 178 ZeroVector.clear(); 179 ZeroVector = CalculateZeroAngularDipole(atoms); 180 } 181 182 // go through every time step 183 LOG(0,"STATUS: Calculating dipoles of following time steps ..."); 184 range<size_t> timesteps = getMaximumTrajectoryBounds(atoms); 185 for (size_t step = 1; step < timesteps.first; ++step) { 186 World::getInstance().setTime(step); 187 // recalculate molecules for this time step 188 molecules.clear(); 189 BOOST_FOREACH(atom *_atom, atoms) 190 molecules.insert(_atom->getMolecule()); 191 size_t i=0; 192 BOOST_FOREACH(molecule *_mol, molecules) { 193 const Vector Dipole = getDipole(_mol->begin(), _mol->end()); 194 LOG(2,"INFO: Dipole vector at time step " << step << " for for molecule " 195 << _mol->getId() << " is " << Dipole); 196 molecule::const_iterator iter = _mol->begin(); 197 ASSERT(ZeroVector.count((*iter)->getId()), 198 "DipoleAngularCorrelation() - ZeroVector for atom "+toString(**iter)+" not present."); 199 double angle = 0.; 200 LOG(2, "INFO: ZeroVector of first atom " << **iter << " is " 201 << ZeroVector[(*iter)->getId()] << "."); 202 LOG(4, "INFO: Squared norm of difference vector is " 203 << (ZeroVector[(*iter)->getId()] - Dipole).NormSquared() << "."); 204 if ((ZeroVector[(*iter)->getId()] - Dipole).NormSquared() > MYEPSILON) 205 angle = Dipole.Angle(ZeroVector[(*iter)->getId()]) * (180./M_PI); 206 else 207 LOG(2, "INFO: Both vectors (almost) coincide, numerically unstable, angle set to zero."); 208 LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getName() 209 << " is " << angle << "."); 210 outmap->insert ( make_pair (angle, *iter ) ); 211 ++i; 212 } 213 } 214 215 216 // set original time step again 183 // calculate dipoles for each 184 LOG(0,"STATUS: Calculating dipoles for time step " << timestep << " ..."); 185 size_t i=0; 186 BOOST_FOREACH(molecule *_mol, molecules) { 187 const Vector Dipole = getDipole(_mol->begin(), _mol->end()); 188 LOG(2,"INFO: Dipole vector at time step " << timestep << " for for molecule " 189 << _mol->getId() << " is " << Dipole); 190 molecule::const_iterator iter = _mol->begin(); 191 ASSERT(ZeroVector.count((*iter)->getId()), 192 "DipoleAngularCorrelation() - ZeroVector for atom "+toString(**iter)+" not present."); 193 double angle = 0.; 194 LOG(2, "INFO: ZeroVector of first atom " << **iter << " is " 195 << ZeroVector[(*iter)->getId()] << "."); 196 LOG(4, "INFO: Squared norm of difference vector is " 197 << (ZeroVector[(*iter)->getId()] - Dipole).NormSquared() << "."); 198 if ((ZeroVector[(*iter)->getId()] - Dipole).NormSquared() > MYEPSILON) 199 angle = Dipole.Angle(ZeroVector[(*iter)->getId()]) * (180./M_PI); 200 else 201 LOG(2, "INFO: Both vectors (almost) coincide, numerically unstable, angle set to zero."); 202 LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getName() 203 << " is " << angle << "."); 204 outmap->insert ( make_pair (angle, *iter ) ); 205 ++i; 206 } 207 208 // re-set to original time step again 217 209 World::getInstance().setTime(oldtime); 218 210 LOG(0,"STATUS: Done."); -
src/Analysis/analysis_correlation.hpp
r9e1709 rcda81d 58 58 std::map<atomId_t, Vector> CalculateZeroAngularDipole(std::vector<atom *> &atoms); 59 59 60 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms, std::map<atomId_t, Vector> &ZeroVector);60 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms, const size_t timestep, std::map<atomId_t, Vector> &ZeroVector); 61 61 DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules); 62 62 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
Note:
See TracChangeset
for help on using the changeset viewer.