Changeset 9f8b01


Ignore:
Timestamp:
Feb 17, 2012, 3:24:18 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:
3867a7
Parents:
812155
git-author:
Frederik Heber <heber@…> (02/07/12 12:25:24)
git-committer:
Frederik Heber <heber@…> (02/17/12 15:24:18)
Message:

FIX: TremoloParser::processNeighbors() always ran through all neighbors.

  • processNeighbors() now receives a vector of atoms whose neighbors to process.
Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Parser/TremoloParser.cpp

    r812155 r9f8b01  
    3838
    3939
     40#include <algorithm>
    4041#include <boost/tokenizer.hpp>
    4142#include <iostream>
     
    136137    }
    137138  }
     139  LOG(3, "usedFields after load contains: " << usedFields);
     140
    138141  // refresh atom::nr and atom::name
    139   newmol->getAtomCount();
    140 
    141   LOG(3, "usedFields after load contains: " << usedFields);
    142 
    143   processNeighborInformation();
     142  std::vector<atomId_t> atoms(newmol->getAtomCount());
     143  std::transform(newmol->begin(), newmol->end(), atoms.begin(),
     144      boost::bind(&atom::getId, _1));
     145  processNeighborInformation(atoms);
    144146  adaptImprData();
    145147  adaptTorsion();
     
    515517 * are found by their current ID and mapped to the corresponding atoms with the
    516518 * Id found in the parsed file.
    517  */
    518 void FormatParser< tremolo >::processNeighborInformation() {
     519 *
     520 * @param atoms vector with all newly added (global) atomic ids
     521 */
     522void FormatParser< tremolo >::processNeighborInformation(const std::vector<atomId_t> &atoms) {
    519523  if (!isUsedField("neighbors")) {
    520524    return;
    521525  }
    522526
    523   for(std::map<const atomId_t, TremoloAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
    524     currentInfo != additionalAtomData.end(); currentInfo++
    525   ) {
    526     if (!currentInfo->second.neighbors_processed) {
    527       for(std::vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
    528         neighbor != currentInfo->second.neighbors.end(); neighbor++
    529       ) {
    530         LOG(3, "INFO: Creating bond between ("
    531             << currentInfo->first
    532             << ") and ("
    533             << getGlobalId(*neighbor) << "|" << *neighbor << ")");
    534         ASSERT(getGlobalId(*neighbor) != -1,
    535             "FormatParser< tremolo >::processNeighborInformation() - global id to local id "
    536             +toString(*neighbor)+" is unknown.");
    537         World::getInstance().getAtom(AtomById(currentInfo->first))
    538             ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(getGlobalId(*neighbor))));
    539       }
    540       currentInfo->second.neighbors_processed = true;
    541     }
     527  for (std::vector<atomId_t>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
     528    ASSERT(additionalAtomData.count(*iter) != 0,
     529        "FormatParser< tremolo >::processNeighborInformation() - global id "
     530        +toString(*iter)+" unknown in additionalAtomData.");
     531    TremoloAtomInfoContainer &currentInfo = additionalAtomData[*iter];
     532    ASSERT (!currentInfo.neighbors_processed,
     533        "FormatParser< tremolo >::processNeighborInformation() - neighbors of new atom "
     534        +toString(*iter)+" are already processed.");
     535    for(std::vector<int>::const_iterator neighbor = currentInfo.neighbors.begin();
     536      neighbor != currentInfo.neighbors.end(); neighbor++
     537    ) {
     538      LOG(3, "INFO: Creating bond between ("
     539          << *iter
     540          << ") and ("
     541          << getGlobalId(*neighbor) << "|" << *neighbor << ")");
     542      ASSERT(getGlobalId(*neighbor) != -1,
     543          "FormatParser< tremolo >::processNeighborInformation() - global id to local id "
     544          +toString(*neighbor)+" is unknown.");
     545      World::getInstance().getAtom(AtomById(*iter))
     546          ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(getGlobalId(*neighbor))));
     547    }
     548    currentInfo.neighbors_processed = true;
    542549  }
    543550}
  • TabularUnified src/Parser/TremoloParser.hpp

    r812155 r9f8b01  
    6565  void parseAtomDataKeysLine(std::string line, int offset);
    6666  void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
    67   void processNeighborInformation();
     67  void processNeighborInformation(const std::vector<atomId_t> &atoms);
    6868  void adaptImprData();
    6969  void adaptTorsion();
Note: See TracChangeset for help on using the changeset viewer.