Ignore:
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
    18/*
    29 * LoadXyzAction.cpp
     
    512 *      Author: heber
    613 */
     14
     15// include config.h
     16#ifdef HAVE_CONFIG_H
     17#include <config.h>
     18#endif
    719
    820#include "Helpers/MemDebug.hpp"
     
    7486  input.open(filename.c_str());
    7587  if (!input.fail()) {
    76     // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
    77     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     }
    8388    XyzParser parser; // briefly instantiate a parser which is removed at end of focus
    8489    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 parsed
    89         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     }
    10490  } else {
    10591    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << filename << "." << endl);
Note: See TracChangeset for help on using the changeset viewer.