Changeset 400170 for src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
- Timestamp:
- Jul 28, 2010, 9:35:44 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, Candidate_v1.7.0, Candidate_v1.7.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:
- f12805
- Parents:
- c6f395 (diff), 677e13 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
rc6f395 r400170 9 9 10 10 #include "Actions/WorldAction/AddEmptyBoundaryAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" … … 22 23 #include "UIElements/UIFactory.hpp" 23 24 #include "UIElements/Dialog.hpp" 24 #include " Actions/MapOfActions.hpp"25 #include "UIElements/ValueStorage.hpp" 25 26 #include "Helpers/Assert.hpp" 26 27 … … 34 35 {} 35 36 37 void WorldAddEmptyBoundary(Vector &boundary) { 38 ValueStorage::getInstance().setCurrentValue(WorldAddEmptyBoundaryAction::NAME, boundary); 39 ActionRegistry::getInstance().getActionByName(WorldAddEmptyBoundaryAction::NAME)->call(Action::NonInteractive); 40 }; 41 42 Dialog* WorldAddEmptyBoundaryAction::createDialog() { 43 Dialog *dialog = UIFactory::getInstance().makeDialog(); 44 45 dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME)); 46 47 return dialog; 48 } 49 36 50 Action::state_ptr WorldAddEmptyBoundaryAction::performCall() { 37 Dialog *dialog = UIFactory::getInstance().makeDialog();38 51 Vector boundary; 39 52 Vector Min; … … 41 54 int j=0; 42 55 43 dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME));56 ValueStorage::getInstance().queryCurrentValue(NAME, boundary); 44 57 45 if(dialog->display()) { 46 // get maximum and minimum 47 vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 48 ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary."); 49 vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 50 Min = (*AtomRunner)->x; 51 Max = (*AtomRunner)->x; 52 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) { 53 for (int i=0;i<NDIM;i++) { 54 if ((*AtomRunner)->x[i] > Max[i]) 55 Max[i] = (*AtomRunner)->x[i]; 56 if ((*AtomRunner)->x[i] < Min[i]) 57 Min[i] = (*AtomRunner)->x[i]; 58 } 58 // get maximum and minimum 59 vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 60 ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary."); 61 vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 62 Min = (*AtomRunner)->x; 63 Max = (*AtomRunner)->x; 64 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) { 65 for (int i=0;i<NDIM;i++) { 66 if ((*AtomRunner)->x[i] > Max[i]) 67 Max[i] = (*AtomRunner)->x[i]; 68 if ((*AtomRunner)->x[i] < Min[i]) 69 Min[i] = (*AtomRunner)->x[i]; 59 70 } 60 // set new box size61 double * const cell_size = new double[6];62 for (j=0;j<6;j++)63 cell_size[j] = 0.;64 j=-1;65 for (int i=0;i<NDIM;i++) {66 j += i+1;67 cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);68 }69 World::getInstance().setDomain(cell_size);70 delete[] cell_size;71 // translate all atoms, such that Min is aty (0,0,0)72 AtomRunner = AllAtoms.begin();73 for (; AtomRunner != AllAtoms.end(); ++AtomRunner)74 (*AtomRunner)->x -= Min - boundary;75 delete dialog;76 return Action::success;77 } else {78 delete dialog;79 return Action::failure;80 71 } 72 // set new box size 73 double * const cell_size = new double[6]; 74 for (j=0;j<6;j++) 75 cell_size[j] = 0.; 76 j=-1; 77 for (int i=0;i<NDIM;i++) { 78 j += i+1; 79 cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]); 80 } 81 World::getInstance().setDomain(cell_size); 82 delete[] cell_size; 83 // translate all atoms, such that Min is aty (0,0,0) 84 AtomRunner = AllAtoms.begin(); 85 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) 86 (*AtomRunner)->x -= Min - boundary; 87 return Action::success; 81 88 } 82 89
Note:
See TracChangeset
for help on using the changeset viewer.
