source: src/Actions/AnalysisAction/PointCorrelationAction.cpp@ aa3d7a

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 aa3d7a was e65de8, checked in by Frederik Heber <heber@…>, 15 years ago

Fixed all correlations for new selected sets of molecules.

  • MapOfActions: added missing action names point-correlation and surface-correlation.
  • BUGFIX: AnalysisPairCorrelationAction::createDialog() - needs to query for multiple element_s_.
  • BUGFIX: MapOfActions::queryCurrentValue() - added values twice, due to ..ID or Z was not set to -1 after push_back.
  • TESTFIX: Analysis/* all needed --select-all-molecules in front.
  • TESTFIX: Analysis/4 need additional --unselect-molecule-by-id 207 to avoid correlating againts itself.
  • TESTFIX: changed all correlation unit tests, i.e. replaced TestList by allMolecules from getSelectedMolecules().
  • analysis_correlation.[ch]pp:
    • Replaced MoleculeListClass by const std::vector<molecule *>
    • ActiveFlag check is removed, we hand over getSelectedMolecules() from World (or any other vector of molecules) instead.
  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * PointCorrelationAction.cpp
3 *
4 * Created on: May 9, 2010
5 * Author: heber
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include "Actions/AnalysisAction/PointCorrelationAction.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 "UIElements/ValueStorage.hpp"
30
31const char AnalysisPointCorrelationAction::NAME[] = "point-correlation";
32
33AnalysisPointCorrelationAction::AnalysisPointCorrelationAction() :
34 Action(NAME)
35{}
36
37AnalysisPointCorrelationAction::~AnalysisPointCorrelationAction()
38{}
39
40Dialog* AnalysisPointCorrelationAction::createDialog() {
41 Dialog *dialog = UIFactory::getInstance().makeDialog();
42
43 dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
44 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
45 dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
46 dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
47 dialog->queryDouble("bin-end", ValueStorage::getInstance().getDescription("bin-end"));
48 dialog->queryString("output-file", ValueStorage::getInstance().getDescription("output-file"));
49 dialog->queryString("bin-output-file", ValueStorage::getInstance().getDescription("bin-output-file"));
50 dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
51
52 return dialog;
53}
54
55Action::state_ptr AnalysisPointCorrelationAction::performCall() {
56 int ranges[3] = {1, 1, 1};
57 double BinEnd = 0.;
58 double BinStart = 0.;
59 double BinWidth = 0.;
60 molecule *Boundary = NULL;
61 string outputname;
62 string binoutputname;
63 bool periodic;
64 ofstream output;
65 ofstream binoutput;
66 std::vector< element *> elements;
67 string type;
68 Vector Point;
69 BinPairMap *binmap = NULL;
70
71 // obtain information
72 ValueStorage::getInstance().queryCurrentValue("position", Point);
73 ValueStorage::getInstance().queryCurrentValue("elements", elements);
74 ValueStorage::getInstance().queryCurrentValue("bin-start", BinStart);
75 ValueStorage::getInstance().queryCurrentValue("bin-width", BinWidth);
76 ValueStorage::getInstance().queryCurrentValue("bin-end", BinEnd);
77 ValueStorage::getInstance().queryCurrentValue("output-file", outputname);
78 ValueStorage::getInstance().queryCurrentValue("bin-output-file", binoutputname);
79 ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
80
81 // execute action
82 output.open(outputname.c_str());
83 binoutput.open(binoutputname.c_str());
84 cout << "Point to correlate to is " << Point << endl;
85 CorrelationToPointMap *correlationmap = NULL;
86 for(std::vector< element *>::iterator iter = elements.begin(); iter != elements.end(); ++iter)
87 cout << "element is " << (*iter)->symbol << endl;
88 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
89 if (periodic)
90 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
91 else
92 correlationmap = CorrelationToPoint(molecules, elements, &Point);
93 OutputCorrelationToPoint(&output, correlationmap);
94 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
95 OutputCorrelation ( &binoutput, binmap );
96 delete(binmap);
97 delete(correlationmap);
98 output.close();
99 binoutput.close();
100 return Action::success;
101}
102
103Action::state_ptr AnalysisPointCorrelationAction::performUndo(Action::state_ptr _state) {
104 return Action::success;
105}
106
107Action::state_ptr AnalysisPointCorrelationAction::performRedo(Action::state_ptr _state){
108 return Action::success;
109}
110
111bool AnalysisPointCorrelationAction::canUndo() {
112 return true;
113}
114
115bool AnalysisPointCorrelationAction::shouldUndo() {
116 return true;
117}
118
119const string AnalysisPointCorrelationAction::getName() {
120 return NAME;
121}
Note: See TracBrowser for help on using the repository browser.