- Timestamp:
- Jan 29, 2015, 7:37:57 AM (11 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:
- 27e464
- Parents:
- 7b38d3 (diff), 4f2895 (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/SelectionAction/Molecules/MoleculeByIdAction.cpp
r7b38d3 r0ac85c3 53 53 /** =========== define the function ====================== */ 54 54 ActionState::ptr SelectionMoleculeByIdAction::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, "Selecting molecule " << mol->name); 59 World::getInstance().selectAllMolecules(MoleculeById(params.molindex.get())); 60 LOG(0, World::getInstance().countSelectedMolecules() << " molecules selected."); 61 return ActionState::ptr(new SelectionMoleculeByIdState(params)); 55 56 enum Sucess { 57 NoStatus, 58 AllMoleculesUnselected, 59 MoleculesSelected, 60 MoleculeMissing 61 } status = NoStatus; 62 63 const molids_t molids = params.molids.get(); 64 molids_t undomolids; 65 undomolids.reserve(molids.size()); 66 for (molids_t::const_iterator iter = molids.begin(); iter != molids.end(); ++iter) { 67 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 68 if (Walker != NULL) { 69 if (!World::getInstance().isSelected(Walker)) { 70 LOG(1, "Selecting mol " << Walker->getName()); 71 World::getInstance().selectMolecule(Walker); 72 undomolids.push_back(*iter); 73 if (status < MoleculeMissing) 74 status = MoleculesSelected; 75 } else { 76 if (status == NoStatus) 77 status = AllMoleculesUnselected; 78 } 62 79 } else { 63 return Action::success;80 status = MoleculeMissing; 64 81 } 65 } else {66 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");67 return Action::failure;68 82 } 83 LOG(0, World::getInstance().countSelectedMolecules() << " mols selected."); 84 85 switch (status) { 86 case MoleculeMissing: 87 STATUS("Cannot find all mols with given ids."); 88 return Action::failure; 89 break; 90 case AllMoleculesUnselected: 91 case MoleculesSelected: 92 return ActionState::ptr(new SelectionMoleculeByIdState(undomolids, params)); 93 break; 94 default: 95 STATUS("No mols have been selected."); 96 return Action::failure; 97 break; 98 } 99 return Action::failure; 69 100 } 70 101 … … 72 103 SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get()); 73 104 74 World::getInstance().unselectAllMolecules(MoleculeById(state->params.molindex.get())); 105 for (molids_t::const_iterator iter = state->undomolids.begin(); 106 iter != state->undomolids.end(); ++iter) { 107 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 108 World::getInstance().unselectMolecule(Walker); 109 } 75 110 76 111 return ActionState::ptr(_state); … … 80 115 SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get()); 81 116 82 World::getInstance().selectAllMolecules(MoleculeById(state->params.molindex.get())); 117 for (molids_t::const_iterator iter = state->undomolids.begin(); 118 iter != state->undomolids.end(); ++iter) { 119 const molecule *Walker = World::getInstance().getMolecule(MoleculeById(*iter)); 120 World::getInstance().selectMolecule(Walker); 121 } 83 122 84 123 return ActionState::ptr(_state);
Note:
See TracChangeset
for help on using the changeset viewer.
