Changeset afd9f3 for src/Actions
- Timestamp:
- Jul 22, 2010, 8:59:33 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:
- 805636
- Parents:
- ff4fd2a
- Location:
- src/Actions/WorldAction
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
rff4fd2a rafd9f3 22 22 #include "UIElements/UIFactory.hpp" 23 23 #include "UIElements/Dialog.hpp" 24 #include " Actions/MapOfActions.hpp"24 #include "UIElements/ValueStorage.hpp" 25 25 #include "Helpers/Assert.hpp" 26 26 … … 34 34 {} 35 35 36 Dialog* WorldAddEmptyBoundaryAction::createDialog() { 37 Dialog *dialog = UIFactory::getInstance().makeDialog(); 38 39 dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME)); 40 41 return dialog; 42 } 43 36 44 Action::state_ptr WorldAddEmptyBoundaryAction::performCall() { 37 Dialog *dialog = UIFactory::getInstance().makeDialog();38 45 Vector boundary; 39 46 Vector Min; … … 41 48 int j=0; 42 49 43 dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME));50 ValueStorage::getInstance().queryCurrentValue(NAME, boundary); 44 51 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 } 52 // get maximum and minimum 53 vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 54 ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary."); 55 vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 56 Min = (*AtomRunner)->x; 57 Max = (*AtomRunner)->x; 58 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) { 59 for (int i=0;i<NDIM;i++) { 60 if ((*AtomRunner)->x[i] > Max[i]) 61 Max[i] = (*AtomRunner)->x[i]; 62 if ((*AtomRunner)->x[i] < Min[i]) 63 Min[i] = (*AtomRunner)->x[i]; 59 64 } 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 65 } 66 // set new box size 67 double * const cell_size = new double[6]; 68 for (j=0;j<6;j++) 69 cell_size[j] = 0.; 70 j=-1; 71 for (int i=0;i<NDIM;i++) { 72 j += i+1; 73 cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]); 74 } 75 World::getInstance().setDomain(cell_size); 76 delete[] cell_size; 77 // translate all atoms, such that Min is aty (0,0,0) 78 AtomRunner = AllAtoms.begin(); 79 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) 80 (*AtomRunner)->x -= Min - boundary; 81 return Action::success; 81 82 } 82 83 -
src/Actions/WorldAction/AddEmptyBoundaryAction.hpp
rff4fd2a rafd9f3 21 21 virtual const std::string getName(); 22 22 private: 23 virtual Dialog * createDialog(); 23 24 virtual Action::state_ptr performCall(); 24 25 virtual Action::state_ptr performUndo(Action::state_ptr);
Note:
See TracChangeset
for help on using the changeset viewer.