source: src/Actions/AnalysisAction/PairCorrelationAction.cpp@ 952f38

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 952f38 was 952f38, checked in by Frederik Heber <heber@…>, 14 years ago

created LibMolecuilderHelpers.

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