Changeset 677e13 for src/Actions/AnalysisAction
- Timestamp:
- Jul 28, 2010, 9:21:14 AM (15 years ago)
- Branches:
- 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
- Children:
- 400170, a7b777c
- Parents:
- 7067bd6 (diff), 0430e3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Actions/AnalysisAction
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/MolecularVolumeAction.cpp
r7067bd6 r677e13 9 9 10 10 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 11 12 #include "boundary.hpp" 12 13 #include "config.hpp" … … 24 25 #include "UIElements/UIFactory.hpp" 25 26 #include "UIElements/Dialog.hpp" 26 #include " Actions/MapOfActions.hpp"27 #include "UIElements/ValueStorage.hpp" 27 28 28 29 const char AnalysisMolecularVolumeAction::NAME[] = "molecular-volume"; … … 35 36 {} 36 37 38 void AnalysisMolecularVolume() { 39 ActionRegistry::getInstance().getActionByName(AnalysisMolecularVolumeAction::NAME)->call(Action::NonInteractive); 40 }; 41 42 Dialog * AnalysisMolecularVolumeAction::createDialog() { 43 Dialog *dialog = UIFactory::getInstance().makeDialog(); 44 45 dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME)); 46 47 return dialog; 48 } 49 37 50 Action::state_ptr AnalysisMolecularVolumeAction::performCall() { 38 Dialog *dialog = UIFactory::getInstance().makeDialog(); 39 molecule *mol = NULL; 51 int molID = -1; 52 // obtain information 53 ValueStorage::getInstance().queryCurrentValue(NAME, molID); 40 54 41 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));42 43 if(dialog->display()) {55 // execute action 56 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { 57 molecule *mol = iter->second; 44 58 class Tesselation *TesselStruct = NULL; 45 59 const LinkedCell *LCList = NULL; … … 57 71 delete(TesselStruct); 58 72 delete(LCList); 59 delete dialog;60 return Action::success;61 } else {62 delete dialog;63 return Action::failure;64 73 } 74 return Action::success; 65 75 } 66 76 67 77 Action::state_ptr AnalysisMolecularVolumeAction::performUndo(Action::state_ptr _state) { 68 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 69 70 return Action::failure; 71 // string newName = state->mol->getName(); 72 // state->mol->setName(state->lastName); 73 // 74 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 78 return Action::success; 75 79 } 76 80 77 81 Action::state_ptr AnalysisMolecularVolumeAction::performRedo(Action::state_ptr _state){ 78 return Action:: failure;82 return Action::success; 79 83 } 80 84 81 85 bool AnalysisMolecularVolumeAction::canUndo() { 82 return false;86 return true; 83 87 } 84 88 85 89 bool AnalysisMolecularVolumeAction::shouldUndo() { 86 return false;90 return true; 87 91 } 88 92 -
src/Actions/AnalysisAction/MolecularVolumeAction.hpp
r7067bd6 r677e13 11 11 #include "Actions/Action.hpp" 12 12 13 void AnalysisMolecularVolume(); 14 13 15 class AnalysisMolecularVolumeAction : public Action { 16 friend void AnalysisMolecularVolume(); 14 17 public: 15 18 AnalysisMolecularVolumeAction(); … … 21 24 virtual const std::string getName(); 22 25 private: 26 virtual Dialog * createDialog(); 23 27 virtual Action::state_ptr performCall(); 24 28 virtual Action::state_ptr performUndo(Action::state_ptr); -
src/Actions/AnalysisAction/PairCorrelationAction.cpp
r7067bd6 r677e13 9 9 10 10 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 11 12 #include "analysis_correlation.hpp" 12 13 #include "boundary.hpp" … … 27 28 #include "UIElements/UIFactory.hpp" 28 29 #include "UIElements/Dialog.hpp" 29 #include " Actions/MapOfActions.hpp"30 #include "UIElements/ValueStorage.hpp" 30 31 31 32 const char AnalysisPairCorrelationAction::NAME[] = "pair-correlation"; … … 38 39 {} 39 40 41 void 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 53 Dialog* AnalysisPairCorrelationAction::createDialog() { 54 Dialog *dialog = UIFactory::getInstance().makeDialog(); 55 56 dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements")); 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")); 63 64 return dialog; 65 } 66 40 67 Action::state_ptr AnalysisPairCorrelationAction::performCall() { 41 Dialog *dialog = UIFactory::getInstance().makeDialog();42 68 int ranges[3] = {1, 1, 1}; 43 69 double BinEnd = 0.; … … 54 80 Vector Point; 55 81 BinPairMap *binmap = NULL; 56 MoleculeListClass *molecules = World::getInstance().getMolecules();57 82 58 // first dialog: Obtain which type of correlation59 dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME));60 if(dialog->display()) {61 delete dialog;62 } else {63 delete dialog;64 return Action::failure;65 }83 // obtain information 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); 66 91 67 // second dialog: Obtain parameters specific to this type 68 dialog = UIFactory::getInstance().makeDialog(); 69 if (type == "P") 70 dialog->queryVector("position", &Point, false, MapOfActions::getInstance().getDescription("position")); 71 if (type == "S") 72 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); 73 dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements")); 74 dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start")); 75 dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width")); 76 dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end")); 77 dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file")); 78 dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file")); 79 dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic")); 80 81 if(dialog->display()) { 82 output.open(outputname.c_str()); 83 binoutput.open(binoutputname.c_str()); 84 if (type == "E") { 85 PairCorrelationMap *correlationmap = NULL; 86 if (periodic) 87 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges); 88 else 89 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements); 90 OutputPairCorrelation(&output, correlationmap); 91 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 92 OutputCorrelation ( &binoutput, binmap ); 93 delete(binmap); 94 delete(correlationmap); 95 } else if (type == "P") { 96 cout << "Point to correlate to is " << Point << endl; 97 CorrelationToPointMap *correlationmap = NULL; 98 if (periodic) 99 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges); 100 else 101 correlationmap = CorrelationToPoint(molecules, elements, &Point); 102 OutputCorrelationToPoint(&output, correlationmap); 103 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 104 OutputCorrelation ( &binoutput, binmap ); 105 delete(binmap); 106 delete(correlationmap); 107 } else if (type == "S") { 108 ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 109 const double radius = 4.; 110 double LCWidth = 20.; 111 if (BinEnd > 0) { 112 if (BinEnd > 2.*radius) 113 LCWidth = BinEnd; 114 else 115 LCWidth = 2.*radius; 116 } 117 118 // get the boundary 119 class Tesselation *TesselStruct = NULL; 120 const LinkedCell *LCList = NULL; 121 // find biggest molecule 122 int counter = molecules->ListOfMolecules.size(); 123 bool *Actives = new bool[counter]; 124 counter = 0; 125 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 126 Actives[counter++] = (*BigFinder)->ActiveFlag; 127 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 128 } 129 LCList = new LinkedCell(Boundary, LCWidth); 130 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 131 CorrelationToSurfaceMap *surfacemap = NULL; 132 if (periodic) 133 surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges); 134 else 135 surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList); 136 delete LCList; 137 OutputCorrelationToSurface(&output, surfacemap); 138 // re-set ActiveFlag 139 counter = 0; 140 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 141 (*BigFinder)->ActiveFlag = Actives[counter++]; 142 } 143 delete[] Actives; 144 // check whether radius was appropriate 145 { 146 double start; double end; 147 GetMinMax( surfacemap, start, end); 148 if (LCWidth < end) 149 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl); 150 } 151 binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 152 OutputCorrelation ( &binoutput, binmap ); 153 delete TesselStruct; // surfacemap contains refs to triangles! delete here, not earlier! 154 delete(binmap); 155 delete(surfacemap); 156 } else { 157 return Action::failure; 158 } 159 output.close(); 160 binoutput.close(); 161 delete dialog; 162 return Action::success; 163 } else { 164 delete dialog; 165 return Action::failure; 166 } 92 // execute action 93 output.open(outputname.c_str()); 94 binoutput.open(binoutputname.c_str()); 95 PairCorrelationMap *correlationmap = NULL; 96 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 97 if (periodic) 98 correlationmap = PeriodicPairCorrelation(molecules, elements, ranges); 99 else 100 correlationmap = PairCorrelation(molecules, elements); 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; 167 109 } 168 110 169 111 Action::state_ptr AnalysisPairCorrelationAction::performUndo(Action::state_ptr _state) { 170 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 171 172 return Action::failure; 173 // string newName = state->mol->getName(); 174 // state->mol->setName(state->lastName); 175 // 176 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 112 return Action::success; 177 113 } 178 114 179 115 Action::state_ptr AnalysisPairCorrelationAction::performRedo(Action::state_ptr _state){ 180 return Action:: failure;116 return Action::success; 181 117 } 182 118 183 119 bool AnalysisPairCorrelationAction::canUndo() { 184 return false;120 return true; 185 121 } 186 122 187 123 bool AnalysisPairCorrelationAction::shouldUndo() { 188 return false;124 return true; 189 125 } 190 126 -
src/Actions/AnalysisAction/PairCorrelationAction.hpp
r7067bd6 r677e13 11 11 #include "Actions/Action.hpp" 12 12 13 class element; 14 15 void AnalysisPairCorrelation(std::vector< element *> &elements, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic); 16 13 17 class AnalysisPairCorrelationAction : public Action { 18 friend void AnalysisPairCorrelation(std::vector< element *> &elements, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic); 14 19 public: 15 20 AnalysisPairCorrelationAction(); … … 20 25 21 26 virtual const std::string getName(); 27 22 28 private: 29 virtual Dialog * createDialog(); 23 30 virtual Action::state_ptr performCall(); 24 31 virtual Action::state_ptr performUndo(Action::state_ptr); -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
r7067bd6 r677e13 9 9 10 10 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 11 12 #include "molecule.hpp" 12 13 #include "log.hpp" … … 20 21 #include "UIElements/UIFactory.hpp" 21 22 #include "UIElements/Dialog.hpp" 22 #include " Actions/MapOfActions.hpp"23 #include "UIElements/ValueStorage.hpp" 23 24 24 25 const char AnalysisPrincipalAxisSystemAction::NAME[] = "principal-axis-system"; … … 31 32 {} 32 33 34 void AnalysisPrincipalAxisSystem() { 35 ActionRegistry::getInstance().getActionByName(AnalysisPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive); 36 }; 37 38 Dialog* AnalysisPrincipalAxisSystemAction::createDialog() { 39 Dialog *dialog = UIFactory::getInstance().makeDialog(); 40 41 dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME)); 42 43 return dialog; 44 } 45 33 46 Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() { 34 Dialog *dialog = UIFactory::getInstance().makeDialog();35 47 molecule *mol = NULL; 36 48 37 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));38 39 if(dialog->display()) {40 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);49 ValueStorage::getInstance().queryCurrentValue(NAME, mol); 50 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 51 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { 52 molecule *mol = iter->second; 41 53 mol->PrincipalAxisSystem(false); 42 delete dialog;43 return Action::success;44 } else {45 delete dialog;46 return Action::failure;47 54 } 55 return Action::success; 48 56 } 49 57 50 58 Action::state_ptr AnalysisPrincipalAxisSystemAction::performUndo(Action::state_ptr _state) { 51 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 52 53 return Action::failure; 54 // string newName = state->mol->getName(); 55 // state->mol->setName(state->lastName); 56 // 57 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 59 return Action::success; 58 60 } 59 61 60 62 Action::state_ptr AnalysisPrincipalAxisSystemAction::performRedo(Action::state_ptr _state){ 61 return Action:: failure;63 return Action::success; 62 64 } 63 65 64 66 bool AnalysisPrincipalAxisSystemAction::canUndo() { 65 return false;67 return true; 66 68 } 67 69 68 70 bool AnalysisPrincipalAxisSystemAction::shouldUndo() { 69 return false;71 return true; 70 72 } 71 73 -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.hpp
r7067bd6 r677e13 11 11 #include "Actions/Action.hpp" 12 12 13 void AnalysisPrincipalAxisSystem(); 14 13 15 class AnalysisPrincipalAxisSystemAction : public Action { 16 friend void AnalysisPrincipalAxisSystem(); 17 14 18 public: 15 19 AnalysisPrincipalAxisSystemAction(); … … 21 25 virtual const std::string getName(); 22 26 private: 27 virtual Dialog * createDialog(); 23 28 virtual Action::state_ptr performCall(); 24 29 virtual Action::state_ptr performUndo(Action::state_ptr);
Note:
See TracChangeset
for help on using the changeset viewer.