| [be945c] | 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 |  * DipoleAngularCorrelationAction.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 "CodePatterns/MemDebug.hpp"
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | #include "analysis_correlation.hpp"
 | 
|---|
 | 23 | #include "boundary.hpp"
 | 
|---|
 | 24 | #include "linkedcell.hpp"
 | 
|---|
 | 25 | #include "CodePatterns/Verbose.hpp"
 | 
|---|
 | 26 | #include "CodePatterns/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/DipoleAngularCorrelationAction.hpp"
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | // and construct the stuff
 | 
|---|
 | 41 | #include "DipoleAngularCorrelationAction.def"
 | 
|---|
 | 42 | #include "Action_impl_pre.hpp"
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | /** =========== define the function ====================== */
 | 
|---|
 | 45 | Action::state_ptr AnalysisDipoleAngularCorrelationAction::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.string().c_str());
 | 
|---|
 | 57 |   binoutput.open(params.binoutputname.string().c_str());
 | 
|---|
 | 58 |   DipoleAngularCorrelationMap *correlationmap = NULL;
 | 
|---|
 | 59 |   std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
 | 
|---|
 | 60 |   DoLog(0) && (Log() << Verbose(0) << "There are " << molecules.size() << " selected molecules." << std::endl);
 | 
|---|
 | 61 |   ASSERT(!params.periodic, "AnalysisDipoleAngularCorrelationAction() - periodic case not implemented.");
 | 
|---|
 | 62 |   correlationmap = DipoleAngularCorrelation(molecules);
 | 
|---|
| [92e5cb] | 63 |   OutputCorrelationMap<DipoleAngularCorrelationMap>(&output, correlationmap, OutputDipoleAngularCorrelation_Header, OutputDipoleAngularCorrelation_Value);
 | 
|---|
| [be945c] | 64 |   binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
 | 
|---|
| [92e5cb] | 65 |   OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value );
 | 
|---|
| [be945c] | 66 |   delete(binmap);
 | 
|---|
 | 67 |   delete(correlationmap);
 | 
|---|
 | 68 |   output.close();
 | 
|---|
 | 69 |   binoutput.close();
 | 
|---|
 | 70 |   return Action::success;
 | 
|---|
 | 71 | }
 | 
|---|
 | 72 | 
 | 
|---|
 | 73 | Action::state_ptr AnalysisDipoleAngularCorrelationAction::performUndo(Action::state_ptr _state) {
 | 
|---|
 | 74 |   return Action::success;
 | 
|---|
 | 75 | }
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | Action::state_ptr AnalysisDipoleAngularCorrelationAction::performRedo(Action::state_ptr _state){
 | 
|---|
 | 78 |   return Action::success;
 | 
|---|
 | 79 | }
 | 
|---|
 | 80 | 
 | 
|---|
 | 81 | bool AnalysisDipoleAngularCorrelationAction::canUndo() {
 | 
|---|
 | 82 |   return true;
 | 
|---|
 | 83 | }
 | 
|---|
 | 84 | 
 | 
|---|
 | 85 | bool AnalysisDipoleAngularCorrelationAction::shouldUndo() {
 | 
|---|
 | 86 |   return true;
 | 
|---|
 | 87 | }
 | 
|---|
 | 88 | /** =========== end of function ====================== */
 | 
|---|