- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ParserAction/LoadXyzAction.cpp
r952f38 rbcf653 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 * LoadXyzAction.cpp … … 5 12 * Author: heber 6 13 */ 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 7 19 8 20 #include "Helpers/MemDebug.hpp" … … 74 86 input.open(filename.c_str()); 75 87 if (!input.fail()) { 76 // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include77 set <atom*> UniqueList;78 {79 vector<atom *> ListBefore = World::getInstance().getAllAtoms();80 for (vector<atom *>::iterator runner = ListBefore.begin();runner != ListBefore.end(); ++runner)81 UniqueList.insert(*runner);82 }83 88 XyzParser parser; // briefly instantiate a parser which is removed at end of focus 84 89 parser.load(&input); 85 {86 vector<atom *> ListAfter = World::getInstance().getAllAtoms();87 pair< set<atom *>::iterator, bool > Inserter;88 if (UniqueList.size() != ListAfter.size()) { // only create if new atoms have been parsed89 MoleculeListClass *molecules = World::getInstance().getMolecules();90 molecule *mol = World::getInstance().createMolecule();91 molecules->insert(mol);92 for (vector<atom *>::iterator runner = ListAfter.begin(); runner != ListAfter.end(); ++runner) {93 Inserter = UniqueList.insert(*runner);94 if (Inserter.second) { // if not present, then new (just parsed) atom, add ...95 cout << "Adding new atom " << **runner << " to new mol." << endl;96 mol->AddAtom(*runner);97 }98 }99 mol->doCountAtoms();100 } else {101 cout << "No atoms parsed?" << endl;102 }103 }104 90 } else { 105 91 DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << filename << "." << endl);
Note:
See TracChangeset
for help on using the changeset viewer.