Changeset 473237 for src


Ignore:
Timestamp:
Oct 6, 2011, 7:11:55 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:
8b8a5b
Parents:
8990879
git-author:
Frederik Heber <heber@…> (04/30/11 13:10:10)
git-committer:
Frederik Heber <heber@…> (10/06/11 07:11:55)
Message:

FIX: PdbParser - CONECTs with full 80 chars were not parsed correctly.

  • this fixes ticket #147.
  • also, we now write full length CONECTs.
  • added regression test to check on this behavior.
  • TESTFIX: Parser/Pdb/with-conects now diffs with '-w' to ignore white spaces errors. CONECT lines need not have full length.
  • TESTFIX: Molecules/BondFile/Fragmentation now diffs with '-w' as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PdbParser.cpp

    r8990879 r473237  
    382382 * Note that ListOfBonds of WorldTime::CurrentTime is used.
    383383 *
     384 * Also, we fill up the CONECT line to extend over 80 chars.
     385 *
    384386 * \param *file  where to write neighbor information to
    385387 * \param MaxnumberOfNeighbors of neighbors
     
    388390void PdbParser::writeNeighbors(ostream* file, int MaxnumberOfNeighbors, atom* currentAtom) {
    389391  int MaxNo = MaxnumberOfNeighbors;
     392  int charsleft = 80;
    390393  const BondList & ListOfBonds = currentAtom->getListOfBonds();
    391394  if (!ListOfBonds.empty()) {
     
    394397        *file << "CONECT";
    395398        *file << setw(5) << getSerial(currentAtom->getId());
     399        charsleft = 80-6-5;
    396400        MaxNo = 0;
    397401      }
    398402      *file << setw(5) << getSerial((*currentBond)->GetOtherAtom(currentAtom)->getId());
     403      charsleft -= 5;
    399404      MaxNo++;
    400       if (MaxNo == MaxnumberOfNeighbors)
     405      if (MaxNo == MaxnumberOfNeighbors) {
     406        for (;charsleft > 0; charsleft--)
     407          *file << ' ';
    401408        *file << "\n";
     409      }
    402410    }
    403     if (MaxNo != MaxnumberOfNeighbors)
     411    if (MaxNo != MaxnumberOfNeighbors) {
     412      for (;charsleft > 0; charsleft--)
     413        *file << ' ';
    404414      *file << "\n";
     415    }
    405416  }
    406417}
     
    688699  ASSERT(length >=16,
    689700      "PdbParser::readNeighbors() - CONECT entry has not enough entries: "+line+"!");
    690 //  output = "Split line:|";
    691 //  output += line.substr(6,5) + "|";
     701  output = "Split line:|";
     702  output += line.substr(6,5) + "|";
    692703  const size_t id = toSize_t(line.substr(6,5));
    693704  for (size_t index = 11; index <= 26; index+=5) {
    694705    if (index+5 <= length) {
    695 //      output += line.substr(index,5) + "|";
    696       const size_t otherid = toSize_t(line.substr(index,5));
    697       ListOfNeighbors.push_back(otherid);
     706      output += line.substr(index,5) + "|";
     707      // search for digits
     708      int otherid = -1;
     709      PdbAtomInfoContainer::ScanKey(otherid, line.substr(index,5));
     710      if (otherid >= 0)
     711        ListOfNeighbors.push_back((size_t)otherid);
    698712    } else  {
    699713      break;
    700714    }
    701715  }
    702 //  DoLog(2) && (Log() << Verbose(2) << output << std::endl);
     716  LOG(4, output);
    703717
    704718  // add neighbours
    705719  atom *_atom = World::getInstance().getAtom(AtomById(getSerial(id)));
     720  LOG(2, "STATUS: Atom " << _atom->getId() << " gets " << ListOfNeighbors.size() << " more neighbours.");
    706721  for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin();
    707722      iter != ListOfNeighbors.end();
    708723      ++iter) {
    709 //    DoLog(1) && (Log() << Verbose(1) << "Adding Bond (" << getAtomId(id) << "," << getAtomId(*iter) << ")" << std::endl);
    710724    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getSerial(*iter)));
     725    LOG(3, "INFO: Adding Bond (" << *_atom << "," << *_Otheratom << ")");
    711726    _atom->addBond(_step, _Otheratom);
    712727  }
Note: See TracChangeset for help on using the changeset viewer.