Changeset 0bbfa1 for src/Parser


Ignore:
Timestamp:
Dec 16, 2010, 5:32:22 PM (14 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:
92d756
Parents:
93fd43e
git-author:
Frederik Heber <heber@…> (12/08/10 01:10:03)
git-committer:
Frederik Heber <heber@…> (12/16/10 17:32:22)
Message:

BUGFIX: Parsing a second .data file failed.

  • atomIdMap was not cleared in TremoloParser::load().
  • neighbors of first parsing get processed again after second parsing, hence bonds are added twice.
Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TremoloAtomInfoContainer.cpp

    r93fd43e r0bbfa1  
    3535  GrpTypeNo("0"),
    3636  torsion("-"),
    37   neighbors(std::vector<int>(0, 5))
     37  neighbors(std::vector<int>(0, 5)),
     38  neighbors_processed(false)
    3839{}
    3940
  • src/Parser/TremoloAtomInfoContainer.hpp

    r93fd43e r0bbfa1  
    3939  std::string torsion;
    4040  std::vector<int> neighbors;
     41  bool neighbors_processed;
    4142};
    4243
  • src/Parser/TremoloParser.cpp

    r93fd43e r0bbfa1  
    9090  string::size_type location;
    9191
     92  // reset atomIdMap, for we now get new serials
     93  atomIdMap.clear();
    9294  usedFields.clear();
     95
    9396  molecule *newmol = World::getInstance().createMolecule();
    9497  newmol->ActiveFlag = true;
     
    220223        ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t";
    221224    if (currentBond != currentAtom->ListOfBonds.end())
    222       currentBond++;
     225      ++currentBond;
    223226  }
    224227}
     
    310313 * Reads neighbor information for one atom from the input.
    311314 *
    312  * \param stream where to read the information from
    313  * \param number of neighbors to read
    314  * \param world id of the atom the information belongs to
     315 * \param line stream where to read the information from
     316 * \param numberOfNeighbors number of neighbors to read
     317 * \param atomid world id of the atom the information belongs to
    315318 */
    316319void TremoloParser::readNeighbors(stringstream* line, int numberOfNeighbors, int atomId) {
     
    320323    // 0 is used to fill empty neighbor positions in the tremolo file.
    321324    if (neighborId > 0) {
     325//      std::cout << "Atom with global id " << atomId << " has neighbour with serial " << neighborId << std::endl;
    322326      additionalAtomData[atomId].neighbors.push_back(neighborId);
    323327    }
     
    356360    currentInfo != additionalAtomData.end(); currentInfo++
    357361  ) {
    358     for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
    359       neighbor != currentInfo->second.neighbors.end(); neighbor++
    360     ) {
    361       World::getInstance().getAtom(AtomById(currentInfo->first))
    362           ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     362    if (!currentInfo->second.neighbors_processed) {
     363      for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
     364        neighbor != currentInfo->second.neighbors.end(); neighbor++
     365      ) {
     366//        std::cout << "Creating bond between ("
     367//            << currentInfo->first
     368//            << ") and ("
     369//            << atomIdMap[*neighbor] << "|" << *neighbor << ")" << std::endl;
     370        World::getInstance().getAtom(AtomById(currentInfo->first))
     371            ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     372      }
     373      currentInfo->second.neighbors_processed = true;
    363374    }
    364375  }
Note: See TracChangeset for help on using the changeset viewer.