- Timestamp:
- Jun 9, 2010, 2:04:54 PM (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:
- 94d131
- Parents:
- c78d44
- git-author:
- Frederik Heber <heber@…> (06/09/10 11:21:58)
- git-committer:
- Frederik Heber <heber@…> (06/09/10 14:04:54)
- Location:
- src
- Files:
-
- 4 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/PairCorrelationAction.cpp
rc78d44 r104524 9 9 #include "CommandLineParser.hpp" 10 10 #include "analysis_correlation.hpp" 11 #include "boundary.hpp" 12 #include "linkedcell.hpp" 11 13 #include "log.hpp" 12 14 #include "element.hpp" 15 #include "molecule.hpp" 13 16 #include "periodentafel.hpp" 17 #include "vector.hpp" 14 18 #include "World.hpp" 15 19 … … 35 39 Dialog *dialog = UIFactory::getInstance().makeDialog(); 36 40 int ranges[3] = {1, 1, 1}; 41 double BinEnd = 0.; 37 42 double BinStart = 0.; 38 double BinEnd = 0.; 43 double BinWidth = 0.; 44 molecule *Boundary = NULL; 39 45 string outputname; 40 46 string binoutputname; … … 42 48 ofstream output; 43 49 ofstream binoutput; 44 const element *elemental1; 45 const element *elemental2; 50 std::vector< element *> elements; 51 string type; 52 Vector Point; 53 BinPairMap *binmap = NULL; 54 MoleculeListClass *molecules = World::getInstance().getMolecules(); 46 55 47 dialog->queryElement("elements", &elemental1, MapOfActions::getInstance().getDescription("elements")); 48 dialog->queryElement("elements", &elemental2, MapOfActions::getInstance().getDescription("elements")); 56 // first dialog: Obtain which type of correlation 57 dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME)); 58 if(dialog->display()) { 59 delete dialog; 60 } else { 61 delete dialog; 62 return Action::failure; 63 } 64 65 // second dialog: Obtain parameters specific to this type 66 dialog = UIFactory::getInstance().makeDialog(); 67 if (type == "P") 68 dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position")); 69 if (type == "S") 70 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); 71 dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements")); 49 72 dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start")); 73 dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width")); 50 74 dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end")); 51 75 dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file")); … … 57 81 binoutput.open(binoutputname.c_str()); 58 82 PairCorrelationMap *correlationmap = NULL; 59 if (periodic) 60 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2, ranges); 61 else 62 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2); 63 //OutputCorrelationToSurface(&output, correlationmap); 64 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 83 if (type == "E") { 84 PairCorrelationMap *correlationmap = NULL; 85 if (periodic) 86 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges); 87 else 88 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements); 89 //OutputCorrelationToSurface(&output, correlationmap); 90 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 91 } else if (type == "P") { 92 cout << "Point to correlate to is " << Point << endl; 93 CorrelationToPointMap *correlationmap = NULL; 94 if (periodic) 95 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges); 96 else 97 correlationmap = CorrelationToPoint(molecules, elements, &Point); 98 //OutputCorrelationToSurface(&output, correlationmap); 99 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 100 } else if (type == "S") { 101 ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 102 const double radius = 4.; 103 double LCWidth = 20.; 104 if (BinEnd > 0) { 105 if (BinEnd > 2.*radius) 106 LCWidth = BinEnd; 107 else 108 LCWidth = 2.*radius; 109 } 110 111 // get the boundary 112 class Tesselation *TesselStruct = NULL; 113 const LinkedCell *LCList = NULL; 114 // find biggest molecule 115 int counter = molecules->ListOfMolecules.size(); 116 bool *Actives = new bool[counter]; 117 counter = 0; 118 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 119 Actives[counter++] = (*BigFinder)->ActiveFlag; 120 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 121 } 122 LCList = new LinkedCell(Boundary, LCWidth); 123 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 124 CorrelationToSurfaceMap *surfacemap = NULL; 125 if (periodic) 126 surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges); 127 else 128 surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList); 129 OutputCorrelationToSurface(&output, surfacemap); 130 // check whether radius was appropriate 131 { 132 double start; double end; 133 GetMinMax( surfacemap, start, end); 134 if (LCWidth < end) 135 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); 136 } 137 binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 138 } else 139 return Action::failure; 65 140 OutputCorrelation ( &binoutput, binmap ); 66 141 output.close(); -
src/Actions/AtomAction/ChangeElementAction.cpp
rc78d44 r104524 34 34 Action::state_ptr AtomChangeElementAction::performCall() { 35 35 Dialog *dialog = UIFactory::getInstance().makeDialog(); 36 int Z = -1;37 36 atom *first = NULL; 38 element *elemental = NULL;37 std::vector<element *> elements; 39 38 40 dialog->queryElement(NAME, (const element **) &elemental, MapOfActions::getInstance().getDescription(NAME));39 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 41 40 dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id")); 42 41 43 42 if(dialog->display()) { 44 43 delete dialog; 45 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental << "." << endl); 46 if (elemental != NULL) { 47 first->type = elemental; 44 ASSERT(elements.size() == 1, "Unequal to one element specified when changing an atom's element"); 45 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elements.at(0) << "." << endl); 46 if (elements.at(0) != NULL) { 47 first->type = elements.at(0); 48 48 return Action::success; 49 49 } else -
src/Actions/Makefile.am
rc78d44 r104524 36 36 AnalysisAction/MolecularVolumeAction.cpp \ 37 37 AnalysisAction/PairCorrelationAction.cpp \ 38 AnalysisAction/PairCorrelationToPointAction.cpp \39 AnalysisAction/PairCorrelationToSurfaceAction.cpp \40 38 AnalysisAction/PrincipalAxisSystemAction.cpp 41 39 ANALYSISACTIONHEADER = \ 42 40 AnalysisAction/MolecularVolumeAction.hpp \ 43 41 AnalysisAction/PairCorrelationAction.hpp \ 44 AnalysisAction/PairCorrelationToPointAction.hpp \45 AnalysisAction/PairCorrelationToSurfaceAction.hpp \46 42 AnalysisAction/PrincipalAxisSystemAction.hpp 47 43 -
src/Legacy/oldmenu.cpp
rc78d44 r104524 84 84 Dialog *dialog = UIFactory::getInstance().makeDialog(); 85 85 first = World::getInstance().createAtom(); 86 std::vector<element *> elements; 86 87 dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false); 87 dialog->queryElement("Please choose element: ",& first->type);88 dialog->queryElement("Please choose element: ",&elements); 88 89 if(dialog->display()){ 89 mol->AddAtom(first); // add to molecule 90 if (elements.size() == 1) { 91 first->type = elements.at(0); 92 mol->AddAtom(first); // add to molecule 93 } else { 94 DoeLog(1) && (eLog() << Verbose(1) << "Unequal to one element given for element of new atom." << endl); 95 } 90 96 } 91 97 else{ -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
rc78d44 r104524 7 7 8 8 9 #include <cassert>10 9 #include <iostream> 10 #include <vector> 11 11 12 12 #include <Descriptors/AtomDescriptor.hpp> … … 80 80 } 81 81 82 void CommandLineDialog::queryElement(const char* title, const element **target, string _description){82 void CommandLineDialog::queryElement(const char* title, std::vector<element *> *target, string _description){ 83 83 registerQuery(new ElementCommandLineQuery(title,target, _description)); 84 84 } … … 231 231 } 232 232 233 CommandLineDialog::ElementCommandLineQuery::ElementCommandLineQuery(string title, const element **target, string _description) :233 CommandLineDialog::ElementCommandLineQuery::ElementCommandLineQuery(string title, std::vector<element *> *target, string _description) : 234 234 Dialog::ElementQuery(title,target, _description) 235 235 {} … … 240 240 bool CommandLineDialog::ElementCommandLineQuery::handle() { 241 241 // TODO: vector of ints and removing first is not correctly implemented yet. How to remove from a vector? 242 int Z; 242 periodentafel *periode = World::getInstance().getPeriode(); 243 element *elemental = NULL; 243 244 if (CommandLineParser::getInstance().vm.count(getTitle())) { 244 245 vector<int> AllElements = CommandLineParser::getInstance().vm[getTitle()].as< vector<int> >(); 245 vector<int>::iterator ElementRunner = AllElements.begin();246 Z = *ElementRunner;247 // TODO: So far, this does not really erase the element in the parsed list.248 AllElements.erase(ElementRunner);249 tmp = World::getInstance().getPeriode()->FindElement(Z);250 return true; 251 } else 252 return false; 253 } 246 for (vector<int>::iterator ZRunner = AllElements.begin(); ZRunner != AllElements.end(); ++ZRunner) { 247 elemental = periode->FindElement(*ZRunner); 248 ASSERT(elemental != NULL, "Invalid element specified in ElementCommandLineQuery"); 249 elements.push_back(elemental); 250 } 251 return true; 252 } else 253 return false; 254 } -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
rc78d44 r104524 36 36 virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = ""); 37 37 virtual void queryBox(const char*,double ** const, std::string = ""); 38 virtual void queryElement(const char*, const element **, std::string = "");38 virtual void queryElement(const char*, std::vector<element *> *, std::string = ""); 39 39 40 40 protected: … … 105 105 class ElementCommandLineQuery : public Dialog::ElementQuery { 106 106 public: 107 ElementCommandLineQuery(std::string title, const element **_target, std::string _description = "");107 ElementCommandLineQuery(std::string title, std::vector<element *> *_target, std::string _description = ""); 108 108 virtual ~ElementCommandLineQuery(); 109 109 virtual bool handle(); -
src/UIElements/CommandLineUI/CommandLineWindow.cpp
rc78d44 r104524 12 12 13 13 #include "Actions/ActionRegistry.hpp" 14 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" 14 15 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 15 #include "Actions/AnalysisAction/PairCorrelationToPointAction.hpp" 16 #include "Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp" 16 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" 17 17 #include "Actions/AtomAction/AddAction.hpp" 18 18 #include "Actions/AtomAction/ChangeElementAction.hpp" … … 95 95 void CommandLineWindow::populateAnalysisActions() 96 96 { 97 new AnalysisMolecularVolumeAction(); 97 98 new AnalysisPairCorrelationAction(); 98 new AnalysisPairCorrelationToPointAction(); 99 new AnalysisPairCorrelationToSurfaceAction(); 99 new AnalysisPrincipalAxisSystemAction(); 100 100 } 101 101 -
src/UIElements/Dialog.cpp
rc78d44 r104524 199 199 200 200 // Element Queries 201 Dialog::ElementQuery::ElementQuery(std::string title, const element **_target, std::string _description) :201 Dialog::ElementQuery::ElementQuery(std::string title, std::vector<element *> *_target, std::string _description) : 202 202 Query(title, _description), 203 tmp(0),204 203 target(_target) 205 204 {} … … 208 207 209 208 void Dialog::ElementQuery::setResult(){ 210 *target= tmp;211 } 209 *target=elements; 210 } -
src/UIElements/Dialog.hpp
rc78d44 r104524 11 11 #include<string> 12 12 #include<list> 13 #include<vector> 13 14 14 15 class atom; … … 32 33 virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0; 33 34 virtual void queryBox(const char*,double ** const, std::string = "")=0; 34 virtual void queryElement(const char*, const element **, std::string = "")=0;35 virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0; 35 36 36 37 virtual bool display(); … … 172 173 class ElementQuery : public Query { 173 174 public: 174 ElementQuery(std::string title, const element**_target, std::string _description = "");175 ElementQuery(std::string title, std::vector<element *> *_target, std::string _description = ""); 175 176 virtual ~ElementQuery(); 176 177 virtual bool handle()=0; 177 178 virtual void setResult(); 178 179 protected: 179 const element *tmp;180 std::vector<element *> elements; 180 181 private: 181 const element **target;182 std::vector<element *> * const target; 182 183 }; 183 184 -
src/UIElements/TextUI/TextDialog.cpp
rc78d44 r104524 72 72 } 73 73 74 void TextDialog::queryElement(const char* title, const element **target, string description){74 void TextDialog::queryElement(const char* title, std::vector<element *> *target, string description){ 75 75 registerQuery(new ElementTextQuery(title,target,description)); 76 76 } … … 281 281 } 282 282 283 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target, std::string _description) :284 Dialog::ElementQuery(title, target,_description)283 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, std::vector<element *> *_target, std::string _description) : 284 Dialog::ElementQuery(title,_target,_description) 285 285 {} 286 286 … … 291 291 bool badInput=false; 292 292 bool aborted = false; 293 element * tmp = NULL; 293 294 do{ 294 295 badInput = false; … … 307 308 Log() << Verbose(0) << "No element with this atomic number!" << endl; 308 309 badInput = true; 310 } else { 311 elements.push_back(tmp); 309 312 } 310 313 } … … 329 332 Log() << Verbose(0) << "No element with this shorthand!" << endl; 330 333 badInput = true; 334 } else { 335 elements.push_back(tmp); 331 336 } 332 337 } -
src/UIElements/TextUI/TextDialog.hpp
rc78d44 r104524 33 33 virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = ""); 34 34 virtual void queryBox(const char*,double ** const, std::string = ""); 35 virtual void queryElement(const char*, const element **, std::string = "");35 virtual void queryElement(const char*, std::vector<element *> *, std::string = ""); 36 36 37 37 protected: … … 102 102 class ElementTextQuery : public Dialog::ElementQuery { 103 103 public: 104 ElementTextQuery(std::string title, const element **_target, std::string _description = NULL);104 ElementTextQuery(std::string title, std::vector<element *> *_target, std::string _description = NULL); 105 105 virtual ~ElementTextQuery(); 106 106 virtual bool handle();
Note:
See TracChangeset
for help on using the changeset viewer.