| 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 |
|
|---|
| 8 | /*
|
|---|
| 9 | * PairCorrelationAction.cpp
|
|---|
| 10 | *
|
|---|
| 11 | * Created on: May 9, 2010
|
|---|
| 12 | * Author: heber
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | // include config.h
|
|---|
| 16 | #ifdef HAVE_CONFIG_H
|
|---|
| 17 | #include <config.h>
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| 20 | #include "Helpers/MemDebug.hpp"
|
|---|
| 21 |
|
|---|
| 22 | #include "analysis_correlation.hpp"
|
|---|
| 23 | #include "boundary.hpp"
|
|---|
| 24 | #include "linkedcell.hpp"
|
|---|
| 25 | #include "Helpers/Verbose.hpp"
|
|---|
| 26 | #include "Helpers/Log.hpp"
|
|---|
| 27 | #include "element.hpp"
|
|---|
| 28 | #include "molecule.hpp"
|
|---|
| 29 | #include "periodentafel.hpp"
|
|---|
| 30 | #include "LinearAlgebra/Vector.hpp"
|
|---|
| 31 | #include "World.hpp"
|
|---|
| 32 |
|
|---|
| 33 | #include <iostream>
|
|---|
| 34 | #include <string>
|
|---|
| 35 |
|
|---|
| 36 | using namespace std;
|
|---|
| 37 |
|
|---|
| 38 | #include "Actions/AnalysisAction/PairCorrelationAction.hpp"
|
|---|
| 39 |
|
|---|
| 40 | // and construct the stuff
|
|---|
| 41 | #include "PairCorrelationAction.def"
|
|---|
| 42 | #include "Action_impl_pre.hpp"
|
|---|
| 43 |
|
|---|
| 44 | /** =========== define the function ====================== */
|
|---|
| 45 | Action::state_ptr AnalysisPairCorrelationAction::performCall() {
|
|---|
| 46 | int ranges[3] = {1, 1, 1};
|
|---|
| 47 | ofstream output;
|
|---|
| 48 | ofstream binoutput;
|
|---|
| 49 | string type;
|
|---|
| 50 | BinPairMap *binmap = NULL;
|
|---|
| 51 |
|
|---|
| 52 | // obtain information
|
|---|
| 53 | getParametersfromValueStorage();
|
|---|
| 54 |
|
|---|
| 55 | // execute action
|
|---|
| 56 | output.open(params.outputname.c_str());
|
|---|
| 57 | binoutput.open(params.binoutputname.c_str());
|
|---|
| 58 | PairCorrelationMap *correlationmap = NULL;
|
|---|
| 59 | std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
|
|---|
| 60 | if (params.periodic)
|
|---|
| 61 | correlationmap = PeriodicPairCorrelation(molecules, params.elements, ranges);
|
|---|
| 62 | else
|
|---|
| 63 | correlationmap = PairCorrelation(molecules, params.elements);
|
|---|
| 64 | OutputPairCorrelation(&output, correlationmap);
|
|---|
| 65 | binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
|
|---|
| 66 | OutputCorrelation ( &binoutput, binmap );
|
|---|
| 67 | delete(binmap);
|
|---|
| 68 | delete(correlationmap);
|
|---|
| 69 | output.close();
|
|---|
| 70 | binoutput.close();
|
|---|
| 71 | return Action::success;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | Action::state_ptr AnalysisPairCorrelationAction::performUndo(Action::state_ptr _state) {
|
|---|
| 75 | return Action::success;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | Action::state_ptr AnalysisPairCorrelationAction::performRedo(Action::state_ptr _state){
|
|---|
| 79 | return Action::success;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | bool AnalysisPairCorrelationAction::canUndo() {
|
|---|
| 83 | return true;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | bool AnalysisPairCorrelationAction::shouldUndo() {
|
|---|
| 87 | return true;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | const string AnalysisPairCorrelationAction::getName() {
|
|---|
| 91 | return NAME;
|
|---|
| 92 | }
|
|---|
| 93 | /** =========== end of function ====================== */
|
|---|