/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * DipoleCorrelationAction.cpp * * Created on: May 9, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "Analysis/analysis_correlation.hpp" #include "CodePatterns/Log.hpp" #include "Element/element.hpp" #include "Element/periodentafel.hpp" #include "LinearAlgebra/Vector.hpp" #include "molecule.hpp" #include "World.hpp" #include #include using namespace MoleCuilder; #include "Actions/AnalysisAction/DipoleCorrelationAction.hpp" // and construct the stuff #include "DipoleCorrelationAction.def" #include "Action_impl_pre.hpp" /** =========== define the function ====================== */ Action::state_ptr AnalysisDipoleCorrelationAction::performCall() { //int ranges[3] = {1, 1, 1}; ofstream output; ofstream binoutput; string type; BinPairMap *binmap = NULL; // obtain information getParametersfromValueStorage(); // execute action output.open(params.outputname.string().c_str()); binoutput.open(params.binoutputname.string().c_str()); DipoleCorrelationMap *correlationmap = NULL; std::vector molecules = World::getInstance().getSelectedMolecules(); LOG(0, "STATUS: There are " << molecules.size() << " selected molecules."); ASSERT(!params.periodic, "AnalysisDipoleCorrelationAction() - periodic case not implemented."); correlationmap = DipoleCorrelation(molecules); OutputCorrelationMap(&output, correlationmap, OutputDipoleCorrelation_Header, OutputDipoleCorrelation_Value); binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd ); OutputCorrelationMap ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value ); delete(binmap); delete(correlationmap); output.close(); binoutput.close(); return Action::success; } Action::state_ptr AnalysisDipoleCorrelationAction::performUndo(Action::state_ptr _state) { return Action::success; } Action::state_ptr AnalysisDipoleCorrelationAction::performRedo(Action::state_ptr _state){ return Action::success; } bool AnalysisDipoleCorrelationAction::canUndo() { return true; } bool AnalysisDipoleCorrelationAction::shouldUndo() { return true; } /** =========== end of function ====================== */