Changeset c42e60 for src


Ignore:
Timestamp:
Dec 16, 2010, 5:32:23 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
1a0987
Parents:
fc5c3a
git-author:
Frederik Heber <heber@…> (12/11/10 21:05:11)
git-committer:
Frederik Heber <heber@…> (12/16/10 17:32:23)
Message:

Two new descriptors: AtomOfMoleculeSelection, MoleculeOfAtomSelection. Rewrote associated SelectionActions.

That is, the SelectionActions are meant to use one selection and turn the
other accordingly. It is a sort of exchange between the two. I can convert
a selection of atoms to molecules and vica versa, but this "mapping" is NOT
injective but always surjective.

Testchange:

  • Selection/Atoms/testsuite-selection-atoms-of-molecule.at: Due to the absent parameter now, we first select the molecule by id and then ...
Location:
src
Files:
6 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/SelectionAction/Atoms/AllAtomsOfMoleculeAction.cpp

    rfc5c3a rc42e60  
    2121
    2222#include "Descriptors/AtomSelectionDescriptor.hpp"
     23#include "Descriptors/AtomOfMoleculeSelectionDescriptor.hpp"
    2324#include "atom.hpp"
    2425#include "molecule.hpp"
     
    4344  getParametersfromValueStorage();
    4445
    45   DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms of molecule " << params.mol->getName() << "." << endl);
     46  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms of currently selected molecule." << endl);
    4647  std::vector<atom *> selectedAtoms = World::getInstance().getAllAtoms(AtomsBySelection());
    47   World::getInstance().selectAtomsOfMolecule(params.mol);
     48  World::getInstance().selectAllAtoms(AtomsByMoleculeSelection());
    4849  return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(selectedAtoms, params));
    4950}
     
    5253  SelectionAllAtomsOfMoleculeState *state = assert_cast<SelectionAllAtomsOfMoleculeState*>(_state.get());
    5354
    54   World::getInstance().unselectAtomsOfMolecule(state->params.mol);
     55  World::getInstance().clearAtomSelection();
    5556  BOOST_FOREACH(atom *_atom, state->selectedAtoms)
    5657    World::getInstance().selectAtom(_atom);
     
    6263  SelectionAllAtomsOfMoleculeState *state = assert_cast<SelectionAllAtomsOfMoleculeState*>(_state.get());
    6364
    64   World::getInstance().selectAtomsOfMolecule(state->params.mol);
     65  World::getInstance().selectAllAtoms(AtomsByMoleculeSelection());
    6566
    6667  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Atoms/AllAtomsOfMoleculeAction.def

    rfc5c3a rc42e60  
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1313// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    14 #define paramtypes (const molecule *)
    15 #define paramtokens ("select-molecules-atoms")
    16 #define paramdescriptions ("molecule to select")
     14#undef paramtypes
     15#undef paramtokens
     16#undef paramdescriptions
    1717#undef paramdefaults
    18 #define paramreferences (mol)
     18#undef paramreferences
    1919
    2020#define statetypes (std::vector<atom*>)
     
    3030
    3131// finally the information stored in the ActionTrait specialization
    32 #define DESCRIPTION "select all atoms of a molecule"
     32#define DESCRIPTION "select all atoms of currently selected molecules"
    3333#undef SHORTFORM
  • src/Actions/SelectionAction/Atoms/NotAllAtomsOfMoleculeAction.cpp

    rfc5c3a rc42e60  
    2121
    2222#include "Descriptors/AtomSelectionDescriptor.hpp"
     23#include "Descriptors/AtomOfMoleculeSelectionDescriptor.hpp"
    2324#include "atom.hpp"
    2425#include "molecule.hpp"
     
    4344  getParametersfromValueStorage();
    4445
    45   DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms of molecule " << params.mol->getName() << "." << endl);
     46  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms of currently selected molecules." << endl);
    4647  std::vector<atom *> unselectedAtoms = World::getInstance().getAllAtoms(!AtomsBySelection());
    47   World::getInstance().unselectAtomsOfMolecule(params.mol);
     48  World::getInstance().unselectAllAtoms(AtomsByMoleculeSelection());
    4849  return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(unselectedAtoms, params));
    4950}
     
    5253  SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
    5354
    54   World::getInstance().selectAtomsOfMolecule(state->params.mol);
     55  World::getInstance().selectAllAtoms(AllAtoms());
    5556  BOOST_FOREACH(atom *_atom, state->unselectedAtoms)
    5657    World::getInstance().unselectAtom(_atom);
     
    6061
    6162Action::state_ptr SelectionNotAllAtomsOfMoleculeAction::performRedo(Action::state_ptr _state){
    62   SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
     63  //SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
    6364
    64   World::getInstance().unselectAtomsOfMolecule(state->params.mol);
     65  World::getInstance().unselectAllAtoms(AtomsByMoleculeSelection());
    6566
    6667  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Atoms/NotAllAtomsOfMoleculeAction.def

    rfc5c3a rc42e60  
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1313// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    14 #define paramtypes (const molecule*)
    15 #define paramtokens ("unselect-molecules-atoms")
    16 #define paramdescriptions ("molecule")
     14#undef paramtypes
     15#undef paramtokens
     16#undef paramdescriptions
    1717#undef paramdefaults
    18 #define paramreferences (mol)
     18#undef paramreferences
    1919
    2020#define statetypes (std::vector<atom*>)
     
    3030
    3131// finally the information stored in the ActionTrait specialization
    32 #define DESCRIPTION "unselect all atoms of a molecule"
     32#define DESCRIPTION "unselect all atoms of currently selected molecules"
    3333#undef SHORTFORM
  • src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp

    rfc5c3a rc42e60  
    2121
    2222#include "Descriptors/MoleculeDescriptor.hpp"
    23 #include "atom.hpp"
     23#include "Descriptors/MoleculeOfAtomSelectionDescriptor.hpp"
    2424#include "Helpers/Log.hpp"
    2525#include "Helpers/Verbose.hpp"
     
    4343
    4444  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    45   DoLog(1) && (Log() << Verbose(1) << "Selecting molecule to which " << params.Walker->getName() << " belongs." << endl);
    46   World::getInstance().selectMoleculeOfAtom(params.Walker);
     45  DoLog(1) && (Log() << Verbose(1) << "Selecting molecule to currently selected atoms." << endl);
     46  World::getInstance().selectAllMolecules(MoleculesByAtomSelection());
    4747  return Action::state_ptr(new SelectionMoleculeOfAtomState(selectedMolecules, params));
    4848}
     
    5959
    6060Action::state_ptr SelectionMoleculeOfAtomAction::performRedo(Action::state_ptr _state){
    61   SelectionMoleculeOfAtomState *state = assert_cast<SelectionMoleculeOfAtomState*>(_state.get());
     61  //SelectionMoleculeOfAtomState *state = assert_cast<SelectionMoleculeOfAtomState*>(_state.get());
    6262
    63   World::getInstance().selectMoleculeOfAtom(state->params.Walker);
     63  World::getInstance().selectAllMolecules(MoleculesByAtomSelection());
    6464
    6565  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.def

    rfc5c3a rc42e60  
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1212// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    13 #define paramtypes (const atom*)
    14 #define paramtokens ("select-molecule-of-atom")
    15 #define paramdescriptions ("one atom of desired molecule")
     13#undef paramtypes
     14#undef paramtokens
     15#undef paramdescriptions
    1616#undef paramdefaults
    17 #define paramreferences (Walker)
     17#undef paramreferences
    1818
    1919#define statetypes (std::vector<molecule*>)
     
    2525#define MENUPOSITION 11
    2626#define ACTIONNAME MoleculeOfAtom
    27 #define TOKEN "select-molecule-of-atom"
     27#define TOKEN "select-atoms-molecules"
    2828
    2929
    3030// finally the information stored in the ActionTrait specialization
    31 #define DESCRIPTION "select a molecule to which a given atom belongs"
     31#define DESCRIPTION "select all molecules of currently selected atoms"
    3232#undef SHORTFORM
  • src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.cpp

    rfc5c3a rc42e60  
    2121
    2222#include "Descriptors/MoleculeDescriptor.hpp"
    23 #include "atom.hpp"
     23#include "Descriptors/MoleculeOfAtomSelectionDescriptor.hpp"
    2424#include "Helpers/Log.hpp"
    2525#include "Helpers/Verbose.hpp"
     
    4343
    4444  std::vector<molecule *> unselectedMolecules = World::getInstance().getSelectedMolecules();
    45   DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule to which " << params.Walker->getName() << " belongs." << endl);
    46   World::getInstance().unselectMoleculeOfAtom(params.Walker);
     45  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule to currently selected atoms." << endl);
     46  World::getInstance().unselectAllMolecules(MoleculesByAtomSelection());
    4747  return Action::state_ptr(new SelectionNotMoleculeOfAtomState(unselectedMolecules, params));
    4848}
     
    5959
    6060Action::state_ptr SelectionNotMoleculeOfAtomAction::performRedo(Action::state_ptr _state){
    61   SelectionNotMoleculeOfAtomState *state = assert_cast<SelectionNotMoleculeOfAtomState*>(_state.get());
     61  //SelectionNotMoleculeOfAtomState *state = assert_cast<SelectionNotMoleculeOfAtomState*>(_state.get());
    6262
    63   World::getInstance().unselectMoleculeOfAtom(state->params.Walker);
     63  World::getInstance().unselectAllMolecules(MoleculesByAtomSelection());
    6464
    6565  return Action::state_ptr(_state);
  • src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.def

    rfc5c3a rc42e60  
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1212// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    13 #define paramtypes (const atom*)
    14 #define paramtokens ("unselect-molecule-of-atom")
    15 #define paramdescriptions ("one atom of desired molecule")
     13#undef paramtypes
     14#undef paramtokens
     15#undef paramdescriptions
    1616#undef paramdefaults
    17 #define paramreferences (Walker)
     17#undef paramreferences
    1818
    1919#define statetypes (std::vector<molecule*>)
     
    2525#define MENUPOSITION 21
    2626#define ACTIONNAME NotMoleculeOfAtom
    27 #define TOKEN "unselect-molecule-of-atom"
     27#define TOKEN "unselect-atoms-molecules"
    2828
    2929
    3030// finally the information stored in the ActionTrait specialization
    31 #define DESCRIPTION "unselect a molecule to which a given atom belongs"
     31#define DESCRIPTION "unselect all molecules of currently selected atoms"
    3232#undef SHORTFORM
  • src/Makefile.am

    rfc5c3a rc42e60  
    8484
    8585 
    86 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
     86DESCRIPTORSOURCE = \
     87        Descriptors/AtomDescriptor.cpp \
    8788  Descriptors/AtomIdDescriptor.cpp \
     89  Descriptors/AtomOfMoleculeSelectionDescriptor.cpp \
    8890  Descriptors/AtomSelectionDescriptor.cpp \
    8991  Descriptors/AtomShapeDescriptor.cpp \
     
    9395  Descriptors/MoleculeIdDescriptor.cpp \
    9496  Descriptors/MoleculeNameDescriptor.cpp \
     97  Descriptors/MoleculeOfAtomSelectionDescriptor.cpp \
    9598  Descriptors/MoleculeOrderDescriptor.cpp \
    9699  Descriptors/MoleculePtrDescriptor.cpp \
     
    98101                                   
    99102
    100 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \
     103DESCRIPTORHEADER = \
     104        Descriptors/AtomDescriptor.hpp \
    101105  Descriptors/AtomIdDescriptor.hpp \
     106  Descriptors/AtomOfMoleculeSelectionDescriptor.hpp \
    102107  Descriptors/AtomSelectionDescriptor.hpp \
    103108  Descriptors/AtomShapeDescriptor.hpp \
     
    107112  Descriptors/MoleculeIdDescriptor.hpp \
    108113  Descriptors/MoleculeNameDescriptor.hpp \
     114  Descriptors/MoleculeOfAtomSelectionDescriptor.hpp \
    109115  Descriptors/MoleculeOrderDescriptor.hpp \
    110116  Descriptors/MoleculePtrDescriptor.hpp \
    111   Descriptors/MoleculeSelectionDescriptor.cpp
     117  Descriptors/MoleculeSelectionDescriptor.hpp
     118 
     119DESCRIPTORIMPLHEADER = \
     120        Descriptors/AtomDescriptor_impl.hpp \
     121  Descriptors/AtomIdDescriptor_impl.hpp \
     122  Descriptors/AtomOfMoleculeSelectionDescriptor_impl.hpp \
     123  Descriptors/AtomSelectionDescriptor_impl.hpp \
     124  Descriptors/AtomShapeDescriptor_impl.hpp \
     125  Descriptors/AtomTypeDescriptor_impl.hpp \
     126  Descriptors/MoleculeDescriptor_impl.hpp \
     127  Descriptors/MoleculeFormulaDescriptor_impl.hpp \
     128  Descriptors/MoleculeIdDescriptor_impl.hpp \
     129  Descriptors/MoleculeNameDescriptor_impl.hpp \
     130  Descriptors/MoleculeOfAtomSelectionDescriptor_impl.hpp \
     131  Descriptors/MoleculeOrderDescriptor_impl.hpp \
     132  Descriptors/MoleculePtrDescriptor_impl.hpp \
     133  Descriptors/MoleculeSelectionDescriptor_impl.hpp
    112134 
    113135THERMOSTATSOURCE = \
     
    193215  ${SHAPEHEADER} \
    194216  ${DESCRIPTORHEADER} \
     217  ${DESCRIPTORIMPLHEADER} \
    195218  ${THERMOSTATHEADER} \
    196219  ${TESSELATIONHEADER} \
Note: See TracChangeset for help on using the changeset viewer.