| [bcf653] | 1 | /*
|
|---|
| 2 | * Project: MoleCuilder
|
|---|
| 3 | * Description: creates and alters molecular systems
|
|---|
| [0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
|---|
| [bcf653] | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| [6bc51d] | 8 | /*
|
|---|
| 9 | * TremoloParser.cpp
|
|---|
| 10 | *
|
|---|
| 11 | * Created on: Mar 2, 2010
|
|---|
| 12 | * Author: metzler
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| [bf3817] | 15 | // include config.h
|
|---|
| 16 | #ifdef HAVE_CONFIG_H
|
|---|
| 17 | #include <config.h>
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| [ad011c] | 20 | #include "CodePatterns/MemDebug.hpp"
|
|---|
| [112b09] | 21 |
|
|---|
| [ad011c] | 22 | #include "CodePatterns/Assert.hpp"
|
|---|
| 23 | #include "CodePatterns/Log.hpp"
|
|---|
| [4d4d33] | 24 | #include "CodePatterns/toString.hpp"
|
|---|
| [ad011c] | 25 | #include "CodePatterns/Verbose.hpp"
|
|---|
| [42127c] | 26 |
|
|---|
| [9131f3] | 27 | #include "TremoloParser.hpp"
|
|---|
| [42127c] | 28 |
|
|---|
| [6f0841] | 29 | #include "Atom/atom.hpp"
|
|---|
| [129204] | 30 | #include "Bond/bond.hpp"
|
|---|
| [42127c] | 31 | #include "Descriptors/AtomIdDescriptor.hpp"
|
|---|
| [3bdb6d] | 32 | #include "Element/element.hpp"
|
|---|
| 33 | #include "Element/periodentafel.hpp"
|
|---|
| [42127c] | 34 | #include "molecule.hpp"
|
|---|
| 35 | #include "MoleculeListClass.hpp"
|
|---|
| 36 | #include "World.hpp"
|
|---|
| 37 | #include "WorldTime.hpp"
|
|---|
| 38 |
|
|---|
| [9131f3] | 39 |
|
|---|
| [72d108] | 40 | #include <boost/tokenizer.hpp>
|
|---|
| [74a444] | 41 | #include <iostream>
|
|---|
| 42 | #include <iomanip>
|
|---|
| [8bf9c6] | 43 | #include <map>
|
|---|
| 44 | #include <sstream>
|
|---|
| 45 | #include <vector>
|
|---|
| [9131f3] | 46 |
|
|---|
| [765f16] | 47 | // declare specialized static variables
|
|---|
| 48 | const std::string FormatParserTrait<tremolo>::name = "tremolo";
|
|---|
| 49 | const std::string FormatParserTrait<tremolo>::suffix = "data";
|
|---|
| 50 | const ParserTypes FormatParserTrait<tremolo>::type = tremolo;
|
|---|
| 51 |
|
|---|
| [9131f3] | 52 | /**
|
|---|
| 53 | * Constructor.
|
|---|
| 54 | */
|
|---|
| [765f16] | 55 | FormatParser< tremolo >::FormatParser() :
|
|---|
| 56 | FormatParser_common(NULL)
|
|---|
| 57 | {
|
|---|
| [b8d4a3] | 58 | knownKeys["x"] = TremoloKey::x;
|
|---|
| 59 | knownKeys["u"] = TremoloKey::u;
|
|---|
| 60 | knownKeys["F"] = TremoloKey::F;
|
|---|
| 61 | knownKeys["stress"] = TremoloKey::stress;
|
|---|
| 62 | knownKeys["Id"] = TremoloKey::Id;
|
|---|
| 63 | knownKeys["neighbors"] = TremoloKey::neighbors;
|
|---|
| 64 | knownKeys["imprData"] = TremoloKey::imprData;
|
|---|
| 65 | knownKeys["GroupMeasureTypeNo"] = TremoloKey::GroupMeasureTypeNo;
|
|---|
| [305e7e] | 66 | knownKeys["type"] = TremoloKey::type;
|
|---|
| [b8d4a3] | 67 | knownKeys["extType"] = TremoloKey::extType;
|
|---|
| 68 | knownKeys["name"] = TremoloKey::name;
|
|---|
| 69 | knownKeys["resName"] = TremoloKey::resName;
|
|---|
| 70 | knownKeys["chainID"] = TremoloKey::chainID;
|
|---|
| 71 | knownKeys["resSeq"] = TremoloKey::resSeq;
|
|---|
| 72 | knownKeys["occupancy"] = TremoloKey::occupancy;
|
|---|
| 73 | knownKeys["tempFactor"] = TremoloKey::tempFactor;
|
|---|
| 74 | knownKeys["segID"] = TremoloKey::segID;
|
|---|
| 75 | knownKeys["Charge"] = TremoloKey::Charge;
|
|---|
| 76 | knownKeys["charge"] = TremoloKey::charge;
|
|---|
| 77 | knownKeys["GrpTypeNo"] = TremoloKey::GrpTypeNo;
|
|---|
| 78 | knownKeys["torsion"] = TremoloKey::torsion;
|
|---|
| [52baf9] | 79 |
|
|---|
| [4d4d33] | 80 | createKnownTypesByIdentity();
|
|---|
| 81 |
|
|---|
| [52baf9] | 82 | // default behavior: use all possible keys on output
|
|---|
| 83 | for (std::map<std::string, TremoloKey::atomDataKey>::iterator iter = knownKeys.begin(); iter != knownKeys.end(); ++iter)
|
|---|
| 84 | usedFields.push_back(iter->first);
|
|---|
| [ff3c40] | 85 |
|
|---|
| 86 | // and noKey afterwards(!) such that it is not used in usedFields
|
|---|
| 87 | knownKeys[" "] = TremoloKey::noKey; // with this we can detect invalid keys
|
|---|
| [4d4d33] | 88 |
|
|---|
| 89 | // invert knownKeys for debug output
|
|---|
| 90 | for (std::map<std::string, TremoloKey::atomDataKey>::iterator iter = knownKeys.begin(); iter != knownKeys.end(); ++iter)
|
|---|
| 91 | knownKeyNames.insert( make_pair( iter->second, iter->first) );
|
|---|
| 92 |
|
|---|
| 93 | additionalAtomData.clear();
|
|---|
| [9131f3] | 94 | }
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | * Destructor.
|
|---|
| 98 | */
|
|---|
| [765f16] | 99 | FormatParser< tremolo >::~FormatParser()
|
|---|
| 100 | {
|
|---|
| [f23303] | 101 | LOG(1, "INFO: Clearing usedFields.");
|
|---|
| [b8d4a3] | 102 | usedFields.clear();
|
|---|
| 103 | additionalAtomData.clear();
|
|---|
| 104 | knownKeys.clear();
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | /**
|
|---|
| 108 | * Loads atoms from a tremolo-formatted file.
|
|---|
| 109 | *
|
|---|
| 110 | * \param tremolo file
|
|---|
| 111 | */
|
|---|
| [765f16] | 112 | void FormatParser< tremolo >::load(istream* file) {
|
|---|
| [8bf9c6] | 113 | std::string line;
|
|---|
| 114 | std::string::size_type location;
|
|---|
| [b8d4a3] | 115 |
|
|---|
| [c0e28c] | 116 | // reset the id maps
|
|---|
| 117 | resetIdAssociations();
|
|---|
| 118 |
|
|---|
| [f23303] | 119 | LOG(1, "INFO: Clearing usedFields.");
|
|---|
| [b8d4a3] | 120 | usedFields.clear();
|
|---|
| [0bbfa1] | 121 |
|
|---|
| [dc1d9e] | 122 | molecule *newmol = World::getInstance().createMolecule();
|
|---|
| [bd2390] | 123 | newmol->ActiveFlag = true;
|
|---|
| 124 | // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
|
|---|
| 125 | World::getInstance().getMolecules()->insert(newmol);
|
|---|
| [b8d4a3] | 126 | while (file->good()) {
|
|---|
| 127 | std::getline(*file, line, '\n');
|
|---|
| 128 | if (usedFields.empty()) {
|
|---|
| 129 | location = line.find("ATOMDATA", 0);
|
|---|
| 130 | if (location != string::npos) {
|
|---|
| 131 | parseAtomDataKeysLine(line, location + 8);
|
|---|
| 132 | }
|
|---|
| 133 | }
|
|---|
| 134 | if (line.length() > 0 && line.at(0) != '#') {
|
|---|
| [dc1d9e] | 135 | readAtomDataLine(line, newmol);
|
|---|
| [b8d4a3] | 136 | }
|
|---|
| 137 | }
|
|---|
| [4afa46] | 138 | // refresh atom::nr and atom::name
|
|---|
| 139 | newmol->getAtomCount();
|
|---|
| [b8d4a3] | 140 |
|
|---|
| [47d041] | 141 | LOG(3, "usedFields after load contains: " << usedFields);
|
|---|
| [2e352f] | 142 |
|
|---|
| [b8d4a3] | 143 | processNeighborInformation();
|
|---|
| 144 | adaptImprData();
|
|---|
| 145 | adaptTorsion();
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | /**
|
|---|
| [73916f] | 149 | * Saves the \a atoms into as a tremolo file.
|
|---|
| [b8d4a3] | 150 | *
|
|---|
| 151 | * \param file where to save the state
|
|---|
| [73916f] | 152 | * \param atoms atoms to store
|
|---|
| [b8d4a3] | 153 | */
|
|---|
| [765f16] | 154 | void FormatParser< tremolo >::save(ostream* file, const std::vector<atom *> &AtomList) {
|
|---|
| [47d041] | 155 | LOG(0, "Saving changes to tremolo.");
|
|---|
| [e97a44] | 156 |
|
|---|
| [8bf9c6] | 157 | std::vector<atom*>::const_iterator atomIt;
|
|---|
| [2e352f] | 158 | /*vector<string>::iterator it;*/
|
|---|
| [8bf9c6] | 159 | std::vector<std::string>::iterator it = unique(usedFields.begin(), usedFields.end()); // skips all duplicates in the vector
|
|---|
| [b8d4a3] | 160 |
|
|---|
| [8bf9c6] | 161 | LOG(3, "INFO: usedFields before save contains: " << usedFields);
|
|---|
| 162 | //LOG(3, "INFO: additionalAtomData contains: " << additionalAtomData);
|
|---|
| [acd638] | 163 |
|
|---|
| [812155] | 164 | // distribute continuous indices
|
|---|
| 165 | resetIdAssociations();
|
|---|
| 166 | atomId_t lastid = 0;
|
|---|
| 167 | for (atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
|
|---|
| 168 | associateLocaltoGlobalId(++lastid, (*atomIt)->getId());
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | // store
|
|---|
| [b8d4a3] | 172 | *file << "# ATOMDATA";
|
|---|
| 173 | for (it=usedFields.begin(); it < usedFields.end(); it++) {
|
|---|
| 174 | *file << "\t" << *it;
|
|---|
| 175 | }
|
|---|
| 176 | *file << endl;
|
|---|
| 177 | for (atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
|
|---|
| 178 | saveLine(file, *atomIt);
|
|---|
| 179 | }
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| [6bc86c] | 182 | /** Add default info, when new atom is added to World.
|
|---|
| 183 | *
|
|---|
| 184 | * @param id of atom
|
|---|
| 185 | */
|
|---|
| [765f16] | 186 | void FormatParser< tremolo >::AtomInserted(atomId_t id)
|
|---|
| [6bc86c] | 187 | {
|
|---|
| [8bf9c6] | 188 | std::map<const atomId_t, TremoloAtomInfoContainer>::iterator iter = additionalAtomData.find(id);
|
|---|
| [6bc86c] | 189 | ASSERT(iter == additionalAtomData.end(),
|
|---|
| [765f16] | 190 | "FormatParser< tremolo >::AtomInserted() - additionalAtomData already present for newly added atom "
|
|---|
| [6bc86c] | 191 | +toString(id)+".");
|
|---|
| 192 | // don't add entry, as this gives a default resSeq of 0 not the molecule id
|
|---|
| 193 | // additionalAtomData.insert( std::make_pair(id, TremoloAtomInfoContainer()) );
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | /** Remove additional AtomData info, when atom has been removed from World.
|
|---|
| 197 | *
|
|---|
| 198 | * @param id of atom
|
|---|
| 199 | */
|
|---|
| [765f16] | 200 | void FormatParser< tremolo >::AtomRemoved(atomId_t id)
|
|---|
| [6bc86c] | 201 | {
|
|---|
| [8bf9c6] | 202 | std::map<const atomId_t, TremoloAtomInfoContainer>::iterator iter = additionalAtomData.find(id);
|
|---|
| [6bc86c] | 203 | // as we do not insert AtomData on AtomInserted, we cannot be assured of its presence
|
|---|
| 204 | // ASSERT(iter != additionalAtomData.end(),
|
|---|
| [765f16] | 205 | // "FormatParser< tremolo >::AtomRemoved() - additionalAtomData is not present for atom "
|
|---|
| [6bc86c] | 206 | // +toString(id)+" to remove.");
|
|---|
| 207 | if (iter != additionalAtomData.end())
|
|---|
| 208 | additionalAtomData.erase(iter);
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| [b8d4a3] | 211 | /**
|
|---|
| 212 | * Sets the keys for which data should be written to the stream when save is
|
|---|
| 213 | * called.
|
|---|
| 214 | *
|
|---|
| 215 | * \param string of field names with the same syntax as for an ATOMDATA line
|
|---|
| 216 | * but without the prexix "ATOMDATA"
|
|---|
| 217 | */
|
|---|
| [765f16] | 218 | void FormatParser< tremolo >::setFieldsForSave(std::string atomDataLine) {
|
|---|
| [b8d4a3] | 219 | parseAtomDataKeysLine(atomDataLine, 0);
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | /**
|
|---|
| 224 | * Writes one line of tremolo-formatted data to the provided stream.
|
|---|
| 225 | *
|
|---|
| 226 | * \param stream where to write the line to
|
|---|
| 227 | * \param reference to the atom of which information should be written
|
|---|
| 228 | */
|
|---|
| [765f16] | 229 | void FormatParser< tremolo >::saveLine(ostream* file, atom* currentAtom) {
|
|---|
| [8bf9c6] | 230 | std::vector<string>::iterator it;
|
|---|
| [2e352f] | 231 |
|
|---|
| [b8d4a3] | 232 | TremoloKey::atomDataKey currentField;
|
|---|
| 233 |
|
|---|
| [47d041] | 234 | LOG(4, "INFO: Saving atom " << *currentAtom << ", its father id is " << currentAtom->GetTrueFather()->getId());
|
|---|
| [4d4d33] | 235 |
|
|---|
| [b8d4a3] | 236 | for (it = usedFields.begin(); it != usedFields.end(); it++) {
|
|---|
| 237 | currentField = knownKeys[it->substr(0, it->find("="))];
|
|---|
| 238 | switch (currentField) {
|
|---|
| 239 | case TremoloKey::x :
|
|---|
| 240 | // for the moment, assume there are always three dimensions
|
|---|
| [47d041] | 241 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getPosition());
|
|---|
| [d74077] | 242 | *file << currentAtom->at(0) << "\t";
|
|---|
| 243 | *file << currentAtom->at(1) << "\t";
|
|---|
| 244 | *file << currentAtom->at(2) << "\t";
|
|---|
| [b8d4a3] | 245 | break;
|
|---|
| 246 | case TremoloKey::u :
|
|---|
| 247 | // for the moment, assume there are always three dimensions
|
|---|
| [47d041] | 248 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocity());
|
|---|
| [bce72c] | 249 | *file << currentAtom->getAtomicVelocity()[0] << "\t";
|
|---|
| 250 | *file << currentAtom->getAtomicVelocity()[1] << "\t";
|
|---|
| 251 | *file << currentAtom->getAtomicVelocity()[2] << "\t";
|
|---|
| [b8d4a3] | 252 | break;
|
|---|
| [305e7e] | 253 | case TremoloKey::type :
|
|---|
| [acd638] | 254 | if (additionalAtomData.count(currentAtom->getId())) {
|
|---|
| 255 | if (additionalAtomData[currentAtom->getId()].get(currentField) != "-") {
|
|---|
| [47d041] | 256 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << additionalAtomData[currentAtom->getId()].get(currentField));
|
|---|
| [acd638] | 257 | *file << additionalAtomData[currentAtom->getId()].get(currentField) << "\t";
|
|---|
| 258 | } else {
|
|---|
| [47d041] | 259 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " default value: " << currentAtom->getType()->getSymbol());
|
|---|
| [acd638] | 260 | *file << currentAtom->getType()->getSymbol() << "\t";
|
|---|
| 261 | }
|
|---|
| 262 | } else if (additionalAtomData.count(currentAtom->GetTrueFather()->getId())) {
|
|---|
| 263 | if (additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField) != "-") {
|
|---|
| [47d041] | 264 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " stuff from father: " << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField));
|
|---|
| [acd638] | 265 | *file << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField) << "\t";
|
|---|
| 266 | } else {
|
|---|
| [47d041] | 267 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " default value from father: " << currentAtom->GetTrueFather()->getType()->getSymbol());
|
|---|
| [acd638] | 268 | *file << currentAtom->GetTrueFather()->getType()->getSymbol() << "\t";
|
|---|
| 269 | }
|
|---|
| [4d4d33] | 270 | } else {
|
|---|
| [47d041] | 271 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " its default value: " << currentAtom->getType()->getSymbol());
|
|---|
| [acd638] | 272 | *file << currentAtom->getType()->getSymbol() << "\t";
|
|---|
| [4d4d33] | 273 | }
|
|---|
| [b8d4a3] | 274 | break;
|
|---|
| 275 | case TremoloKey::Id :
|
|---|
| [47d041] | 276 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getId()+1);
|
|---|
| [812155] | 277 | *file << getLocalId(currentAtom->getId()) << "\t";
|
|---|
| [b8d4a3] | 278 | break;
|
|---|
| 279 | case TremoloKey::neighbors :
|
|---|
| [47d041] | 280 | LOG(3, "Writing type " << knownKeyNames[currentField]);
|
|---|
| [b8d4a3] | 281 | writeNeighbors(file, atoi(it->substr(it->find("=") + 1, 1).c_str()), currentAtom);
|
|---|
| 282 | break;
|
|---|
| [74a444] | 283 | case TremoloKey::resSeq :
|
|---|
| [4d4d33] | 284 | if (additionalAtomData.count(currentAtom->getId())) {
|
|---|
| [47d041] | 285 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << additionalAtomData[currentAtom->getId()].get(currentField));
|
|---|
| [74a444] | 286 | *file << additionalAtomData[currentAtom->getId()].get(currentField);
|
|---|
| 287 | } else if (currentAtom->getMolecule() != NULL) {
|
|---|
| [47d041] | 288 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " its own id: " << currentAtom->getMolecule()->getId()+1);
|
|---|
| [74a444] | 289 | *file << setw(4) << currentAtom->getMolecule()->getId()+1;
|
|---|
| 290 | } else {
|
|---|
| [47d041] | 291 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " default value: " << defaultAdditionalData.get(currentField));
|
|---|
| [74a444] | 292 | *file << defaultAdditionalData.get(currentField);
|
|---|
| 293 | }
|
|---|
| 294 | *file << "\t";
|
|---|
| [4d4d33] | 295 | break;
|
|---|
| [b8d4a3] | 296 | default :
|
|---|
| [4d4d33] | 297 | if (additionalAtomData.count(currentAtom->getId())) {
|
|---|
| [47d041] | 298 | LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << additionalAtomData[currentAtom->getId()].get(currentField));
|
|---|
| [74a444] | 299 | *file << additionalAtomData[currentAtom->getId()].get(currentField);
|
|---|
| [4d4d33] | 300 | } else if (additionalAtomData.count(currentAtom->GetTrueFather()->getId())) {
|
|---|
| [47d041] | 301 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " stuff from father: " << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField));
|
|---|
| [74a444] | 302 | *file << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField);
|
|---|
| 303 | } else {
|
|---|
| [47d041] | 304 | LOG(3, "Writing for type " << knownKeyNames[currentField] << " the default: " << defaultAdditionalData.get(currentField));
|
|---|
| [74a444] | 305 | *file << defaultAdditionalData.get(currentField);
|
|---|
| 306 | }
|
|---|
| [b8d4a3] | 307 | *file << "\t";
|
|---|
| 308 | break;
|
|---|
| 309 | }
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | *file << endl;
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | /**
|
|---|
| 316 | * Writes the neighbor information of one atom to the provided stream.
|
|---|
| 317 | *
|
|---|
| [9d83b6] | 318 | * Note that ListOfBonds of WorldTime::CurrentTime is used.
|
|---|
| 319 | *
|
|---|
| [b8d4a3] | 320 | * \param stream where to write neighbor information to
|
|---|
| 321 | * \param number of neighbors
|
|---|
| 322 | * \param reference to the atom of which to take the neighbor information
|
|---|
| 323 | */
|
|---|
| [765f16] | 324 | void FormatParser< tremolo >::writeNeighbors(ostream* file, int numberOfNeighbors, atom* currentAtom) {
|
|---|
| [9d83b6] | 325 | const BondList& ListOfBonds = currentAtom->getListOfBonds();
|
|---|
| [ca2cfa] | 326 | // sort bonded indices
|
|---|
| 327 | typedef std::set<atomId_t> sortedIndices;
|
|---|
| 328 | sortedIndices sortedBonds;
|
|---|
| 329 | for (BondList::const_iterator iter = ListOfBonds.begin();
|
|---|
| 330 | iter != ListOfBonds.end(); ++iter)
|
|---|
| [812155] | 331 | sortedBonds.insert(getLocalId((*iter)->GetOtherAtom(currentAtom)->getId()));
|
|---|
| [ca2cfa] | 332 | // print indices
|
|---|
| 333 | sortedIndices::const_iterator currentBond = sortedBonds.begin();
|
|---|
| [b8d4a3] | 334 | for (int i = 0; i < numberOfNeighbors; i++) {
|
|---|
| [812155] | 335 | *file << (currentBond != sortedBonds.end() ? (*currentBond) : 0) << "\t";
|
|---|
| [ca2cfa] | 336 | if (currentBond != sortedBonds.end())
|
|---|
| [0bbfa1] | 337 | ++currentBond;
|
|---|
| [b8d4a3] | 338 | }
|
|---|
| [9131f3] | 339 | }
|
|---|
| 340 |
|
|---|
| 341 | /**
|
|---|
| 342 | * Stores keys from the ATOMDATA line.
|
|---|
| 343 | *
|
|---|
| 344 | * \param line to parse the keys from
|
|---|
| 345 | * \param with which offset the keys begin within the line
|
|---|
| 346 | */
|
|---|
| [765f16] | 347 | void FormatParser< tremolo >::parseAtomDataKeysLine(string line, int offset) {
|
|---|
| [8bf9c6] | 348 | std::string keyword;
|
|---|
| 349 | std::stringstream lineStream;
|
|---|
| [9131f3] | 350 |
|
|---|
| 351 | lineStream << line.substr(offset);
|
|---|
| [f23303] | 352 | LOG(1, "INFO: Clearing usedFields in parseAtomDataKeysLine.");
|
|---|
| [52baf9] | 353 | usedFields.clear();
|
|---|
| [9131f3] | 354 | while (lineStream.good()) {
|
|---|
| 355 | lineStream >> keyword;
|
|---|
| [b8d4a3] | 356 | if (knownKeys[keyword.substr(0, keyword.find("="))] == TremoloKey::noKey) {
|
|---|
| [ecb799] | 357 | // TODO: throw exception about unknown key
|
|---|
| [4415da] | 358 | cout << "Unknown key: " << keyword << " is not part of the tremolo format specification." << endl;
|
|---|
| 359 | break;
|
|---|
| 360 | }
|
|---|
| [9131f3] | 361 | usedFields.push_back(keyword);
|
|---|
| 362 | }
|
|---|
| [47d041] | 363 | //LOG(1, "INFO: " << usedFields);
|
|---|
| [9131f3] | 364 | }
|
|---|
| 365 |
|
|---|
| [81c980b] | 366 | /** Sets the properties per atom to print to .data file by parsing line from
|
|---|
| 367 | * \a atomdata_string.
|
|---|
| 368 | *
|
|---|
| [765f16] | 369 | * We just call \sa FormatParser< tremolo >::parseAtomDataKeysLine() which is left
|
|---|
| [81c980b] | 370 | * private.,
|
|---|
| 371 | *
|
|---|
| 372 | * @param atomdata_string line to parse with space-separated values
|
|---|
| 373 | */
|
|---|
| [765f16] | 374 | void FormatParser< tremolo >::setAtomData(const std::string &atomdata_string)
|
|---|
| [81c980b] | 375 | {
|
|---|
| 376 | parseAtomDataKeysLine(atomdata_string, 0);
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| [9131f3] | 380 | /**
|
|---|
| 381 | * Reads one data line of a tremolo file and interprets it according to the keys
|
|---|
| 382 | * obtained from the ATOMDATA line.
|
|---|
| 383 | *
|
|---|
| 384 | * \param line to parse as an atom
|
|---|
| [dc1d9e] | 385 | * \param *newmol molecule to add atom to
|
|---|
| [9131f3] | 386 | */
|
|---|
| [8bf9c6] | 387 | void FormatParser< tremolo >::readAtomDataLine(std::string line, molecule *newmol = NULL) {
|
|---|
| 388 | std::vector<string>::iterator it;
|
|---|
| 389 | std::stringstream lineStream;
|
|---|
| [4415da] | 390 | atom* newAtom = World::getInstance().createAtom();
|
|---|
| [89a31d] | 391 | const atomId_t atomid = newAtom->getId();
|
|---|
| 392 | additionalAtomData[atomid] = TremoloAtomInfoContainer(); // fill with default values
|
|---|
| 393 | TremoloAtomInfoContainer *atomInfo = &additionalAtomData[atomid];
|
|---|
| [b8d4a3] | 394 | TremoloKey::atomDataKey currentField;
|
|---|
| [72d108] | 395 | ConvertTo<double> toDouble;
|
|---|
| 396 | ConvertTo<int> toInt;
|
|---|
| [056e70] | 397 | Vector tempVector;
|
|---|
| [72d108] | 398 |
|
|---|
| 399 | // setup tokenizer, splitting up white-spaced entries
|
|---|
| 400 | typedef boost::tokenizer<boost::char_separator<char> >
|
|---|
| 401 | tokenizer;
|
|---|
| 402 | boost::char_separator<char> whitespacesep(" \t");
|
|---|
| 403 | tokenizer tokens(line, whitespacesep);
|
|---|
| 404 | ASSERT(tokens.begin() != tokens.end(),
|
|---|
| [765f16] | 405 | "FormatParser< tremolo >::readAtomDataLine - empty string, need at least ' '!");
|
|---|
| [72d108] | 406 | tokenizer::iterator tok_iter = tokens.begin();
|
|---|
| 407 | // then associate each token to each file
|
|---|
| [b8d4a3] | 408 | for (it = usedFields.begin(); it < usedFields.end(); it++) {
|
|---|
| [72d108] | 409 | const std::string keyName = it->substr(0, it->find("="));
|
|---|
| 410 | currentField = knownKeys[keyName];
|
|---|
| [8bf9c6] | 411 | const std::string word = *tok_iter;
|
|---|
| [47d041] | 412 | LOG(4, "INFO: Parsing key " << keyName << " with remaining data " << word);
|
|---|
| [4415da] | 413 | switch (currentField) {
|
|---|
| [b8d4a3] | 414 | case TremoloKey::x :
|
|---|
| [4415da] | 415 | // for the moment, assume there are always three dimensions
|
|---|
| [d74077] | 416 | for (int i=0;i<NDIM;i++) {
|
|---|
| [765f16] | 417 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for x["+toString(i)+"]!");
|
|---|
| [47d041] | 418 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [72d108] | 419 | newAtom->set(i, toDouble(*tok_iter));
|
|---|
| 420 | tok_iter++;
|
|---|
| [d74077] | 421 | }
|
|---|
| [4415da] | 422 | break;
|
|---|
| [b8d4a3] | 423 | case TremoloKey::u :
|
|---|
| [4415da] | 424 | // for the moment, assume there are always three dimensions
|
|---|
| [72d108] | 425 | for (int i=0;i<NDIM;i++) {
|
|---|
| [765f16] | 426 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for u["+toString(i)+"]!");
|
|---|
| [47d041] | 427 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [056e70] | 428 | tempVector[i] = toDouble(*tok_iter);
|
|---|
| [72d108] | 429 | tok_iter++;
|
|---|
| 430 | }
|
|---|
| [056e70] | 431 | newAtom->setAtomicVelocity(tempVector);
|
|---|
| [4415da] | 432 | break;
|
|---|
| [305e7e] | 433 | case TremoloKey::type :
|
|---|
| [4d4d33] | 434 | {
|
|---|
| [765f16] | 435 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!");
|
|---|
| [47d041] | 436 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [4d4d33] | 437 | std::string element(knownTypes[(*tok_iter)]);
|
|---|
| 438 | // put type name into container for later use
|
|---|
| 439 | atomInfo->set(currentField, *tok_iter);
|
|---|
| [47d041] | 440 | LOG(4, "INFO: Parsing element " << (*tok_iter) << " as " << element << " according to KnownTypes.");
|
|---|
| [72d108] | 441 | tok_iter++;
|
|---|
| [4d4d33] | 442 | newAtom->setType(World::getInstance().getPeriode()->FindElement(element));
|
|---|
| [b8d4a3] | 443 | ASSERT(newAtom->getType(), "Type was not set for this atom");
|
|---|
| [4415da] | 444 | break;
|
|---|
| [4d4d33] | 445 | }
|
|---|
| [b8d4a3] | 446 | case TremoloKey::Id :
|
|---|
| [765f16] | 447 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!");
|
|---|
| [47d041] | 448 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [c0e28c] | 449 | associateLocaltoGlobalId(toInt(*tok_iter), atomid);
|
|---|
| [72d108] | 450 | tok_iter++;
|
|---|
| [4415da] | 451 | break;
|
|---|
| [b8d4a3] | 452 | case TremoloKey::neighbors :
|
|---|
| [72d108] | 453 | for (int i=0;i<atoi(it->substr(it->find("=") + 1, 1).c_str());i++) {
|
|---|
| [765f16] | 454 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!");
|
|---|
| [47d041] | 455 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [72d108] | 456 | lineStream << *tok_iter << "\t";
|
|---|
| 457 | tok_iter++;
|
|---|
| 458 | }
|
|---|
| [b8d4a3] | 459 | readNeighbors(&lineStream,
|
|---|
| [89a31d] | 460 | atoi(it->substr(it->find("=") + 1, 1).c_str()), atomid);
|
|---|
| [9131f3] | 461 | break;
|
|---|
| 462 | default :
|
|---|
| [765f16] | 463 | ASSERT(tok_iter != tokens.end(), "FormatParser< tremolo >::readAtomDataLine() - no value for "+keyName+"!");
|
|---|
| [47d041] | 464 | LOG(4, "INFO: Parsing key " << keyName << " with next token " << *tok_iter);
|
|---|
| [72d108] | 465 | atomInfo->set(currentField, *tok_iter);
|
|---|
| 466 | tok_iter++;
|
|---|
| [9131f3] | 467 | break;
|
|---|
| 468 | }
|
|---|
| 469 | }
|
|---|
| [89a31d] | 470 | LOG(3, "INFO: Parsed atom " << atomid << ".");
|
|---|
| 471 | if (newmol != NULL)
|
|---|
| [dc1d9e] | 472 | newmol->AddAtom(newAtom);
|
|---|
| [6bc51d] | 473 | }
|
|---|
| [9131f3] | 474 |
|
|---|
| [b8d4a3] | 475 | /**
|
|---|
| 476 | * Reads neighbor information for one atom from the input.
|
|---|
| 477 | *
|
|---|
| [0bbfa1] | 478 | * \param line stream where to read the information from
|
|---|
| 479 | * \param numberOfNeighbors number of neighbors to read
|
|---|
| 480 | * \param atomid world id of the atom the information belongs to
|
|---|
| [b8d4a3] | 481 | */
|
|---|
| [765f16] | 482 | void FormatParser< tremolo >::readNeighbors(stringstream* line, int numberOfNeighbors, int atomId) {
|
|---|
| [b8d4a3] | 483 | int neighborId = 0;
|
|---|
| 484 | for (int i = 0; i < numberOfNeighbors; i++) {
|
|---|
| 485 | *line >> neighborId;
|
|---|
| 486 | // 0 is used to fill empty neighbor positions in the tremolo file.
|
|---|
| 487 | if (neighborId > 0) {
|
|---|
| [47d041] | 488 | LOG(4, "INFO: Atom with global id " << atomId
|
|---|
| 489 | << " has neighbour with serial " << neighborId);
|
|---|
| [b8d4a3] | 490 | additionalAtomData[atomId].neighbors.push_back(neighborId);
|
|---|
| 491 | }
|
|---|
| 492 | }
|
|---|
| 493 | }
|
|---|
| [9131f3] | 494 |
|
|---|
| 495 | /**
|
|---|
| [b8d4a3] | 496 | * Checks whether the provided name is within the list of used fields.
|
|---|
| [9131f3] | 497 | *
|
|---|
| [b8d4a3] | 498 | * \param field name to check
|
|---|
| 499 | *
|
|---|
| 500 | * \return true if the field name is used
|
|---|
| [9131f3] | 501 | */
|
|---|
| [765f16] | 502 | bool FormatParser< tremolo >::isUsedField(string fieldName) {
|
|---|
| [b8d4a3] | 503 | bool fieldNameExists = false;
|
|---|
| [8bf9c6] | 504 | for (std::vector<std::string>::iterator usedField = usedFields.begin(); usedField != usedFields.end(); usedField++) {
|
|---|
| [b8d4a3] | 505 | if (usedField->substr(0, usedField->find("=")) == fieldName)
|
|---|
| 506 | fieldNameExists = true;
|
|---|
| 507 | }
|
|---|
| [9131f3] | 508 |
|
|---|
| [b8d4a3] | 509 | return fieldNameExists;
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 | /**
|
|---|
| 514 | * Adds the collected neighbor information to the atoms in the world. The atoms
|
|---|
| 515 | * are found by their current ID and mapped to the corresponding atoms with the
|
|---|
| 516 | * Id found in the parsed file.
|
|---|
| 517 | */
|
|---|
| [765f16] | 518 | void FormatParser< tremolo >::processNeighborInformation() {
|
|---|
| [b8d4a3] | 519 | if (!isUsedField("neighbors")) {
|
|---|
| 520 | return;
|
|---|
| 521 | }
|
|---|
| 522 |
|
|---|
| [8bf9c6] | 523 | for(std::map<const atomId_t, TremoloAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
|
|---|
| [b8d4a3] | 524 | currentInfo != additionalAtomData.end(); currentInfo++
|
|---|
| 525 | ) {
|
|---|
| [0bbfa1] | 526 | if (!currentInfo->second.neighbors_processed) {
|
|---|
| [8bf9c6] | 527 | for(std::vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
|
|---|
| [0bbfa1] | 528 | neighbor != currentInfo->second.neighbors.end(); neighbor++
|
|---|
| 529 | ) {
|
|---|
| [c0e28c] | 530 | LOG(3, "INFO: Creating bond between ("
|
|---|
| 531 | << currentInfo->first
|
|---|
| 532 | << ") and ("
|
|---|
| 533 | << getGlobalId(*neighbor) << "|" << *neighbor << ")");
|
|---|
| 534 | ASSERT(getGlobalId(*neighbor) != -1,
|
|---|
| 535 | "FormatParser< tremolo >::processNeighborInformation() - global id to local id "
|
|---|
| 536 | +toString(*neighbor)+" is unknown.");
|
|---|
| [0bbfa1] | 537 | World::getInstance().getAtom(AtomById(currentInfo->first))
|
|---|
| [c0e28c] | 538 | ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(getGlobalId(*neighbor))));
|
|---|
| [0bbfa1] | 539 | }
|
|---|
| 540 | currentInfo->second.neighbors_processed = true;
|
|---|
| [9131f3] | 541 | }
|
|---|
| 542 | }
|
|---|
| [6bc51d] | 543 | }
|
|---|
| 544 |
|
|---|
| [9131f3] | 545 | /**
|
|---|
| [b8d4a3] | 546 | * Replaces atom IDs read from the file by the corresponding world IDs. All IDs
|
|---|
| 547 | * IDs of the input string will be replaced; expected separating characters are
|
|---|
| 548 | * "-" and ",".
|
|---|
| [9131f3] | 549 | *
|
|---|
| [b8d4a3] | 550 | * \param string in which atom IDs should be adapted
|
|---|
| 551 | *
|
|---|
| 552 | * \return input string with modified atom IDs
|
|---|
| [9131f3] | 553 | */
|
|---|
| [765f16] | 554 | std::string FormatParser< tremolo >::adaptIdDependentDataString(string data) {
|
|---|
| [b8d4a3] | 555 | // there might be no IDs
|
|---|
| 556 | if (data == "-") {
|
|---|
| 557 | return "-";
|
|---|
| 558 | }
|
|---|
| 559 |
|
|---|
| 560 | char separator;
|
|---|
| 561 | int id;
|
|---|
| [8bf9c6] | 562 | std::stringstream line, result;
|
|---|
| [b8d4a3] | 563 | line << data;
|
|---|
| 564 |
|
|---|
| 565 | line >> id;
|
|---|
| [c0e28c] | 566 | result << getGlobalId(id);
|
|---|
| [b8d4a3] | 567 | while (line.good()) {
|
|---|
| 568 | line >> separator >> id;
|
|---|
| [c0e28c] | 569 | result << separator << getGlobalId(id);
|
|---|
| [b8d4a3] | 570 | }
|
|---|
| 571 |
|
|---|
| 572 | return result.str();
|
|---|
| [6bc51d] | 573 | }
|
|---|
| [b8d4a3] | 574 |
|
|---|
| 575 | /**
|
|---|
| 576 | * Corrects the atom IDs in each imprData entry to the corresponding world IDs
|
|---|
| 577 | * as they might differ from the originally read IDs.
|
|---|
| 578 | */
|
|---|
| [765f16] | 579 | void FormatParser< tremolo >::adaptImprData() {
|
|---|
| [b8d4a3] | 580 | if (!isUsedField("imprData")) {
|
|---|
| 581 | return;
|
|---|
| 582 | }
|
|---|
| 583 |
|
|---|
| [8bf9c6] | 584 | for(std::map<const atomId_t, TremoloAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
|
|---|
| [b8d4a3] | 585 | currentInfo != additionalAtomData.end(); currentInfo++
|
|---|
| 586 | ) {
|
|---|
| 587 | currentInfo->second.imprData = adaptIdDependentDataString(currentInfo->second.imprData);
|
|---|
| 588 | }
|
|---|
| [6bc51d] | 589 | }
|
|---|
| [4415da] | 590 |
|
|---|
| [b8d4a3] | 591 | /**
|
|---|
| 592 | * Corrects the atom IDs in each torsion entry to the corresponding world IDs
|
|---|
| 593 | * as they might differ from the originally read IDs.
|
|---|
| 594 | */
|
|---|
| [765f16] | 595 | void FormatParser< tremolo >::adaptTorsion() {
|
|---|
| [b8d4a3] | 596 | if (!isUsedField("torsion")) {
|
|---|
| 597 | return;
|
|---|
| 598 | }
|
|---|
| 599 |
|
|---|
| [8bf9c6] | 600 | for(std::map<const atomId_t, TremoloAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
|
|---|
| [b8d4a3] | 601 | currentInfo != additionalAtomData.end(); currentInfo++
|
|---|
| 602 | ) {
|
|---|
| 603 | currentInfo->second.torsion = adaptIdDependentDataString(currentInfo->second.torsion);
|
|---|
| 604 | }
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| [4d4d33] | 607 | /** Creates knownTypes as the identity, e.g. H -> H, He -> He, ... .
|
|---|
| 608 | *
|
|---|
| 609 | */
|
|---|
| [765f16] | 610 | void FormatParser< tremolo >::createKnownTypesByIdentity()
|
|---|
| [4d4d33] | 611 | {
|
|---|
| 612 | // remove old mapping
|
|---|
| 613 | knownTypes.clear();
|
|---|
| 614 | // make knownTypes the identity mapping
|
|---|
| 615 | const periodentafel *periode = World::getInstance().getPeriode();
|
|---|
| 616 | for (periodentafel::const_iterator iter = periode->begin();
|
|---|
| 617 | iter != periode->end();
|
|---|
| 618 | ++iter) {
|
|---|
| 619 | knownTypes.insert( make_pair(iter->second->getSymbol(), iter->second->getSymbol()) );
|
|---|
| 620 | }
|
|---|
| 621 | }
|
|---|
| 622 |
|
|---|
| 623 | /** Parses a .potentials file and creates from it the knownTypes file.
|
|---|
| 624 | *
|
|---|
| 625 | * @param file input stream of .potentials file
|
|---|
| 626 | */
|
|---|
| [765f16] | 627 | void FormatParser< tremolo >::parseKnownTypes(std::istream &file)
|
|---|
| [4d4d33] | 628 | {
|
|---|
| 629 | const periodentafel *periode = World::getInstance().getPeriode();
|
|---|
| 630 | // remove old mapping
|
|---|
| 631 | knownTypes.clear();
|
|---|
| 632 |
|
|---|
| [8bf9c6] | 633 | // LOG(3, "INFO: additionalAtomData contains: " << additionalAtomData);
|
|---|
| [4d4d33] | 634 |
|
|---|
| 635 | // parse in file
|
|---|
| 636 | typedef boost::tokenizer<boost::char_separator<char> >
|
|---|
| 637 | tokenizer;
|
|---|
| 638 | boost::char_separator<char> tokensep(":\t ,;");
|
|---|
| 639 | boost::char_separator<char> equalitysep("\t =");
|
|---|
| 640 | std::string line;
|
|---|
| 641 | while (file.good()) {
|
|---|
| 642 | std::getline( file, line );
|
|---|
| [47d041] | 643 | LOG(4, "INFO: full line of parameters is '" << line << "'");
|
|---|
| [4d4d33] | 644 | if (line.find("particle:") != string::npos) {
|
|---|
| [47d041] | 645 | LOG(3, "INFO: found line '" << line << "' containing keyword 'particle:'.");
|
|---|
| [4d4d33] | 646 | tokenizer tokens(line, tokensep);
|
|---|
| 647 | ASSERT(tokens.begin() != tokens.end(),
|
|---|
| [765f16] | 648 | "FormatParser< tremolo >::parseKnownTypes() - line with 'particle:' but no particles separated by comma.");
|
|---|
| [4d4d33] | 649 | // look for particle_type
|
|---|
| 650 | std::string particle_type("NULL");
|
|---|
| 651 | std::string element_type("NULL");
|
|---|
| 652 | for (tokenizer::iterator tok_iter = tokens.begin();
|
|---|
| 653 | tok_iter != tokens.end();
|
|---|
| 654 | ++tok_iter) {
|
|---|
| 655 | if ((*tok_iter).find("particle_type") != string::npos) {
|
|---|
| [f23303] | 656 | LOG(3, "INFO: found token '" << *tok_iter << "' containing keyword 'particle_type'.");
|
|---|
| [4d4d33] | 657 | tokenizer token((*tok_iter), equalitysep);
|
|---|
| 658 | ASSERT(token.begin() != token.end(),
|
|---|
| [765f16] | 659 | "FormatParser< tremolo >::parseKnownTypes() - could not split particle_type by equality sign");
|
|---|
| [4d4d33] | 660 | tokenizer::iterator particle_iter = token.begin();
|
|---|
| 661 | particle_iter++;
|
|---|
| 662 | particle_type = *particle_iter;
|
|---|
| 663 | }
|
|---|
| 664 | if ((*tok_iter).find("element_name") != string::npos) {
|
|---|
| [f23303] | 665 | LOG(3, "INFO: found token '" << *tok_iter << "' containing keyword 'element_name'.");
|
|---|
| [4d4d33] | 666 | tokenizer token((*tok_iter), equalitysep);
|
|---|
| 667 | ASSERT(token.begin() != token.end(),
|
|---|
| [765f16] | 668 | "FormatParser< tremolo >::parseKnownTypes() - could not split particle_type by equality sign");
|
|---|
| [4d4d33] | 669 | tokenizer::iterator element_iter = token.begin();
|
|---|
| 670 | element_iter++;
|
|---|
| 671 | element_type = *element_iter;
|
|---|
| 672 | }
|
|---|
| 673 | }
|
|---|
| 674 | if ((particle_type != "NULL") && (element_type != "NULL")) {
|
|---|
| 675 | if (periode->FindElement(element_type) != NULL) {
|
|---|
| [47d041] | 676 | LOG(1, "INFO: Added Type " << particle_type << " as reference to element " << element_type << ".");
|
|---|
| [4d4d33] | 677 | knownTypes.insert( make_pair (particle_type, element_type) );
|
|---|
| 678 | } else {
|
|---|
| [47d041] | 679 | ELOG(1, "INFO: Either Type " << particle_type << " or " << element_type << " could not be recognized." );
|
|---|
| [4d4d33] | 680 | }
|
|---|
| 681 | } else {
|
|---|
| [f23303] | 682 | ELOG(3, "Line does not contain both 'particle_type' and 'element_name' as keys." );
|
|---|
| [4d4d33] | 683 | }
|
|---|
| 684 | }
|
|---|
| 685 | }
|
|---|
| 686 |
|
|---|
| 687 | }
|
|---|