source: src/Actions/AnalysisAction/PairCorrelationAction.cpp@ d02e07

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since d02e07 was d02e07, checked in by Frederik Heber <heber@…>, 14 years ago

Split PairCorrelation into Pair, Point and SurfaceCorrelation.

  • also converted to new createDialog().
  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * PairCorrelationAction.cpp
3 *
4 * Created on: May 9, 2010
5 * Author: heber
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
11#include "analysis_correlation.hpp"
12#include "boundary.hpp"
13#include "linkedcell.hpp"
14#include "verbose.hpp"
15#include "log.hpp"
16#include "element.hpp"
17#include "molecule.hpp"
18#include "periodentafel.hpp"
19#include "vector.hpp"
20#include "World.hpp"
21
22#include <iostream>
23#include <string>
24
25using namespace std;
26
27#include "UIElements/UIFactory.hpp"
28#include "UIElements/Dialog.hpp"
29#include "Actions/MapOfActions.hpp"
30
31const char AnalysisPairCorrelationAction::NAME[] = "pair-correlation";
32
33AnalysisPairCorrelationAction::AnalysisPairCorrelationAction() :
34 Action(NAME)
35{}
36
37AnalysisPairCorrelationAction::~AnalysisPairCorrelationAction()
38{}
39
40Dialog* AnalysisPairCorrelationAction::createDialog() {
41 Dialog *dialog = UIFactory::getInstance().makeDialog();
42 int ranges[3] = {1, 1, 1};
43 double BinEnd = 0.;
44 double BinStart = 0.;
45 double BinWidth = 0.;
46 molecule *Boundary = NULL;
47 string outputname;
48 string binoutputname;
49 bool periodic;
50 ofstream output;
51 ofstream binoutput;
52 std::vector< element *> elements;
53 string type;
54 Vector Point;
55 BinPairMap *binmap = NULL;
56
57 dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
58 dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
59 dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
60 dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
61 dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
62 dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
63 dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
64
65 return dialog;
66}
67
68Action::state_ptr AnalysisPairCorrelationAction::performCall() {
69 int ranges[3] = {1, 1, 1};
70 double BinEnd = 0.;
71 double BinStart = 0.;
72 double BinWidth = 0.;
73 molecule *Boundary = NULL;
74 string outputname;
75 string binoutputname;
76 bool periodic;
77 ofstream output;
78 ofstream binoutput;
79 std::vector< element *> elements;
80 string type;
81 Vector Point;
82 BinPairMap *binmap = NULL;
83 MoleculeListClass *molecules = World::getInstance().getMolecules();
84
85 // obtain information
86 MapOfActions::getInstance().queryCurrentValue("elements", elements);
87 MapOfActions::getInstance().queryCurrentValue("bin-start", BinStart);
88 MapOfActions::getInstance().queryCurrentValue("bin-width", BinWidth);
89 MapOfActions::getInstance().queryCurrentValue("bin-end", BinEnd);
90 MapOfActions::getInstance().queryCurrentValue("output-file", outputname);
91 MapOfActions::getInstance().queryCurrentValue("bin-output-file", binoutputname);
92 MapOfActions::getInstance().queryCurrentValue("periodic", periodic);
93
94 // execute action
95 output.open(outputname.c_str());
96 binoutput.open(binoutputname.c_str());
97 PairCorrelationMap *correlationmap = NULL;
98 if (periodic)
99 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
100 else
101 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
102 OutputPairCorrelation(&output, correlationmap);
103 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
104 OutputCorrelation ( &binoutput, binmap );
105 delete(binmap);
106 delete(correlationmap);
107 output.close();
108 binoutput.close();
109 return Action::success;
110}
111
112Action::state_ptr AnalysisPairCorrelationAction::performUndo(Action::state_ptr _state) {
113 return Action::success;
114}
115
116Action::state_ptr AnalysisPairCorrelationAction::performRedo(Action::state_ptr _state){
117 return Action::success;
118}
119
120bool AnalysisPairCorrelationAction::canUndo() {
121 return true;
122}
123
124bool AnalysisPairCorrelationAction::shouldUndo() {
125 return true;
126}
127
128const string AnalysisPairCorrelationAction::getName() {
129 return NAME;
130}
Note: See TracBrowser for help on using the repository browser.