35 | | 1. In [source:src/Actions/MoleculeAction/TranslateAction.cpp MoleculeTranslateAction::performCall()] you notice that first a dialog is constructed and then its display() function is called. This will wait for user interaction and return with a success-or-not statement. If the user input has been complete (success), we proceed and translate the molecule. For this translation action the following information is necessary: The molecule to translate, the vector to translate by and a statement whether periodic boundary conditions shall be adhered. |
36 | | 1. These dialogs and their queries are bit more difficult. Each UIFactory variant has its own queries. In case of the text menu, the user is asked on the console for the specific set of values, in the graphical interface a window pops up with boxes to enter the values. However, on the commandline these values have to be fed in already by the knowledgable user: In our case the parameter to our (-t) command line argument, i.e. to our action is the vector. Hence, the dialog receives the action's '''NAME''' as reference, whereas for the molecule and the periodicity statement we give the names of options that are defined in !MapOfActions. Note that periodicity has a default value of ''0'' and thus may be omitted. |
37 | | 1. These references are necessary for the queries. As in our command line case the queries themselves will turn to !CommandLineParser and ask its parsed map of command line arguments for the value belonging to this reference. I.e. for "molecule-by-id" [source:src/CommandLineParser.hpp CommandLineParser::vm], contains ''0'' |
38 | | 1. With the complete information we call upon [source:src/molecule_geometry.cpp molecule::Translate()] or [source:src/molecule_geometry.cpp molecule::TranslatePeriodically()] for the molecule instance obtained via the query. |
| 39 | 1. In [source:src/Actions/MoleculeAction/TranslateAction.cpp MoleculeTranslateAction::performCall()] you notice that first a "macrofied" function [[source:src/Actions/Action_impl_pre.hpp getParametersfromValueStorage()] is called. The construction of dialogs and querying information necessary for the execution of the action has been hidden inside macros such that the actual implementation really only deals with the perform...() functions. This single call fills a parameter structure, basically defined in [source:src/Actions/MoleculeAction/TranslateAction.def] and residing inside the Action class from user input. Afterwards, we may proceed and simply translate the selected atoms. For this translation action the following information is necessary: The atoms to translate, the vector to translate by and a statement whether periodic boundary conditions shall be adhered. |
| 40 | 1. These dialogs and their queries hidden inside the macro are bit more difficult. Each UIFactory variant has its own queries. In case of the text menu, the user is asked on the console for the specific set of values, in the graphical interface a window pops up with boxes to enter the values. However, on the command line these values have to be fed in already by the knowledgable user: In our case the parameter to our (-t) command line argument, i.e. to our action is a vector. Hence, the dialog receives the action's '''NAME''' as reference, whereas for the molecule and the periodicity statement we give the names of options that are defined in !MapOfActions. Note that periodicity has a default value of ''0'' and thus may be omitted. |
| 41 | 1. These references are necessary for the queries. As in our command line case the queries themselves will turn to !CommandLineParser and ask its parsed map of command line arguments for the value belonging to this reference. I.e. for "select-atom-by-id" [source:src/CommandLineParser.hpp CommandLineParser::vm], which contains ''0''. |
| 42 | 1. With the complete information we simply add the desired vector onto the position of each selected atom. Afterwards, if periodic boundary conditions are enforced, we call upon [source:src/box.cpp Box::WrapPeriodically()] for the periodic correction of the whole system. |
| 43 | 1. Finally, we return an !ActionState which contains all the selected atoms that have been translated to allow for undoing of the action. |