Changeset 6c438f for src/Parser/TremoloParser.cpp
- Timestamp:
- Aug 28, 2010, 3:21:11 AM (15 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, Candidate_v1.7.0, Candidate_v1.7.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:
- a6e6b5, f8982c
- Parents:
- 2ad482 (diff), fd4905 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (08/28/10 03:17:48)
- git-committer:
- Frederik Heber <heber@…> (08/28/10 03:21:11)
- File:
-
- 1 edited
-
src/Parser/TremoloParser.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TremoloParser.cpp
r2ad482 r6c438f 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * TremoloParser.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 8 20 #include "Helpers/MemDebug.hpp" 9 21 10 22 #include "Helpers/Assert.hpp" 23 #include "Helpers/Log.hpp" 24 #include "Helpers/Verbose.hpp" 11 25 #include "TremoloParser.hpp" 12 26 #include "World.hpp" 13 27 #include "atom.hpp" 28 #include "bond.hpp" 14 29 #include "element.hpp" 15 #include " bond.hpp"30 #include "molecule.hpp" 16 31 #include "periodentafel.hpp" 17 32 #include "Descriptors/AtomIdDescriptor.hpp" … … 19 34 #include <vector> 20 35 36 #include <iostream> 37 #include <iomanip> 21 38 22 39 using namespace std; 23 using namespace boost;24 40 25 41 /** … … 75 91 76 92 usedFields.clear(); 93 molecule *newmol = World::getInstance().createMolecule(); 77 94 while (file->good()) { 78 95 std::getline(*file, line, '\n'); … … 84 101 } 85 102 if (line.length() > 0 && line.at(0) != '#') { 86 readAtomDataLine(line );103 readAtomDataLine(line, newmol); 87 104 } 88 105 } … … 99 116 */ 100 117 void TremoloParser::save(ostream* file) { 118 DoLog(0) && (Log() << Verbose(0) << "Saving changes to tremolo." << std::endl); 119 101 120 vector<atom*>::iterator atomIt; 102 121 vector<string>::iterator it; … … 140 159 case TremoloKey::x : 141 160 // for the moment, assume there are always three dimensions 142 *file << currentAtom-> x[0]<< "\t";143 *file << currentAtom-> x[1]<< "\t";144 *file << currentAtom-> x[2]<< "\t";161 *file << currentAtom->at(0) << "\t"; 162 *file << currentAtom->at(1) << "\t"; 163 *file << currentAtom->at(2) << "\t"; 145 164 break; 146 165 case TremoloKey::u : 147 166 // for the moment, assume there are always three dimensions 148 *file << currentAtom-> v[0] << "\t";149 *file << currentAtom-> v[1] << "\t";150 *file << currentAtom-> v[2] << "\t";167 *file << currentAtom->AtomicVelocity[0] << "\t"; 168 *file << currentAtom->AtomicVelocity[1] << "\t"; 169 *file << currentAtom->AtomicVelocity[2] << "\t"; 151 170 break; 152 171 case TremoloKey::Type : … … 154 173 break; 155 174 case TremoloKey::Id : 156 *file << currentAtom->getId() << "\t";175 *file << currentAtom->getId()+1 << "\t"; 157 176 break; 158 177 case TremoloKey::neighbors : 159 178 writeNeighbors(file, atoi(it->substr(it->find("=") + 1, 1).c_str()), currentAtom); 160 179 break; 180 case TremoloKey::resSeq : 181 if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) { 182 *file << additionalAtomData[currentAtom->getId()].get(currentField); 183 } else if (currentAtom->getMolecule() != NULL) { 184 *file << setw(4) << currentAtom->getMolecule()->getId()+1; 185 } else { 186 *file << defaultAdditionalData.get(currentField); 187 } 188 *file << "\t"; 189 break; 161 190 default : 162 *file << (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end() 163 ? additionalAtomData[currentAtom->getId()].get(currentField) 164 : defaultAdditionalData.get(currentField)); 191 if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) { 192 *file << additionalAtomData[currentAtom->getId()].get(currentField); 193 } else if (additionalAtomData.find(currentAtom->GetTrueFather()->getId()) != additionalAtomData.end()) { 194 *file << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField); 195 } else { 196 *file << defaultAdditionalData.get(currentField); 197 } 165 198 *file << "\t"; 166 199 break; … … 182 215 for (int i = 0; i < numberOfNeighbors; i++) { 183 216 *file << (currentBond != currentAtom->ListOfBonds.end() 184 ? (*currentBond)->GetOtherAtom(currentAtom)->getId() : 0) << "\t"; 217 ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t"; 218 if (currentBond != currentAtom->ListOfBonds.end()) 219 currentBond++; 185 220 } 186 221 } … … 214 249 * 215 250 * \param line to parse as an atom 216 */ 217 void TremoloParser::readAtomDataLine(string line) { 251 * \param *newmol molecule to add atom to 252 */ 253 void TremoloParser::readAtomDataLine(string line, molecule *newmol = NULL) { 218 254 vector<string>::iterator it; 219 255 stringstream lineStream; … … 225 261 string word; 226 262 int oldId; 263 double tmp; 227 264 228 265 lineStream << line; … … 232 269 case TremoloKey::x : 233 270 // for the moment, assume there are always three dimensions 234 lineStream >> newAtom->x[0]; 235 lineStream >> newAtom->x[1]; 236 lineStream >> newAtom->x[2]; 271 for (int i=0;i<NDIM;i++) { 272 lineStream >> tmp; 273 newAtom->set(i, tmp); 274 } 237 275 break; 238 276 case TremoloKey::u : 239 277 // for the moment, assume there are always three dimensions 240 lineStream >> newAtom-> v[0];241 lineStream >> newAtom-> v[1];242 lineStream >> newAtom-> v[2];278 lineStream >> newAtom->AtomicVelocity[0]; 279 lineStream >> newAtom->AtomicVelocity[1]; 280 lineStream >> newAtom->AtomicVelocity[2]; 243 281 break; 244 282 case TremoloKey::Type : … … 262 300 } 263 301 } 302 if (newmol != NULL) 303 newmol->AddAtom(newAtom); 264 304 } 265 305 … … 385 425 386 426 387 TremoloAtomInfoContainer::TremoloAtomInfoContainer() {388 F = "0";389 stress = "0";390 imprData = "-";391 GroupMeasureTypeNo = "0";392 extType = "-";393 name = "-";394 resName = "-";395 chainID = "0";396 resSeq = "0";397 occupancy = "0";398 tempFactor = "0";399 segID = "0";400 Charge = "0";401 charge = "0";402 GrpTypeNo = "0";403 torsion = "-";404 neighbors = vector<int>(0, 5);405 }427 TremoloAtomInfoContainer::TremoloAtomInfoContainer() : 428 F("0"), 429 stress("0"), 430 imprData("-"), 431 GroupMeasureTypeNo("0"), 432 extType("-"), 433 name("-"), 434 resName("-"), 435 chainID("0"), 436 resSeq("0"), 437 occupancy("0"), 438 tempFactor("0"), 439 segID("0"), 440 Charge("0"), 441 charge("0"), 442 GrpTypeNo("0"), 443 torsion("-"), 444 neighbors(vector<int>(0, 5)) 445 {} 406 446 407 447 void TremoloAtomInfoContainer::set(TremoloKey::atomDataKey key, string value) {
Note:
See TracChangeset
for help on using the changeset viewer.
