/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * FillVoidWithMoleculeAction.cpp * * Created on: May 10, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "atom.hpp" #include "bondgraph.hpp" #include "boundary.hpp" #include "config.hpp" #include "molecule.hpp" #include "CodePatterns/Verbose.hpp" #include "World.hpp" #include "Parser/MpqcParser.hpp" #include "Parser/PcpParser.hpp" #include "Parser/PdbParser.hpp" #include "Parser/TremoloParser.hpp" #include "Parser/XyzParser.hpp" #include "Parser/FormatParserStorage.hpp" #include #include using namespace std; #include "Actions/MoleculeAction/FillVoidWithMoleculeAction.hpp" // and construct the stuff #include "FillVoidWithMoleculeAction.def" #include "Action_impl_pre.hpp" /** =========== define the function ====================== */ Action::state_ptr MoleculeFillVoidWithMoleculeAction::performCall() { // obtain information getParametersfromValueStorage(); DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << params.lengths[0] << "," << params.lengths[1] << "," << params.lengths[2] << "), distances (" << params.distances[0] << "," << params.distances[1] << "," << params.distances[2] << "), DoRotate " << params.DoRotate << "." << endl); // construct water molecule molecule *filler = World::getInstance().createMolecule(); std::string FilenameSuffix = params.fillername.string().substr(params.fillername.string().find_last_of('.')+1, params.fillername.string().length()); ifstream input; input.open(params.fillername.string().c_str()); switch (FormatParserStorage::getInstance().getTypeFromSuffix(FilenameSuffix)) { case mpqc: { MpqcParser mpqcparser; mpqcparser.load(&input); break; } case pcp: { PcpParser pcpparser; pcpparser.load(&input); break; } case pdb: { PdbParser pdbparser; pdbparser.load(&input); break; } case tremolo: { TremoloParser tremoloparser; tremoloparser.load(&input); break; } case xyz: { XyzParser xyzparser; xyzparser.load(&input); break; } default: DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << params.fillername << "." << endl); break; } World::MoleculeIterator iter = World::getInstance().getMoleculeIter(); for (; iter != World::getInstance().moleculeEnd(); ++iter) filler = *iter; // get last molecule filler->SetNameFromFilename(params.fillername.string().c_str()); World::getInstance().getConfig()->BG->ConstructBondGraph(filler); // call routine double distance[NDIM]; for (int i=0;i(_state.get()); // string newName = state->mol->getName(); // state->mol->setName(state->lastName); return Action::failure; } Action::state_ptr MoleculeFillVoidWithMoleculeAction::performRedo(Action::state_ptr _state){ // Undo and redo have to do the same for this action return performUndo(_state); } bool MoleculeFillVoidWithMoleculeAction::canUndo() { return false; } bool MoleculeFillVoidWithMoleculeAction::shouldUndo() { return false; } /** =========== end of function ====================== */