Changeset 58fccca
- Timestamp:
- Feb 13, 2013, 3:47:45 PM (12 years ago)
- 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:
- 42f2f0
- Parents:
- b4b364
- git-author:
- Frederik Heber <heber@…> (01/08/13 14:40:11)
- git-committer:
- Frederik Heber <heber@…> (02/13/13 15:47:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/XyzParser.cpp
rb4b364 r58fccca 81 81 molecule* newmol = NULL; 82 82 int numberOfAtoms; 83 char commentBuffer[512], type[3];84 string number;83 string elementtype; 84 string streambuffer; 85 85 std::vector<atom *> AddedAtoms; 86 86 … … 93 93 // the first line tells number of atoms, 94 94 // where we need this construct due to skipping of empty lines below 95 file->getline(commentBuffer, 512);95 getline(*file, streambuffer); 96 96 unsigned int step = 0; 97 97 while (file->good()) { 98 std::stringstream numberstream( commentBuffer);98 std::stringstream numberstream(streambuffer); 99 99 numberstream >> numberOfAtoms; 100 100 if (step == 0) 101 101 AddedAtoms.resize(numberOfAtoms); 102 102 // the second line is always a comment 103 file->getline(commentBuffer, 512);104 comment = commentBuffer;103 getline(*file, streambuffer); 104 comment = streambuffer; 105 105 LOG(3, "DEBUG: comment is '" << comment << "'."); 106 106 107 107 for (int i = 0; i < numberOfAtoms; i++) { 108 108 // parse type and position 109 *file >> type;109 *file >> elementtype; 110 110 Vector tempVector; 111 111 for (int j=0;j<NDIM;j++) { 112 112 *file >> tempVector[j]; 113 113 } 114 LOG(4, "INFO: Parsed type as " << type << " and position at "114 LOG(4, "INFO: Parsed type as " << elementtype << " and position at " 115 115 << tempVector << " for time step " << step); 116 116 117 117 if (step == 0) { 118 118 newAtom = World::getInstance().createAtom(); 119 newAtom->setType(World::getInstance().getPeriode()->FindElement( type));119 newAtom->setType(World::getInstance().getPeriode()->FindElement(elementtype.c_str())); 120 120 newmol->AddAtom(newAtom); 121 121 AddedAtoms[i] = newAtom; … … 124 124 newAtom = AddedAtoms[i]; 125 125 LOG(5, "INFO: Using present atom " << *newAtom << " from " << i << " th component of AddedAtoms."); 126 ASSERT(newAtom->getType() == World::getInstance().getPeriode()->FindElement( type),127 "FormatParser< xyz >::load() - atom has different type "+newAtom->getType()->getSymbol()+" than parsed now "+ type+", mixed up order?");126 ASSERT(newAtom->getType() == World::getInstance().getPeriode()->FindElement(elementtype.c_str()), 127 "FormatParser< xyz >::load() - atom has different type "+newAtom->getType()->getSymbol()+" than parsed now "+elementtype+", mixed up order?"); 128 128 } 129 129 newAtom->setPositionAtStep(step, tempVector); 130 130 } 131 getline (*file, number); // eat away rest of last line131 getline (*file, streambuffer); // eat away rest of last line 132 132 // skip empty lines 133 133 unsigned int counter = 0; 134 134 while (file->good()) { 135 getline (*file, number);136 LOG(4, "INFO: Skipped line is '" << number << "'");135 getline (*file, streambuffer); 136 LOG(4, "INFO: Skipped line is '" << streambuffer << "'"); 137 137 counter++; 138 if (! number.empty())138 if (!streambuffer.empty()) 139 139 break; 140 140 }
Note:
See TracChangeset
for help on using the changeset viewer.