Changeset 1d5afa5 for src


Ignore:
Timestamp:
Feb 4, 2011, 6:56:38 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:
00b59d5
Parents:
17f3cd
git-author:
Frederik Heber <heber@…> (01/17/11 11:21:17)
git-committer:
Frederik Heber <heber@…> (02/04/11 18:56:38)
Message:

BUGFIX: CheckAdjacencyFileAgainstMolecule() hiccup'ed on parsed files.

  • we checked for iostream::eof() which seemed not to work in all cases. Now we use while (line << tmp) directly and this works.
  • maximum number of bonds is now (at least) a define MAXBONDS.
  • ASSERT that we parse not more than MAXBONDS bonds.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    r17f3cd r1d5afa5  
    2626#include "bondgraph.hpp"
    2727#include "config.hpp"
     28#include "element.hpp"
    2829#include "Helpers/defs.hpp"
    29 #include "element.hpp"
     30#include "Helpers/fast_functions.hpp"
    3031#include "Helpers/helpers.hpp"
    31 #include "CodePatterns/Info.hpp"
     32#include "LinearAlgebra/RealSpaceMatrix.hpp"
    3233#include "linkedcell.hpp"
    3334#include "lists.hpp"
    34 #include "CodePatterns/Verbose.hpp"
    35 #include "CodePatterns/Log.hpp"
    3635#include "molecule.hpp"
    3736#include "World.hpp"
    38 #include "Helpers/fast_functions.hpp"
     37#include "Box.hpp"
     38
    3939#include "CodePatterns/Assert.hpp"
    40 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    41 #include "Box.hpp"
     40#include "CodePatterns/Info.hpp"
     41#include "CodePatterns/Log.hpp"
     42#include "CodePatterns/Verbose.hpp"
     43
     44#define MAXBONDS 8
    4245
    4346struct BFSAccounting
     
    11441147
    11451148  // allocate storage structure
    1146   CurrentBonds = new int[8]; // contains parsed bonds of current atom
    1147   for(int i=0;i<8;i++)
     1149  CurrentBonds = new int[MAXBONDS]; // contains parsed bonds of current atom
     1150  for(int i=0;i<MAXBONDS;i++)
    11481151    CurrentBonds[i] = 0;
    11491152  return true;
     
    12101213
    12111214  char buffer[MAXSTRINGSIZE];
     1215  int tmp;
    12121216  // Parse the file line by line and count the bonds
    12131217  while (!File.eof()) {
     
    12211225    if ((AtomNr >= 0) && (AtomNr < AtomCount)) {
    12221226      Walker = ListOfAtoms[AtomNr];
    1223       while (!line.eof())
    1224         line >> CurrentBonds[++CurrentBondsOfAtom];
     1227      while (line >> ws >> tmp) {
     1228        std::cout << "Recognized bond partner " << tmp << std::endl;
     1229        CurrentBonds[++CurrentBondsOfAtom] = tmp;
     1230        ASSERT(CurrentBondsOfAtom < MAXBONDS,
     1231            "molecule::CheckAdjacencyFileAgainstMolecule() - encountered more bonds than allowed: "
     1232            +toString(CurrentBondsOfAtom)+" >= "+toString(MAXBONDS)+"!");
     1233      }
    12251234      // compare against present bonds
    12261235      CheckAdjacencyFileAgainstMolecule_CompareBonds(status, NonMatchNumber, Walker, CurrentBondsOfAtom, AtomNr, CurrentBonds, ListOfAtoms);
Note: See TracChangeset for help on using the changeset viewer.