Changeset 1fd675 for src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
- Timestamp:
- Aug 28, 2010, 12:57:56 AM (14 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:
- 966e12
- Parents:
- 53d01c
- git-author:
- Frederik Heber <heber@…> (08/26/10 21:05:34)
- git-committer:
- Frederik Heber <heber@…> (08/28/10 00:57:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
r53d01c r1fd675 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"23 #include "Actions/ActionRegistry.hpp"24 22 #include "atom.hpp" 25 23 #include "bondgraph.hpp" … … 36 34 using namespace std; 37 35 38 #include "UIElements/UIFactory.hpp" 39 #include "UIElements/Dialog.hpp" 40 #include "Actions/ValueStorage.hpp" 36 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp" 41 37 42 /****** MoleculeFillWithMoleculeAction *****/ 38 // and construct the stuff 39 #include "FillWithMoleculeAction.def" 40 #include "Action_impl_pre.hpp" 41 /** =========== define the function ====================== */ 42 Action::state_ptr MoleculeFillWithMoleculeAction::performCall() { 43 43 44 // memento to remember the state when undoing 44 // obtain information 45 getParametersfromValueStorage(); 45 46 46 //class MoleculeFillWithMoleculeState : public ActionState { 47 //public: 48 // MoleculeFillWithMoleculeState(molecule* _mol,std::string _lastName) : 49 // mol(_mol), 50 // lastName(_lastName) 51 // {} 52 // molecule* mol; 53 // std::string lastName; 54 //}; 55 56 const char MoleculeFillWithMoleculeAction::NAME[] = "fill-molecule"; 57 58 MoleculeFillWithMoleculeAction::MoleculeFillWithMoleculeAction() : 59 Action(NAME) 60 {} 61 62 MoleculeFillWithMoleculeAction::~MoleculeFillWithMoleculeAction() 63 {} 64 65 void MoleculeFillWithMolecule(std::string &fillername, Vector &distances, Vector &lengths, double MaxDistance, bool DoRotate) { 66 ValueStorage::getInstance().setCurrentValue(MoleculeFillWithMoleculeAction::NAME, fillername); 67 ValueStorage::getInstance().setCurrentValue("distances", distances); 68 ValueStorage::getInstance().setCurrentValue("lengths", lengths); 69 ValueStorage::getInstance().setCurrentValue("DoRotate", MaxDistance); 70 ValueStorage::getInstance().setCurrentValue("MaxDistance", DoRotate); 71 ActionRegistry::getInstance().getActionByName(MoleculeFillWithMoleculeAction::NAME)->call(Action::NonInteractive); 72 }; 73 74 void MoleculeFillWithMoleculeAction::getParametersfromValueStorage() 75 {}; 76 77 Dialog* MoleculeFillWithMoleculeAction::fillDialog(Dialog *dialog) { 78 ASSERT(dialog,"No Dialog given when filling action dialog"); 79 80 dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME)); 81 dialog->queryVector("distances", false, ValueStorage::getInstance().getDescription("distances")); 82 dialog->queryVector("lengths", false, ValueStorage::getInstance().getDescription("lengths")); 83 dialog->queryBoolean("DoRotate", ValueStorage::getInstance().getDescription("DoRotate")); 84 dialog->queryDouble("MaxDistance", ValueStorage::getInstance().getDescription("MaxDistance")); 85 86 return dialog; 87 } 88 89 Action::state_ptr MoleculeFillWithMoleculeAction::performCall() { 90 string filename; 91 Vector distances; 92 Vector lengths; 93 double MaxDistance = -1.; 94 bool DoRotate = false; 95 96 ValueStorage::getInstance().queryCurrentValue(NAME, filename); 97 ValueStorage::getInstance().queryCurrentValue("distances", distances); 98 ValueStorage::getInstance().queryCurrentValue("lengths", lengths); 99 ValueStorage::getInstance().queryCurrentValue("DoRotate", DoRotate); 100 ValueStorage::getInstance().queryCurrentValue("MaxDistance", MaxDistance); 101 102 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << lengths[0] << "," << lengths[1] << "," << lengths[2] << "), distances (" << distances[0] << "," << distances[1] << "," << distances[2] << "), MaxDistance " << MaxDistance << ", DoRotate " << DoRotate << "." << endl); 47 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << params.lengths[0] << "," << params.lengths[1] << "," << params.lengths[2] << "), distances (" << params.distances[0] << "," << params.distances[1] << "," << params.distances[2] << "), MaxDistance " << params.MaxDistance << ", DoRotate " << params.DoRotate << "." << endl); 103 48 // construct water molecule 104 49 molecule *filler = World::getInstance().createMolecule(); 105 if (!filler->AddXYZFile( filename)) {106 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl);50 if (!filler->AddXYZFile(params.fillername)) { 51 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << params.fillername << "." << endl); 107 52 } 108 filler->SetNameFromFilename( filename.c_str());53 filler->SetNameFromFilename(params.fillername.c_str()); 109 54 molecule *Filling = NULL; 110 55 // atom *first = NULL, *second = NULL, *third = NULL; … … 128 73 double distance[NDIM]; 129 74 for (int i=0;i<NDIM;i++) 130 distance[i] = distances[i];131 Filling = FillBoxWithMolecule(World::getInstance().getMolecules(), filler, *(World::getInstance().getConfig()), MaxDistance, distance, lengths[0], lengths[1], lengths[2],DoRotate);75 distance[i] = params.distances[i]; 76 Filling = FillBoxWithMolecule(World::getInstance().getMolecules(), filler, *(World::getInstance().getConfig()), params.MaxDistance, distance, params.lengths[0], params.lengths[1], params.lengths[2], params.DoRotate); 132 77 if (Filling != NULL) { 133 78 Filling->ActiveFlag = false; … … 169 114 return NAME; 170 115 } 116 /** =========== end of function ====================== */
Note:
See TracChangeset
for help on using the changeset viewer.