Changeset 4415da for src/Parser
- Timestamp:
- Apr 1, 2010, 12:16:29 PM (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, 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:
- b8d4a3
- Parents:
- 9131f3 (diff), f9352d (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. - Location:
- src/Parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ChangeTracker.cpp
r9131f3 r4415da 15 15 ChangeTracker::ChangeTracker() { 16 16 isConsistent = true; 17 World::get ()->signOn(this);17 World::getInstance().signOn(this); 18 18 } 19 19 … … 22 22 */ 23 23 ChangeTracker::~ChangeTracker() { 24 World::get ()->signOff(this);24 World::getInstance().signOff(this); 25 25 } 26 26 -
src/Parser/TremoloParser.cpp
r9131f3 r4415da 20 20 */ 21 21 TremoloParser::TremoloParser() { 22 knownKeys[" "] = noKey; // so we can detect invalid keys 22 23 knownKeys["x"] = x; 23 24 knownKeys["u"] = u; … … 61 62 while (lineStream.good()) { 62 63 lineStream >> keyword; 64 if (knownKeys[keyword.substr(0, keyword.find("="))] == noKey) { 65 // throw exception about unknown key 66 cout << "Unknown key: " << keyword << " is not part of the tremolo format specification." << endl; 67 break; 68 } 63 69 usedFields.push_back(keyword); 64 70 } … … 74 80 vector<string>::iterator it; 75 81 stringstream lineStream; 82 atom* newAtom = World::getInstance().createAtom(); 83 TremoloAtomInfoContainer atomInfo = *(new TremoloAtomInfoContainer()); 84 atomDataKey currentField; 76 85 string word; 77 86 … … 79 88 for (it=usedFields.begin(); it < usedFields.end(); it++) { 80 89 cout << *it << " -- " << it->substr(0, it->find("=")) << " -- " << knownKeys[it->substr(0, it->find("="))] << endl; 81 switch (knownKeys[it->substr(0, it->find("="))]) { 90 currentField = knownKeys[it->substr(0, it->find("="))]; 91 switch (currentField) { 82 92 case x : 83 lineStream >> word; 84 cout<< "Found an x: word: " << word << endl; 93 // for the moment, assume there are always three dimensions 94 lineStream >> newAtom->x.x[0]; 95 lineStream >> newAtom->x.x[1]; 96 lineStream >> newAtom->x.x[2]; 97 break; 98 case u : 99 // for the moment, assume there are always three dimensions 100 lineStream >> newAtom->v.x[0]; 101 lineStream >> newAtom->v.x[1]; 102 lineStream >> newAtom->v.x[2]; 103 break; 104 case F : 105 lineStream >> word; 106 atomInfo.F = word; 107 break; 108 case stress : 109 lineStream >> word; 110 atomInfo.F = word; 111 break; 112 case Id : 113 // this ID is not used 114 break; 115 case neighbors : 116 // TODO neighbor information 117 lineStream >> word; 118 break; 119 case imprData : 120 lineStream >> word; 121 atomInfo.imprData = word; 122 break; 123 case GroupMeasureTypeNo : 124 lineStream >> word; 125 atomInfo.GroupMeasureTypeNo = word; 126 break; 127 case Type : 128 char type[3]; 129 lineStream >> type; 130 newAtom->setType(World::getInstance().getPeriode()->FindElement(type)); 131 break; 132 case extType : 133 lineStream >> word; 134 atomInfo.extType = word; 135 break; 136 case name : 137 lineStream >> word; 138 atomInfo.name = word; 139 break; 140 case resName : 141 lineStream >> word; 142 atomInfo.resName = word; 143 break; 144 case chainID : 145 lineStream >> word; 146 atomInfo.chainID = word; 147 break; 148 case resSeq : 149 lineStream >> word; 150 atomInfo.resSeq = word; 151 break; 152 case occupancy : 153 lineStream >> word; 154 atomInfo.occupancy = word; 155 break; 156 case tempFactor : 157 lineStream >> word; 158 atomInfo.segID = word; 159 break; 160 case segID : 161 lineStream >> word; 162 atomInfo.F = word; 163 break; 164 case Charge : 165 lineStream >> word; 166 atomInfo.Charge = word; 167 break; 168 case charge : 169 lineStream >> word; 170 atomInfo.charge = word; 171 break; 172 case GrpTypeNo : 173 lineStream >> word; 174 atomInfo.GrpTypeNo = word; 85 175 break; 86 176 default : … … 90 180 } 91 181 } 182 moreData[newAtom->getId()] = atomInfo; 92 183 } 93 184 … … 117 208 } 118 209 119 /*120 #ATOMDATA <record_entry_1> ... <record_entry_n>121 # <record_entry>: <dataname>[=<n>]122 # <dataname> : x | u | F | stress | Id | neighbors | imprData123 # | GroupMeasureTypeNo | Type | extType124 # | name | resName | chainID | resSeq125 # | occupancy | tempFactor | segID | Charge126 # | charge127 ATOMDATA name Id x=3 mass charge epsilon sigma eps14 sig14 name type protein protno neighbors=4128 */129 130 //MatrixContainer* data = readData(fileName, getHeaderSize('#'), 0);131 132 133 210 /** 134 211 * Saves the World's current state into as a tremolo file. … … 144 221 */ 145 222 } 223 224 TremoloAtomInfoContainer::TremoloAtomInfoContainer() { 225 name = "none"; 226 /* Add suitable default values. 227 std::string F; 228 std::string stress; 229 std::string imprData; 230 std::string GroupMeasureTypeNo; 231 std::string extType; 232 std::string name; 233 std::string resName; 234 std::string chainID; 235 std::string resSeq; 236 std::string occupancy; 237 std::string tempFactor; 238 std::string segID; 239 std::string Charge; 240 std::string charge; 241 std::string GrpTypeNo; 242 */ 243 }; -
src/Parser/TremoloParser.hpp
r9131f3 r4415da 12 12 #include "FormatParser.hpp" 13 13 14 /** 15 * Holds tremolo-specific information which is not store in the atom class. 16 */ 17 class TremoloAtomInfoContainer { 18 public: 19 TremoloAtomInfoContainer(); 20 std::string F; 21 std::string stress; 22 std::string imprData; 23 std::string GroupMeasureTypeNo; 24 std::string extType; 25 std::string name; 26 std::string resName; 27 std::string chainID; 28 std::string resSeq; 29 std::string occupancy; 30 std::string tempFactor; 31 std::string segID; 32 std::string Charge; 33 std::string charge; 34 std::string GrpTypeNo; 35 }; 36 37 /** 38 * Loads a tremolo file into the World and saves the World as a tremolo file. 39 */ 14 40 class TremoloParser:public FormatParser 15 41 { … … 27 53 * Known keys for the ATOMDATA line. 28 54 */ 29 enum StringValue { 55 enum atomDataKey { 56 noKey, 30 57 x, 31 58 u, … … 53 80 * Map to associate the known keys with numbers. 54 81 */ 55 std::map<std::string, StringValue> knownKeys;82 std::map<std::string, atomDataKey> knownKeys; 56 83 57 84 /** … … 64 91 * file. 65 92 */ 66 std::map< std::string, std::string> moreData;93 std::map<int, TremoloAtomInfoContainer> moreData; 67 94 }; 68 95 -
src/Parser/XyzParser.cpp
r9131f3 r4415da 44 44 45 45 for (int i = 0; i < numberOfAtoms; i++) { 46 newAtom = World::get ()->createAtom();46 newAtom = World::getInstance().createAtom(); 47 47 *file >> type >> ws >> newAtom->x.x[0] >> ws >> newAtom->x.x[1] >> ws >> newAtom->x.x[2]; 48 newAtom->setType(World::get ()->getPeriode()->FindElement(type));48 newAtom->setType(World::getInstance().getPeriode()->FindElement(type)); 49 49 } 50 50 } … … 56 56 */ 57 57 void XyzParser::save(ostream* file) { 58 *file << World::get ()->numAtoms() << endl << comment << endl;58 *file << World::getInstance().numAtoms() << endl << comment << endl; 59 59 60 vector<atom*> atoms = World::get ()->getAllAtoms();60 vector<atom*> atoms = World::getInstance().getAllAtoms(); 61 61 for(vector<atom*>::iterator it = atoms.begin(); it < atoms.end(); it++) { 62 62 *file << fixed << (*it)->getType()->symbol << "\t" << (*it)->x.x[0] << "\t" << (*it)->x.x[1] << "\t" << (*it)->x.x[2] << endl;
Note:
See TracChangeset
for help on using the changeset viewer.