[208237b] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[94d5ac6] | 5 | *
|
---|
| 6 | *
|
---|
| 7 | * This file is part of MoleCuilder.
|
---|
| 8 | *
|
---|
| 9 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 10 | * it under the terms of the GNU General Public License as published by
|
---|
| 11 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 12 | * (at your option) any later version.
|
---|
| 13 | *
|
---|
| 14 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | * GNU General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * You should have received a copy of the GNU General Public License
|
---|
| 20 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
[208237b] | 21 | */
|
---|
| 22 |
|
---|
| 23 | /*
|
---|
| 24 | * DipoleCorrelationAction.cpp
|
---|
| 25 | *
|
---|
| 26 | * Created on: May 9, 2010
|
---|
| 27 | * Author: heber
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | // include config.h
|
---|
| 31 | #ifdef HAVE_CONFIG_H
|
---|
| 32 | #include <config.h>
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | #include "CodePatterns/MemDebug.hpp"
|
---|
| 36 |
|
---|
| 37 | #include "Analysis/analysis_correlation.hpp"
|
---|
| 38 | #include "CodePatterns/Log.hpp"
|
---|
| 39 | #include "Element/element.hpp"
|
---|
| 40 | #include "Element/periodentafel.hpp"
|
---|
| 41 | #include "LinearAlgebra/Vector.hpp"
|
---|
| 42 | #include "molecule.hpp"
|
---|
| 43 | #include "World.hpp"
|
---|
| 44 |
|
---|
| 45 | #include <iostream>
|
---|
| 46 | #include <string>
|
---|
| 47 |
|
---|
| 48 | using namespace MoleCuilder;
|
---|
| 49 |
|
---|
| 50 | #include "Actions/AnalysisAction/DipoleCorrelationAction.hpp"
|
---|
| 51 |
|
---|
| 52 | // and construct the stuff
|
---|
| 53 | #include "DipoleCorrelationAction.def"
|
---|
| 54 | #include "Action_impl_pre.hpp"
|
---|
| 55 |
|
---|
| 56 | /** =========== define the function ====================== */
|
---|
| 57 | Action::state_ptr AnalysisDipoleCorrelationAction::performCall() {
|
---|
| 58 | //int ranges[3] = {1, 1, 1};
|
---|
| 59 | ofstream output;
|
---|
| 60 | ofstream binoutput;
|
---|
| 61 | string type;
|
---|
| 62 | BinPairMap *binmap = NULL;
|
---|
| 63 |
|
---|
| 64 | // execute action
|
---|
[f10b0c] | 65 | output.open(params.outputname.get().string().c_str());
|
---|
| 66 | binoutput.open(params.binoutputname.get().string().c_str());
|
---|
[208237b] | 67 | DipoleCorrelationMap *correlationmap = NULL;
|
---|
| 68 | std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
|
---|
| 69 | LOG(0, "STATUS: There are " << molecules.size() << " selected molecules.");
|
---|
[f10b0c] | 70 | ASSERT(!params.periodic.get(), "AnalysisDipoleCorrelationAction() - periodic case not implemented.");
|
---|
[208237b] | 71 | correlationmap = DipoleCorrelation(molecules);
|
---|
| 72 | OutputCorrelationMap<DipoleCorrelationMap>(&output, correlationmap, OutputDipoleCorrelation_Header, OutputDipoleCorrelation_Value);
|
---|
[f10b0c] | 73 | binmap = BinData( correlationmap, params.BinWidth.get(), params.BinStart.get(), params.BinEnd.get() );
|
---|
[208237b] | 74 | OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value );
|
---|
| 75 | delete(binmap);
|
---|
| 76 | delete(correlationmap);
|
---|
| 77 | output.close();
|
---|
| 78 | binoutput.close();
|
---|
| 79 | return Action::success;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | Action::state_ptr AnalysisDipoleCorrelationAction::performUndo(Action::state_ptr _state) {
|
---|
| 83 | return Action::success;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | Action::state_ptr AnalysisDipoleCorrelationAction::performRedo(Action::state_ptr _state){
|
---|
| 87 | return Action::success;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | bool AnalysisDipoleCorrelationAction::canUndo() {
|
---|
| 91 | return true;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | bool AnalysisDipoleCorrelationAction::shouldUndo() {
|
---|
| 95 | return true;
|
---|
| 96 | }
|
---|
| 97 | /** =========== end of function ====================== */
|
---|