Changeset 325687 for src/Analysis


Ignore:
Timestamp:
Oct 27, 2011, 11:06:42 AM (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:
bef3b9
Parents:
0a7fad
git-author:
Frederik Heber <heber@…> (05/11/11 07:54:00)
git-committer:
Frederik Heber <heber@…> (10/27/11 11:06:42)
Message:

DipoleAngularCorrelation() - External zero orientation vector may be given.

Location:
src/Analysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Analysis/analysis_correlation.cpp

    r0a7fad r325687  
    148148 * \param &atoms list of atoms of the molecules taking part (Note: molecules may
    149149 * change over time as bond structure is recalculated, hence we need the atoms)
     150 * \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.
    150152 * \return Map of doubles with values the pair of the two atoms.
    151153 */
    152 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms)
     154DipoleAngularCorrelationMap *DipoleAngularCorrelation(
     155    std::vector<atom *> &atoms,
     156    std::map<atomId_t, Vector> &ZeroVector
     157    )
    153158{
    154159  Info FunctionInfo(__func__);
     
    169174
    170175
    171   // get zero orientation for each molecule.
    172   std::map<atomId_t, Vector> ZeroVector = CalculateZeroAngularDipole(atoms);
     176  // get zero orientation for each atom if not given
     177  if (ZeroVector.size() != atoms.size()) {
     178    ZeroVector.clear();
     179    ZeroVector = CalculateZeroAngularDipole(atoms);
     180  }
    173181
    174182  // go through every time step
     
    184192    BOOST_FOREACH(molecule *_mol, molecules) {
    185193      const Vector Dipole = getDipole(_mol->begin(), _mol->end());
    186       LOG(2,"INFO: Dipole vector at time step " << step << " for for molecule " << _mol->getId() << " is " << Dipole);
     194      LOG(2,"INFO: Dipole vector at time step " << step << " for for molecule "
     195          << _mol->getId() << " is " << Dipole);
    187196      molecule::const_iterator iter = _mol->begin();
    188197      ASSERT(ZeroVector.count((*iter)->getId()),
    189198          "DipoleAngularCorrelation() - ZeroVector for atom "+toString(**iter)+" not present.");
    190       const double angle = Dipole.Angle(ZeroVector[(*iter)->getId()]) * (180./M_PI);
    191       LOG(1,"INFO: Resulting relative angle for molecule " << **iter << " is " << angle << ".");
     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 << ".");
    192210      outmap->insert ( make_pair (angle, *iter ) );
    193211      ++i;
  • src/Analysis/analysis_correlation.hpp

    r0a7fad r325687  
    5858std::map<atomId_t, Vector> CalculateZeroAngularDipole(std::vector<atom *> &atoms);
    5959
    60 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms);
     60DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms, std::map<atomId_t, Vector> &ZeroVector);
    6161DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules);
    6262PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
Note: See TracChangeset for help on using the changeset viewer.