Changeset e65878 for src/Analysis
- Timestamp:
- Oct 31, 2011, 11:49:19 AM (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:
- 870b4b
- Parents:
- 505d05
- git-author:
- Frederik Heber <heber@…> (05/18/11 19:55:05)
- git-committer:
- Frederik Heber <heber@…> (10/31/11 11:49:19)
- Location:
- src/Analysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/analysis_correlation.cpp
r505d05 re65878 32 32 #include "CodePatterns/Log.hpp" 33 33 #include "CodePatterns/Verbose.hpp" 34 #include "Descriptors/AtomOfMoleculeSelectionDescriptor.hpp" 35 #include "Descriptors/MoleculeFormulaDescriptor.hpp" 34 36 #include "Descriptors/MoleculeOfAtomSelectionDescriptor.hpp" 35 37 #include "Formula.hpp" … … 100 102 * \return range with [min, max] 101 103 */ 102 range<size_t> getMaximumTrajectoryBounds( std::vector<atom *> &atoms)104 range<size_t> getMaximumTrajectoryBounds(const std::vector<atom *> &atoms) 103 105 { 104 106 // get highest trajectory size … … 121 123 122 124 /** Calculates the angular dipole zero orientation from current time step. 123 * \param atoms vector of atoms to calculate it for125 * \param molecules vector of molecules to calculate dipoles of 124 126 * \return map with orientation vector for each atomic id given in \a atoms. 125 127 */ 126 std::map<atomId_t, Vector> CalculateZeroAngularDipole(std::vector<atom *> &atoms) 127 { 128 // calculate molecules for this time step 129 std::set<molecule *> molecules; 130 BOOST_FOREACH(atom *_atom, atoms) 131 molecules.insert(_atom->getMolecule()); 132 128 std::map<atomId_t, Vector> CalculateZeroAngularDipole(const std::vector<molecule *> &molecules) 129 { 133 130 // get zero orientation for each molecule. 134 LOG(0,"STATUS: Calculating dipoles for first time step ...");131 LOG(0,"STATUS: Calculating dipoles for current time step ..."); 135 132 std::map<atomId_t, Vector> ZeroVector; 136 133 BOOST_FOREACH(molecule *_mol, molecules) { … … 154 151 * \a ZeroVector) 155 152 * \param ZeroVector map with Zero orientation vector for each atom in \a atoms. 156 * Is filled from initial time step if size of map does not match size of \a atoms.157 153 * \param DontResetTime don't reset time to old value (triggers re-creation of bond system) 158 154 * \return Map of doubles with values the pair of the two atoms. 159 155 */ 160 156 DipoleAngularCorrelationMap *DipoleAngularCorrelation( 161 std::vector<atom *> &atoms,157 const Formula &DipoleFormula, 162 158 const size_t timestep, 163 std::map<atomId_t, Vector> &ZeroVector,159 const std::map<atomId_t, Vector> &ZeroVector, 164 160 const enum ResetWorldTime DoTimeReset 165 161 ) … … 167 163 Info FunctionInfo(__func__); 168 164 DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap; 169 170 // get zero orientation for each molecule if not given171 if (ZeroVector.size() != atoms.size()) {172 LOG(1, "INFO: Mismatch size of zero orientation map ("173 << ZeroVector.size() << ") and atom vector ("<< atoms.size() << +").");174 ZeroVector.clear();175 ZeroVector = CalculateZeroAngularDipole(atoms);176 }177 165 178 166 unsigned int oldtime = 0; … … 187 175 188 176 // get all molecules for this time step 189 LOG(0,"STATUS: Gathering molecules from " << atoms.size() << " atoms for time step " << timestep << " ..."); 190 std::set<molecule *> molecules; 191 BOOST_FOREACH(atom *_atom, atoms) 192 molecules.insert(_atom->getMolecule()); 177 World::getInstance().clearMoleculeSelection(); 178 World::getInstance().selectAllMolecules(MoleculeByFormula(DipoleFormula)); 179 World::getInstance().clearAtomSelection(); 180 World::getInstance().selectAllAtoms(AtomsByMoleculeSelection()); 181 std::vector<molecule *> molecules = World::getInstance().getSelectedMolecules(); 182 LOG(1,"STATUS: Gathering " << molecules.size() << " molecules for time step " << timestep << "."); 193 183 194 184 // calculate dipoles for each 195 LOG( 0,"STATUS: Calculating dipoles for " << molecules.size() << " molecules for time step " << timestep << " ...");185 LOG(1,"STATUS: Calculating dipoles for time step " << timestep << " ..."); 196 186 size_t i=0; 197 187 BOOST_FOREACH(molecule *_mol, molecules) { 198 188 const Vector Dipole = getDipole(_mol->begin(), _mol->end()); 199 LOG( 2,"INFO: Dipole vector at time step " << timestep << "for molecule "189 LOG(3,"INFO: Dipole vector at time step " << timestep << " for for molecule " 200 190 << _mol->getId() << " is " << Dipole); 191 // check that all atoms are valid (zeroVector known) 201 192 molecule::const_iterator iter = _mol->begin(); 202 ASSERT(ZeroVector.count((*iter)->getId()), 203 "DipoleAngularCorrelation() - ZeroVector for atom "+toString(**iter)+" not present."); 193 for(; iter != _mol->end(); ++iter) { 194 if (!ZeroVector.count((*iter)->getId())) 195 break; 196 } 197 if (iter != _mol->end()) { 198 ELOG(2, "Skipping molecule " << _mol->getName() << " as not all atoms have a valid zeroVector."); 199 continue; 200 } else 201 iter = _mol->begin(); 202 std::map<atomId_t, Vector>::const_iterator zeroValue = ZeroVector.find((*iter)->getId()); //due to iter is const 204 203 double angle = 0.; 205 204 LOG(2, "INFO: ZeroVector of first atom " << **iter << " is " 206 << ZeroVector[(*iter)->getId()]<< ".");205 << zeroValue->second << "."); 207 206 LOG(4, "INFO: Squared norm of difference vector is " 208 << ( ZeroVector[(*iter)->getId()]- Dipole).NormSquared() << ".");209 if (( ZeroVector[(*iter)->getId()]- Dipole).NormSquared() > MYEPSILON)210 angle = Dipole.Angle( ZeroVector[(*iter)->getId()]) * (180./M_PI);207 << (zeroValue->second - Dipole).NormSquared() << "."); 208 if ((zeroValue->second - Dipole).NormSquared() > MYEPSILON) 209 angle = Dipole.Angle(zeroValue->second) * (180./M_PI); 211 210 else 212 211 LOG(2, "INFO: Both vectors (almost) coincide, numerically unstable, angle set to zero."); … … 216 215 ++i; 217 216 } 218 LOG( 0,"STATUS: Done with calculating dipoles.");217 LOG(1,"STATUS: Done with calculating dipoles."); 219 218 220 219 if (DoTimeReset == DoResetTime) { -
src/Analysis/analysis_correlation.hpp
r505d05 re65878 60 60 /********************************************** declarations *******************************/ 61 61 62 range<size_t> getMaximumTrajectoryBounds( std::vector<atom *> &atoms);63 std::map<atomId_t, Vector> CalculateZeroAngularDipole( std::vector<atom *> &atoms);64 65 DipoleAngularCorrelationMap *DipoleAngularCorrelation( std::vector<atom *> &atoms, const size_t timestep,std::map<atomId_t, Vector> &ZeroVector, const enum ResetWorldTime DoTimeReset = DontResetTime);62 range<size_t> getMaximumTrajectoryBounds(const std::vector<atom *> &atoms); 63 std::map<atomId_t, Vector> CalculateZeroAngularDipole(const std::vector<molecule *> &molecules); 64 65 DipoleAngularCorrelationMap *DipoleAngularCorrelation(const Formula &DipoleFormula, const size_t timestep, const std::map<atomId_t, Vector> &ZeroVector, const enum ResetWorldTime DoTimeReset = DontResetTime); 66 66 DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules); 67 67 PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
Note:
See TracChangeset
for help on using the changeset viewer.