source: src/Actions/AnalysisAction/PointCorrelationAction.cpp@ 8f4df1

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

Merge branch 'AtomicPositionEncapsulation' into stable

Conflicts:

src/Actions/AtomAction/ChangeElementAction.cpp
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
src/Makefile.am
src/UIElements/TextUI/TextDialog.cpp
src/analysis_correlation.hpp
src/atom.cpp
src/atom_atominfo.hpp
src/bond.cpp
src/boundary.cpp
src/molecule_geometry.cpp
src/tesselation.cpp
src/tesselationhelpers.cpp
src/triangleintersectionlist.cpp
src/unittests/Makefile.am

  • fixed #includes due to moves to Helpers and LinearAlgebra
  • moved VectorInterface.* and vector_ops.* to LinearAlgebra
  • no more direct access of atom::node, remapped to set/getPosition()
  • no more direct access to atom::type, remapped to set/getType() (also in atom due to derivation and atominfo::AtomicElement is private not protected).
  • Property mode set to 100644
File size: 4.9 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 "Actions/ActionRegistry.hpp"
12#include "analysis_correlation.hpp"
13#include "boundary.hpp"
14#include "linkedcell.hpp"
15#include "Helpers/Verbose.hpp"
16#include "Helpers/Log.hpp"
17#include "element.hpp"
18#include "molecule.hpp"
19#include "periodentafel.hpp"
20#include "LinearAlgebra/Vector.hpp"
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"
30#include "Actions/ValueStorage.hpp"
31
32const char AnalysisPointCorrelationAction::NAME[] = "point-correlation";
33
34AnalysisPointCorrelationAction::AnalysisPointCorrelationAction() :
35 Action(NAME)
36{}
37
38AnalysisPointCorrelationAction::~AnalysisPointCorrelationAction()
39{}
40
41void AnalysisPointCorrelation(std::vector< element *> &elements, Vector &position, double BinStart, double BinWidth, double BinEnd, string &outputname, string &binoutputname, bool periodic) {
42 ValueStorage::getInstance().setCurrentValue("elements", elements);
43 ValueStorage::getInstance().setCurrentValue("position", position);
44 ValueStorage::getInstance().setCurrentValue("bin-start", BinStart);
45 ValueStorage::getInstance().setCurrentValue("bin-width", BinWidth);
46 ValueStorage::getInstance().setCurrentValue("bin-end", BinEnd);
47 ValueStorage::getInstance().setCurrentValue("output-file", outputname);
48 ValueStorage::getInstance().setCurrentValue("bin-output-file", binoutputname);
49 ValueStorage::getInstance().setCurrentValue("periodic", periodic);
50 ActionRegistry::getInstance().getActionByName(AnalysisPointCorrelationAction::NAME)->call(Action::NonInteractive);
51};
52
53Dialog* AnalysisPointCorrelationAction::fillDialog(Dialog *dialog) {
54 ASSERT(dialog,"No Dialog given when filling action dialog");
55
56 dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
57 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
58 dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
59 dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
60 dialog->queryDouble("bin-end", ValueStorage::getInstance().getDescription("bin-end"));
61 dialog->queryString("output-file", ValueStorage::getInstance().getDescription("output-file"));
62 dialog->queryString("bin-output-file", ValueStorage::getInstance().getDescription("bin-output-file"));
63 dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
64
65 return dialog;
66}
67
68Action::state_ptr AnalysisPointCorrelationAction::performCall() {
69 int ranges[3] = {1, 1, 1};
70 double BinEnd = 0.;
71 double BinStart = 0.;
72 double BinWidth = 0.;
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;
82
83 // obtain information
84 ValueStorage::getInstance().queryCurrentValue("position", Point);
85 ValueStorage::getInstance().queryCurrentValue("elements", elements);
86 ValueStorage::getInstance().queryCurrentValue("bin-start", BinStart);
87 ValueStorage::getInstance().queryCurrentValue("bin-width", BinWidth);
88 ValueStorage::getInstance().queryCurrentValue("bin-end", BinEnd);
89 ValueStorage::getInstance().queryCurrentValue("output-file", outputname);
90 ValueStorage::getInstance().queryCurrentValue("bin-output-file", binoutputname);
91 ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
92
93 // execute action
94 output.open(outputname.c_str());
95 binoutput.open(binoutputname.c_str());
96 cout << "Point to correlate to is " << Point << endl;
97 CorrelationToPointMap *correlationmap = NULL;
98 for(std::vector< element *>::iterator iter = elements.begin(); iter != elements.end(); ++iter)
99 cout << "element is " << (*iter)->symbol << endl;
100 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
101 if (periodic)
102 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
103 else
104 correlationmap = CorrelationToPoint(molecules, elements, &Point);
105 OutputCorrelationToPoint(&output, correlationmap);
106 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
107 OutputCorrelation ( &binoutput, binmap );
108 delete(binmap);
109 delete(correlationmap);
110 output.close();
111 binoutput.close();
112 return Action::success;
113}
114
115Action::state_ptr AnalysisPointCorrelationAction::performUndo(Action::state_ptr _state) {
116 return Action::success;
117}
118
119Action::state_ptr AnalysisPointCorrelationAction::performRedo(Action::state_ptr _state){
120 return Action::success;
121}
122
123bool AnalysisPointCorrelationAction::canUndo() {
124 return true;
125}
126
127bool AnalysisPointCorrelationAction::shouldUndo() {
128 return true;
129}
130
131const string AnalysisPointCorrelationAction::getName() {
132 return NAME;
133}
Note: See TracBrowser for help on using the repository browser.