Changeset 4b8630


Ignore:
Timestamp:
Oct 25, 2011, 3:31:54 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:
be0c61
Parents:
4fc828
git-author:
Frederik Heber <heber@…> (02/19/11 00:09:43)
git-committer:
Frederik Heber <heber@…> (10/25/11 15:31:54)
Message:

World::setTime() now updates bond structure of system and related changes to DipoleAngularCorrelation.

  • extended regression test Analysis/DipoleAngularCorrelation with xyz example whose bond structure is updated per time step.
  • FIX: DepthFirstSearchAnalysis::operator() did not reset bonds to unused.
  • FIX: DipoleAngularCorrelationAction has to work on atoms not molecules as the latter are subject to changes due to changing bond structure.
  • FIX: DipoleAngularCorrelation() re-calculates current set of molecules from the select atoms and stores first atom in values file, not molecule name.
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/DipoleAngularCorrelationAction.cpp

    r4fc828 r4b8630  
    5656  binoutput.open(params.binoutputname.string().c_str());
    5757  DipoleAngularCorrelationMap *correlationmap = NULL;
    58   std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    59   LOG(0, "STATUS: There are " << molecules.size() << " selected molecules.");
     58  std::vector<atom*> atoms = World::getInstance().getSelectedAtoms();
     59  LOG(0, "STATUS: There are " << atoms.size() << " selected atoms.");
    6060  ASSERT(!params.periodic, "AnalysisDipoleAngularCorrelationAction() - periodic case not implemented.");
    61   correlationmap = DipoleAngularCorrelation(molecules);
     61  correlationmap = DipoleAngularCorrelation(atoms);
    6262  OutputCorrelationMap<DipoleAngularCorrelationMap>(&output, correlationmap, OutputDipoleAngularCorrelation_Header, OutputDipoleAngularCorrelation_Value);
    6363  binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
  • src/Analysis/analysis_correlation.cpp

    r4fc828 r4b8630  
    3131#include "CodePatterns/Log.hpp"
    3232#include "CodePatterns/Verbose.hpp"
     33#include "Descriptors/MoleculeOfAtomSelectionDescriptor.hpp"
    3334#include "Formula.hpp"
    3435#include "LinearAlgebra/Vector.hpp"
     
    9899 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si))
    99100 * Angles are given in degrees.
    100  * \param *molecules vector of molecules
     101 * \param &atoms list of atoms of the molecules taking part (Note: molecules may
     102 * change over time as bond structure is recalculated, hence we need the atoms)
    101103 * \return Map of doubles with values the pair of the two atoms.
    102104 */
    103 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<molecule *> &molecules)
     105DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms)
    104106{
    105107  Info FunctionInfo(__func__);
    106108  DipoleAngularCorrelationMap *outmap = new DipoleAngularCorrelationMap;
    107 //  double distance = 0.;
    108 //  Box &domain = World::getInstance().getDomain();
    109 //
    110   if (molecules.empty()) {
    111     DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    112     return outmap;
    113   }
     109  std::set<molecule *> molecules;
    114110
    115111  // store original time step
    116112  const unsigned int oldtime = WorldTime::getTime();
    117113  World::getInstance().setTime(0);
     114  // calculate molecules for this time step
     115  BOOST_FOREACH(atom *_atom, atoms)
     116    molecules.insert(_atom->getMolecule());
    118117
    119118  BOOST_FOREACH(atom *_atom, World::getInstance().getAllAtoms())
     
    155154  for (size_t step = 1; step < max_timesteps; ++step) {
    156155    World::getInstance().setTime(step);
     156    // recalculate molecules for this time step
     157    molecules.clear();
     158    BOOST_FOREACH(atom *_atom, atoms)
     159      molecules.insert(_atom->getMolecule());
    157160    size_t i=0;
    158161    BOOST_FOREACH(molecule *_mol, molecules) {
     
    161164      const double angle = Dipole.Angle(ZeroVector[i]) * (180./M_PI);
    162165      LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getId() << " is " << angle << ".");
    163       outmap->insert ( make_pair (angle, _mol ) );
     166      outmap->insert ( make_pair (angle, *_mol->begin() ) );
    164167      ++i;
    165168    }
     
    591594void OutputDipoleAngularCorrelation_Header( ofstream * const file )
    592595{
    593   *file << "\tMolecule";
     596  *file << "\tFirstAtomOfMolecule";
    594597};
    595598
     
    601604void OutputDipoleAngularCorrelation_Value( ofstream * const file, DipoleAngularCorrelationMap::const_iterator &runner )
    602605{
    603   *file << runner->second->getId();
     606  *file << runner->second->getName();
    604607};
    605608
  • src/Analysis/analysis_correlation.hpp

    r4fc828 r4b8630  
    4646
    4747typedef multimap<double, pair<atom *, atom *> > PairCorrelationMap;
    48 typedef multimap<double, molecule * > DipoleAngularCorrelationMap;
     48typedef multimap<double, atom * > DipoleAngularCorrelationMap;
    4949typedef multimap<double, pair<molecule *, molecule *> > DipoleCorrelationMap;
    5050typedef multimap<double, pair<atom *, const Vector *> > CorrelationToPointMap;
     
    5454/********************************************** declarations *******************************/
    5555
    56 DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<molecule *> &molecules);
     56DipoleAngularCorrelationMap *DipoleAngularCorrelation(std::vector<atom *> &atoms);
    5757DipoleCorrelationMap *DipoleCorrelation(std::vector<molecule *> &molecules);
    5858PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
  • src/World.cpp

    r4fc828 r4b8630  
    2525
    2626#include "Actions/ActionTraits.hpp"
    27 //#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
    2827#include "Actions/ManipulateAtomsProcess.hpp"
    2928#include "atom.hpp"
     
    3736#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3837#include "Descriptors/SelectiveIterator_impl.hpp"
     38#include "Graph/DepthFirstSearchAnalysis.hpp"
    3939#include "Helpers/defs.hpp"
    4040#include "LinearAlgebra/RealSpaceMatrix.hpp"
     
    137137    // set new time
    138138    WorldTime::setTime(_step);
    139     // re-instantiate bond structure
    140     //FragmentationSubgraphDissection();
     139    // TODO: removed when BondGraph creates the adjacency
     140    // 1. remove all of World's molecules
     141    for (MoleculeIterator iter = getMoleculeIter();
     142        getMoleculeIter() != moleculeEnd();
     143        iter = getMoleculeIter()) {
     144      getMolecules()->erase(*iter);
     145      destroyMolecule(*iter);
     146    }
     147    // 2. (re-)create bondgraph
     148    AtomComposite Set = getAllAtoms();
     149    BG->CreateAdjacency(Set);
     150
     151    // 3. scan for connected subgraphs => molecules
     152    DepthFirstSearchAnalysis DFS;
     153    DFS();
     154    DFS.UpdateMoleculeStructure();
    141155  }
    142156}
  • tests/regression/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at

    r4fc828 r4b8630  
    44AT_KEYWORDS([analysis dipole correlation pdb dipole-angular-correlation])
    55AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/pre/watermulti_X.pdb .], 0)
    6 AT_CHECK([../../molecuilder -v 4 -i watermulti_X.pdb -o pdb --select-molecules-by-formula H2O --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_X.dat --bin-output-file water_histogram_X.dat], 0, [stdout], [stderr])
     6AT_CHECK([../../molecuilder -v 4 -i watermulti_X.pdb -o pdb --select-molecules-by-formula H2O --select-molecules-atoms --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_X.dat --bin-output-file water_histogram_X.dat], 0, [stdout], [stderr])
    77AT_CHECK([file=water_histogram_X.dat; diff $file ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/post/$file], 0, [ignore], [ignore])
    88AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/pre/watermulti_Y.pdb .], 0)
    9 AT_CHECK([../../molecuilder -v 4 -i watermulti_Y.pdb -o pdb --select-molecules-by-formula H2O --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_Y.dat --bin-output-file water_histogram_Y.dat], 0, [stdout], [stderr])
     9AT_CHECK([../../molecuilder -v 4 -i watermulti_Y.pdb -o pdb --select-molecules-by-formula H2O --select-molecules-atoms --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_Y.dat --bin-output-file water_histogram_Y.dat], 0, [stdout], [stderr])
    1010AT_CHECK([file=water_histogram_Y.dat; diff $file ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/post/$file], 0, [ignore], [ignore])
    1111AT_CLEANUP
    1212
     13AT_SETUP([Analysis - dipole angular correlation on XYZs])
     14AT_KEYWORDS([analysis dipole correlation xyz dipole-angular-correlation])
     15AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/pre/watermulti_X.xyz .], 0)
     16AT_CHECK([../../molecuilder -v 4 -i watermulti_X.xyz -o xyz -I --select-molecules-by-formula H2O --select-molecules-atoms --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_X.dat --bin-output-file water_histogram_X.dat], 0, [stdout], [stderr])
     17AT_CHECK([file=water_histogram_X.dat; diff $file ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/post/$file], 0, [ignore], [ignore])
     18AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/pre/watermulti_Y.xyz .], 0)
     19AT_CHECK([../../molecuilder -v 4 -i watermulti_Y.xyz -o xyz -I --select-molecules-by-formula H2O --select-molecules-atoms --dipole-angular-correlation --bin-start -5 --bin-width 10. --bin-end 184.5 --output-file water_values_Y.dat --bin-output-file water_histogram_Y.dat], 0, [stdout], [stderr])
     20AT_CHECK([file=water_histogram_Y.dat; diff $file ${abs_top_srcdir}/tests/regression/Analysis/DipoleAngularCorrelation/post/$file], 0, [ignore], [ignore])
     21AT_CLEANUP
     22
Note: See TracChangeset for help on using the changeset viewer.