- Timestamp:
- Jan 11, 2015, 4:42:43 PM (10 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:
- 596cfa
- Parents:
- b6d92e
- git-author:
- Frederik Heber <heber@…> (12/12/14 08:28:30)
- git-committer:
- Frederik Heber <heber@…> (01/11/15 16:42:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/SelectionAction/Molecules/NotMoleculeByIdAction.cpp
rb6d92e rd7cad1 53 53 /** =========== define the function ====================== */ 54 54 ActionState::ptr SelectionNotMoleculeByIdAction::performCall() { 55 const molecule *mol = World::getInstance().getMolecule(MoleculeById(params.molindex.get())); 56 if (mol != NULL) { 57 if (World::getInstance().isSelected(mol)) { 58 LOG(1, "Unselecting molecule " << mol->name); 59 World::getInstance().unselectAllMolecules(MoleculeById(params.molindex.get())); 60 LOG(0, World::getInstance().countSelectedMolecules() << " molecules remain selected."); 61 return ActionState::ptr(new SelectionNotMoleculeByIdState(params)); 55 enum Sucess { 56 NoStatus, 57 AllMoleculesSelected, 58 MoleculesUnselected, 59 MoleculeMissing 60 } status = NoStatus; 61 62 const molids_t molids = params.molids.get(); 63 molids_t undomolids; 64 undomolids.reserve(molids.size()); 65 for (molids_t::const_iterator iter = molids.begin(); iter != molids.end(); ++iter) { 66 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 67 if (Walker != NULL) { 68 if (World::getInstance().isSelected(Walker)) { 69 LOG(1, "Unselecting mol " << Walker->getName()); 70 World::getInstance().unselectMolecule(Walker); 71 undomolids.push_back(*iter); 72 if (status < MoleculeMissing) 73 status = MoleculesUnselected; 74 } else { 75 if (status == NoStatus) 76 status = AllMoleculesSelected; 77 } 62 78 } else { 63 return Action::success;79 status = MoleculeMissing; 64 80 } 65 } else {66 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");67 return Action::failure;68 81 } 82 LOG(0, World::getInstance().countSelectedMolecules() << " mols remain selected."); 83 84 switch (status) { 85 case MoleculeMissing: 86 STATUS("Cannot find all mols by given ids."); 87 return Action::failure; 88 break; 89 case AllMoleculesSelected: 90 case MoleculesUnselected: 91 return ActionState::ptr(new SelectionNotMoleculeByIdState(undomolids, params)); 92 break; 93 default: 94 STATUS("No mols have been selected."); 95 return Action::failure; 96 break; 97 } 98 return Action::failure; 69 99 } 70 100 … … 72 102 SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get()); 73 103 74 World::getInstance().selectAllMolecules(MoleculeById(state->params.molindex.get())); 104 for (molids_t::const_iterator iter = state->undomolids.begin(); 105 iter != state->undomolids.end(); ++iter) { 106 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 107 World::getInstance().selectMolecule(Walker); 108 } 75 109 76 110 return ActionState::ptr(_state); … … 80 114 SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get()); 81 115 82 World::getInstance().unselectAllMolecules(MoleculeById(state->params.molindex.get())); 116 for (molids_t::const_iterator iter = state->undomolids.begin(); 117 iter != state->undomolids.end(); ++iter) { 118 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 119 World::getInstance().unselectMolecule(Walker); 120 } 83 121 84 122 return ActionState::ptr(_state);
Note:
See TracChangeset
for help on using the changeset viewer.