Ignore:
Timestamp:
Jan 6, 2012, 2:02:08 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, Candidate_v1.7.0, 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:
d08ab3
Parents:
fbbcde
git-author:
Frederik Heber <heber@…> (01/04/12 18:34:22)
git-committer:
Frederik Heber <heber@…> (01/06/12 14:02:08)
Message:

FIX: One could not load another pdb file due to local ids messing up.

  • We enhanced FormatParser_common now contains two maps to go from local to global and back again. Thi is necessary, as ids in a file only make sense within that file. We added the following functions: resetIdAssociations(), associateLocaltoGlobalId(), getGlobalId(), getLocalId().
  • adapted TremoloParser and PdbParser because they are the only formats that also contain bond information and where the associations are needed to translate the local connections into global ones.
  • removed SerialSet entirely from PdbParser, is replaced by new construct, in similar manner AtomIdMap for TremoloParser.
  • TEST: Added regression tests for all Parser to check for loading twice the same file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TremoloParser.cpp

    rfbbcde rc0e28c  
    103103  usedFields.clear();
    104104  additionalAtomData.clear();
    105   atomIdMap.clear();
    106105  knownKeys.clear();
    107106}
     
    116115  string::size_type location;
    117116
    118   // reset atomIdMap, for we now get new serials
    119   atomIdMap.clear();
     117  // reset the id maps
     118  resetIdAssociations();
     119
    120120  LOG(1, "INFO: Clearing usedFields.");
    121121  usedFields.clear();
     
    444444        ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!");
    445445        LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
    446         atomIdMap[toInt(*tok_iter)] = atomid;
     446        associateLocaltoGlobalId(toInt(*tok_iter), atomid);
    447447        tok_iter++;
    448448        break;
     
    525525        neighbor != currentInfo->second.neighbors.end(); neighbor++
    526526      ) {
    527 //        LOG(1, "INFO: Creating bond between ("
    528 //            << currentInfo->first
    529 //            << ") and ("
    530 //            << atomIdMap[*neighbor] << "|" << *neighbor << ")");
     527        LOG(3, "INFO: Creating bond between ("
     528            << currentInfo->first
     529            << ") and ("
     530            << getGlobalId(*neighbor) << "|" << *neighbor << ")");
     531        ASSERT(getGlobalId(*neighbor) != -1,
     532            "FormatParser< tremolo >::processNeighborInformation() - global id to local id "
     533            +toString(*neighbor)+" is unknown.");
    531534        World::getInstance().getAtom(AtomById(currentInfo->first))
    532             ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     535            ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(getGlobalId(*neighbor))));
    533536      }
    534537      currentInfo->second.neighbors_processed = true;
     
    558561
    559562  line >> id;
    560   result << atomIdMap[id];
     563  result << getGlobalId(id);
    561564  while (line.good()) {
    562565    line >> separator >> id;
    563     result << separator << atomIdMap[id];
     566    result << separator << getGlobalId(id);
    564567  }
    565568
Note: See TracChangeset for help on using the changeset viewer.