Changes in / [101d2d:78ea3c]
- Files:
-
- 54 added
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/userguide/userguide.xml
r101d2d r78ea3c 1 <?xml version='1.0' encoding='UTF-8'?>1 <?xml version='1.0' encoding='UTF-8'?> 2 2 <!-- This document was created with Syntext Serna Free. --><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ 3 3 <!ENTITY molecuilder_logo SYSTEM "pictures/molecuilder_logo.png" NDATA PNG> … … 100 100 spheres, cubes, or cylinders.</para> 101 101 </listitem> 102 <listitem>World refers to the whole of the molecular system, i.e. all atoms with coordinates and element type (over all time steps), all bonds between pairs of atoms, the size of the simulation domain. This state is also referred to as the state.</listitem> 103 <listitem>Time step is the current discrete position in time. Molecular dynamics simulations are executed in discrete (but very small) time steps. Each atom has a distinct position per time step. The discrete positions over the discrete time steps samples its trajectory during a simulation.</listitem> 102 <listitem>World refers to the whole of the molecular system, i.e. all 103 atoms with coordinates and element type (over all time steps), all 104 bonds between pairs of atoms, the size of the simulation domain. 105 This is also referred to as the state.</listitem> 106 <listitem>Time step is the current discrete position in time. Molecular 107 dynamics simulations are executed in discrete (but very small) time 108 steps. Each atom has a distinct position per time step. The discrete 109 positions over the discrete time steps samples its trajectory during a 110 simulation.</listitem> 104 111 </itemizedlist> 105 112 </section> … … 110 117 respect to their functionality, while newer features or actions are 111 118 probably missing. This should be a clear sign to you that these are 112 probably not safe to use yet. If you nonetheless require them, you should acquire some familiarity with the code itself. This suggests 113 changing to the developer documentation which is maintained along with 114 the source code with <productname>doxygen</productname>.</para> 119 probably not safe to use yet. If you nonetheless require them, you 120 should acquire some familiarity with the code itself. This suggests 121 changing to the developer documentation which is maintained along 122 with the source code with <productname>doxygen</productname>. 123 </para> 115 124 </section> 116 125 </section> … … 313 322 </formalpara> 314 323 <note> 315 <para>Note further that when placing a slew of commands in a script file it is generally recommended to use the above formatting: One command or option per line and each</para> 316 <para>option receives an extra tab for indentation.</para> 324 <para>Note further that when placing a slew of commands in a script file 325 it is generally recommended to use the above formatting: One command 326 or option per line and each receives an extra tab for indentation.</para> 317 327 </note> 318 328 <section xml:id="preliminaries"> … … 728 738 </section> 729 739 </section> 740 <section xml:id="geometry"> 741 <title xml:id="geometry.title">Geometry Objects</title> 742 <para>Although we use the term geometry objects in the title, we 743 actually mean vectors, i.e. a position or direction in the 744 three-dimensional space. But maybe we have need for the more 745 general term in the future.</para> 746 <para>Vectors are required as input to many of the Actions further 747 below: translating atoms, rotating atoms around a specific axis, 748 aligning a molecule with a vector, ...</para> 749 <para>Therefore, vectors can be stored and referenced using a given 750 name. This allows for a very powerful and handy manipulation of the 751 molecular system afterwards. And to give a concrete example, let's have 752 a look at translating a set of selected atoms, see subsection on 753 <link linkend='atoms.translate-atom'>Translating atoms</link>. </para> 754 <programlisting> 755 ... --translate-atoms "unitVectorX" 756 </programlisting> 757 <para>This would use the automatically created reference 758 "unitVectorX", i.e. the vector with components (1,0,0) as 759 the translation vector for the given set of atoms. In other words, all 760 selected atoms get shifted by 1 unit (e.g. Angström) in +X 761 direction.</para> 762 <para>We have the following automatically created geometry objects 763 whose names are self-explanatory:</para> 764 <itemizedlist> 765 <listitem>zeroVector</listitem> 766 <listitem>unitVectorX</listitem> 767 <listitem>unitVectorY</listitem> 768 <listitem>unitVectorZ</listitem> 769 </itemizedlist> 770 <para>However, more vectors can be simply constructed from atomic 771 positions, such as the position of an atom directly, the distance between 772 two atoms (in case they are bonded, then this would be the bond vector) 773 or from three atoms, defining a plane and giving its normal vector. 774 </para> 775 <remark>We have refrained from giving automated names to vectors and even 776 keeping them up-to-date automatically, i.e. the distance between two atoms 777 O1 and O2 could be named "distance_O1_O2" or similar. However, we want 778 the user to have full control and maybe come up with more suitable names 779 such as "rotation_axis" in this case.</remark> 780 <warning>Note that names have to be unique and the Action will fail if 781 the name is already used.</warning> 782 <section xml:id="geometry.distance-to.vector"> 783 <title xml:id="geometry.distance-to-vector.title">Atomic distance to stored vector</title> 784 <para>The distance between two selected atoms is stored as a vector as follows,</para> 785 <programlisting> 786 ... --distance-to-vector "distance_vec" \ 787 </programlisting> 788 <para>where the distance vector can be referenced by "distance_vec" 789 from then on in other Actions requiring a vector as input.</para> 790 </section> 791 <section xml:id="geometry.input-to.vector"> 792 <title xml:id="geometry.input-to-vector.title">Coordinates to stored vector</title> 793 <para>We may also create a geometry vector simply by supplying the 794 three coordinates of a vector.</para> 795 <programlisting> 796 ... --input-to-vector "vector" \ 797 --position "1,2,3" 798 </programlisting> 799 <para>where the vector with components (1,2,3) can be referenced 800 by "vector" .</para> 801 </section> 802 <section xml:id="geometry.plane-to.vector"> 803 <title xml:id="geometry.plane-to-vector.title">Normal of plane to stored vector</title> 804 <para>Three positions in space (if they are not linear dependent) 805 define a plane in three-dimensional space.</para> 806 <para>Therefore, when exactly three atoms are selected, this Action 807 will construct the resulting plane and store its normal vector as a 808 geometry object for later reference.</para> 809 <programlisting> 810 ... --plane-to-vector "planenormal" \ 811 </programlisting> 812 <para>where the plane's normal vector can be referenced by 813 "planenormal".</para> 814 </section> 815 <section xml:id="geometry.position-to.vector"> 816 <title xml:id="geometry.position-to-vector.title">Atomic position to stored vector</title> 817 <para>Storing the position of a singly selected atom as a vector is simply done as follows,</para> 818 <programlisting> 819 ... --position-to-vector "vector_O1" \ 820 </programlisting> 821 <para>where the vector can be referenced by "vector_O1" 822 from then on.</para> 823 </section> 824 <section xml:id="geometry.remove-geometry"> 825 <title xml:id="geometry.remove-geometry.title">Remove A stored vector</title> 826 <para>Finally, a stored vector can also be removed.</para> 827 <programlisting> 828 ... --remove-geometry "vector_O1" \ 829 </programlisting> 830 <para>this removes the stored "vector_O1".</para> 831 </section> 832 </section> 730 833 <section xml:id="randomization"> 731 834 <title xml:id="randomization.title">Randomization</title> … … 772 875 <para>where the element is given via its chemical symbol and the 773 876 vector gives the position within the domain</para> 877 <para>Note that instead of giving an explicit vector you may also use 878 a vector stored as a geometry object, see section 879 <link linkend='geometry'>Geometry</link>.</para> 774 880 </section> 775 881 <section xml:id="atoms.remove-atom"> … … 787 893 ... --saturate-atoms 788 894 </programlisting> 789 <para>A number of hydrogen atoms is added around each selected atom corresponding to the valence of the chemical element. The hydrogen atoms are placed in the same 790 distance to this atom and approximately with same distance to their 791 nearest neighbors. Already present bonds (i.e. the position of neighboring atoms) is taken into account.</para> 895 <para>A number of hydrogen atoms is added around each selected atom 896 corresponding to the valence of the chemical element. The hydrogen 897 atoms are placed in the same distance to this atom and approximately 898 with same distance to their nearest neighbors. Already present bonds 899 (i.e. the position of neighboring atoms) is taken into account.</para> 792 900 </section> 793 901 <section xml:id="atoms.translate-atom"> … … 802 910 mind the boundary conditions, i.e. it might shift atoms outside of the 803 911 domain.</para> 912 <para>Again, note that instead of giving an explicit vector you may 913 also use a vector stored as a geometry object, see section 914 <link linkend='geometry'>Geometry</link>.</para> 804 915 </section> 805 916 <section xml:id="atoms.mirror-atoms"> … … 813 924 --periodic 0 814 925 </programlisting> 926 <para>And of course instead of giving an explicit vector you may also 927 use a vector stored as a geometry object, see section 928 <link linkend='geometry'>Geometry</link>.</para> 815 929 </section> 816 930 <section xml:id="atoms.translate-to-origin"> … … 1023 1137 and adds new bonds in between these copied atoms such that their 1024 1138 bond subgraphs are identical.</para> 1139 <para>Here, instead of giving an explicit vector you may also use 1140 a vector stored as a geometry object, see section 1141 <link linkend='geometry'>Geometry</link>.</para> 1025 1142 </section> 1026 1143 <section xml:id="molecule.change-molname"> … … 1053 1170 specific offset..</para> 1054 1171 <programlisting>... -translate-molecules</programlisting> 1055 <para>As before, this is actually just an operation on all of the molecule's atoms, namely translating them.</para> 1172 <para>As before, this is actually just an operation on all of the 1173 molecule's atoms, namely translating them.</para> 1174 <para>Same as with <link linkend='atoms.translate-atom'>translate-atoms</link> 1175 instead of giving an explicit vector you may also use a vector stored 1176 as a geometry object, see section 1177 <link linkend='geometry'>Geometry</link>.</para> 1056 1178 </section> 1057 1179 <section xml:id="molecule.rotate-around-bond"> … … 1085 1207 </programlisting> 1086 1208 <para>This rotates the molecule around an axis from the origin to 1087 the position (0,0,1), i.e. around the z axis, by 90 degrees.</para> 1209 the position (0,0,1), i.e. around the z axis, by 90 degrees, where 1210 for the position you may also use a stored vector, see section 1211 <link linkend='geometry'>Geometry</link>.</para> 1088 1212 </section> 1089 1213 <section xml:id="molecule.rotate-to-principal-axis-system"> … … 1098 1222 </programlisting> 1099 1223 <para>This rotates the molecule in such a manner that the ellipsoids 1100 largest axis is aligned with the z axis. <remark>Note that "0,0,-1" would align anti-parallel.</remark></para> 1224 largest axis is aligned with the z axis. <remark>Note that 1225 "0,0,-1" would align anti-parallel.</remark></para> 1226 <para>Again instead of giving the coordinates explicitly you may also 1227 use a vector stored as a geometry object, see section 1228 <link linkend='geometry'>Geometry</link>.</para> 1101 1229 </section> 1102 1230 <section xml:id="molecule.verlet-integration"> … … 1343 1471 --Alignment-Axis "0,0,1" 1344 1472 </programlisting> 1473 <para>Note that instead of giving an explicit axis you may also use 1474 a vector stored as a geometry object, see section 1475 <link linkend='geometry'>Geometry</link>.</para> 1345 1476 </section> 1346 1477 <section xml:id="filling.suspend-in-molecule"> … … 1450 1581 <para>This would calculate the correlation of all hydrogen and 1451 1582 oxygen atoms with respect to the origin.</para> 1583 <para>Naturally, instead of giving explicit coordinates you may also 1584 use a vector stored as a geometry object for position, see section 1585 <link linkend='geometry'>Geometry</link>.</para> 1452 1586 </section> 1453 1587 <section xml:id="analysis.surface-correlation"> … … 2385 2519 <para>Underneath the time line there is another place for 2386 2520 tabs.</para> 2521 <itemizedlist> 2522 <listitem>Molecules</listitem> 2523 <listitem>All Elements</listitem> 2524 <listitem>All Fragments</listitem> 2525 <listitem>All Homologies</listitem> 2526 <listitem>All Geometries</listitem> 2527 <listitem>Logs</listitem> 2528 <listitem>Errors</listitem> 2529 </itemizedlist> 2387 2530 <para>The first is on molecules, listing all present molecules of 2388 2531 the molecular system in a tree view. If you click on a specific … … 2394 2537 system. Clicking on a present element will select all atoms of this 2395 2538 specific element. A subsequent click unselects again.</para> 2396 <para>Subsequently follow t abs on enumerating the fragments and their2539 <para>Subsequently follow two tabs on enumerating the fragments and their 2397 2540 fragment energies if calculated and the homologies along with 2398 2541 graphical depiction (via QWT), again if present.</para> 2542 <para>After that, we have a tab listing all geometry objects. These 2543 are vectors you may store via one of the Actions. If you hover over 2544 a vector, its length is shown. If you have selected one vector and 2545 hover over another one, then the angle between the two is shown. 2546 </para> 2547 <para>Finally, there are two tabs showing log messages of actions 2548 in the first tab and general information on what is currently done. Errors and 2549 warnings are listed in the second tab.</para> 2399 2550 </section> 2400 2551 </section> -
src/Actions/Action_impl_pre.hpp
r101d2d r78ea3c 173 173 output << \ 174 174 BOOST_PP_IF(n, ", ", "") \ 175 << "\"" << toPythonString(params. \175 << "\"" << params. \ 176 176 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 177 .get Unvalidated()) \177 .getAsStringUnvalidated() \ 178 178 << "\""; 179 179 -
src/Actions/CommandAction/HelpAction.cpp
r101d2d r78ea3c 73 73 std::cout << "\t - List/vector of strings: gives as \"first\" \"second\" \"third\"." << std::endl; 74 74 std::cout << "\t - Vector: give as \"x,y,z\", i.e. its 3 components." << std::endl; 75 std::cout << "\t - or give as \"<name>\", where <name> is a stored geometry name." << std::endl; 75 76 std::cout << "\t - Domain: give as \"xx,yx,yy,zx,zy,zz\", i.e. symmetric 3x3 matrix." << std::endl; 76 77 std::cout << "\t - Path/filename: give as \"<path/filename>\"." << std::endl; -
src/Actions/GlobalListOfActions.hpp
r101d2d r78ea3c 69 69 (FragmentationStoreSaturatedFragment) \ 70 70 (FragmentationStructuralOptimization) \ 71 (GeometryDistanceToVector) \ 72 (GeometryInputToVector) \ 73 (GeometryPlaneToVector) \ 74 (GeometryPositionToVector) \ 75 (GeometryRemove) \ 71 76 (GraphUpdateMolecules) \ 72 77 (GraphCorrectBondDegree) \ -
src/Actions/Makefile.am
r101d2d r78ea3c 64 64 ${FILLACTIONSOURCE} \ 65 65 ${FRAGMENTATIONACTIONSOURCE} \ 66 ${GEOMETRYACTIONSOURCE} \ 66 67 ${GRAPHACTIONSOURCE} \ 67 68 ${MOLECULEACTIONSOURCE} \ … … 84 85 ${FILLACTIONHEADER} \ 85 86 ${FRAGMENTATIONACTIONHEADER} \ 87 ${GEOMETRYACTIONHEADER} \ 86 88 ${GRAPHACTIONHEADER} \ 87 89 ${MOLECULEACTIONHEADER} \ … … 104 106 ${FILLACTIONDEFS} \ 105 107 ${FRAGMENTATIONACTIONDEFS} \ 108 ${GEOMETRYACTIONDEFS} \ 106 109 ${GRAPHACTIONDEFS} \ 107 110 ${MOLECULEACTIONDEFS} \ … … 285 288 Actions/FragmentationAction/StoreSaturatedFragmentAction.def \ 286 289 Actions/FragmentationAction/StructuralOptimizationAction.def 290 291 GEOMETRYACTIONSOURCE = \ 292 Actions/GeometryAction/GeometryDistanceToVectorAction.cpp \ 293 Actions/GeometryAction/GeometryInputToVectorAction.cpp \ 294 Actions/GeometryAction/GeometryPlaneToVectorAction.cpp \ 295 Actions/GeometryAction/GeometryPositionToVectorAction.cpp \ 296 Actions/GeometryAction/GeometryRemoveAction.cpp 297 GEOMETRYACTIONHEADER = \ 298 Actions/GeometryAction/GeometryDistanceToVectorAction.hpp \ 299 Actions/GeometryAction/GeometryInputToVectorAction.hpp \ 300 Actions/GeometryAction/GeometryPlaneToVectorAction.hpp \ 301 Actions/GeometryAction/GeometryPositionToVectorAction.hpp \ 302 Actions/GeometryAction/GeometryRemoveAction.hpp 303 GEOMETRYACTIONDEFS = \ 304 Actions/GeometryAction/GeometryDistanceToVectorAction.def \ 305 Actions/GeometryAction/GeometryInputToVectorAction.def \ 306 Actions/GeometryAction/GeometryPlaneToVectorAction.def \ 307 Actions/GeometryAction/GeometryPositionToVectorAction.def \ 308 Actions/GeometryAction/GeometryRemoveAction.def 287 309 288 310 GRAPHACTIONSOURCE = \ -
src/Actions/MakroAction_impl_pre.hpp
r101d2d r78ea3c 165 165 output << \ 166 166 BOOST_PP_IF(n, ", ", "") \ 167 << "\"" << toPythonString(params. \167 << "\"" << params. \ 168 168 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 169 .get ()) \169 .getAsStringUnvalidated() \ 170 170 << "\""; 171 171 -
src/Actions/Values.cpp
r101d2d r78ea3c 37 37 #include "CodePatterns/Assert.hpp" 38 38 39 #include <boost/lexical_cast.hpp> 40 #include <boost/tokenizer.hpp> 41 39 42 #include "Box.hpp" 40 43 #include "LinearAlgebra/BoxVector.hpp" … … 44 47 #include "Values.hpp" 45 48 49 static const Vector parseAsVector(const std::string &_string) 50 { 51 Vector temp; 52 // dissect by "," 53 typedef boost::tokenizer<boost::char_separator<char> > tokenizer; 54 boost::char_separator<char> value_separator(",)("); 55 56 bool status = true; 57 tokenizer tokens(_string, value_separator); 58 if (!_string.empty()) { 59 tokenizer::iterator tok_iter = tokens.begin(); 60 for (size_t i=0;i<NDIM;++i) { 61 if (tok_iter == tokens.end()) { 62 status = false; 63 break; 64 } 65 temp[i] = boost::lexical_cast<double>(*(tok_iter++)); 66 } 67 } 68 if (!status) 69 temp.Zero(); 70 71 return temp; 72 } 73 46 74 Vector VectorValue::toVector() const 47 75 { 48 Vector returnVector (vector);76 Vector returnVector = parseAsVector(vectorstring); 49 77 50 78 return returnVector; … … 54 82 { 55 83 BoxVector returnVector; 56 static_cast<Vector>(returnVector) = Vector(vector); // under its hood it's still a Vector84 static_cast<Vector>(returnVector) = parseAsVector(vectorstring); // under its hood it's still a Vector 57 85 58 86 ASSERT(_box.isValid(returnVector), -
src/Actions/Values.hpp
r101d2d r78ea3c 27 27 * are registered as VectorValue and lateron inside the CommandLineQuery placed 28 28 * into the real vector. 29 * 30 * We use this abstraction also for Geometry Objects, i.e. string names 31 * referencing vectors in the GeomtryRegistry. 29 32 */ 30 33 struct VectorValue 31 34 { 32 double vector[NDIM];35 std::string vectorstring; 33 36 34 37 Vector toVector() const; -
src/Makefile.am
r101d2d r78ea3c 11 11 # libMolecuilder.la requires the libraries listed below 12 12 13 include Geometry/Makefile.am 13 14 include Helpers/Makefile.am 14 15 include Shapes/Makefile.am -
src/Parameters/Makefile.am
r101d2d r78ea3c 4 4 5 5 PARAMETERSOURCE = \ 6 Parameters/Specifics/Parameter_vector.cpp \ 6 7 Parameters/Specifics/Value_atom.cpp \ 7 8 Parameters/Specifics/Value_element.cpp \ … … 9 10 Parameters/Specifics/Value_molecule.cpp \ 10 11 Parameters/Specifics/Value_string.cpp \ 12 Parameters/Specifics/Value_vector.cpp \ 11 13 Parameters/Validators/Specific/ActionNameValidator.cpp \ 12 14 Parameters/Validators/Specific/AtomDataValidator.cpp \ … … 17 19 Parameters/Validators/Specific/FileSuffixValidator.cpp \ 18 20 Parameters/Validators/Specific/FormulaValidator.cpp \ 21 Parameters/Validators/Specific/GeometryNameValidator.cpp \ 19 22 Parameters/Validators/Specific/KeyValueValidator.cpp \ 20 23 Parameters/Validators/Specific/MoleculeIdValidator.cpp \ 21 24 Parameters/Validators/Specific/ParserFileValidator.cpp \ 22 25 Parameters/Validators/Specific/ParserTypeValidator.cpp \ 26 Parameters/Validators/Specific/PresentGeometryNameValidator.cpp \ 23 27 Parameters/Validators/Specific/RandomNumberValidators.cpp \ 24 28 Parameters/Validators/Specific/RealSpaceMatrixInvertibleValidator.cpp \ … … 45 49 Parameters/ValueInterface.hpp \ 46 50 Parameters/Specifics/KeyValuePair.hpp \ 51 Parameters/Specifics/Parameter_vector.hpp \ 47 52 Parameters/Specifics/Value_atom.hpp \ 48 53 Parameters/Specifics/Value_element.hpp \ … … 50 55 Parameters/Specifics/Value_molecule.hpp \ 51 56 Parameters/Specifics/Value_string.hpp \ 57 Parameters/Specifics/Value_vector.hpp \ 52 58 Parameters/Validators/DiscreteValidator.hpp \ 53 59 Parameters/Validators/DiscreteValidator_impl.hpp \ … … 74 80 Parameters/Validators/Specific/FileSuffixValidator.hpp \ 75 81 Parameters/Validators/Specific/FormulaValidator.hpp \ 82 Parameters/Validators/Specific/GeometryNameValidator.hpp \ 76 83 Parameters/Validators/Specific/KeyValueValidator.hpp \ 77 84 Parameters/Validators/Specific/MoleculeIdValidator.hpp \ 78 85 Parameters/Validators/Specific/ParserFileValidator.hpp \ 79 86 Parameters/Validators/Specific/ParserTypeValidator.hpp \ 87 Parameters/Validators/Specific/PresentGeometryNameValidator.hpp \ 80 88 Parameters/Validators/Specific/RandomNumberValidators.hpp \ 81 89 Parameters/Validators/Specific/RealSpaceMatrixInvertibleValidator.hpp \ -
src/Parameters/Parameter.hpp
r101d2d r78ea3c 25 25 class ParameterValueException; 26 26 27 /** This class encapsulates a clon able, continuous value.27 /** This class encapsulates a cloneable, continuous value. 28 28 * 29 29 */ … … 48 48 bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException); 49 49 const std::string getAsString() const throw(ParameterValueException); 50 const std::string getAsStringUnvalidated() const throw(ParameterValueException); 50 51 void setAsString(const std::string &_value) throw(ParameterValueException); 51 52 … … 78 79 }; 79 80 81 #include "Parameters/Specifics/Parameter_vector.hpp" 82 80 83 #include "Parameter_impl.hpp" 81 84 -
src/Parameters/Parameter_impl.hpp
r101d2d r78ea3c 23 23 value(instance.value.getValidator()) 24 24 { 25 value.set(instance.value. value);25 value.set(instance.value.getUnvalidated()); 26 26 } 27 27 … … 171 171 } 172 172 173 /** Catch call to value.getAsStringUnvalidated() to add exception information. 174 * 175 * @return parameter value as string 176 */ 177 template<typename T> 178 inline const std::string Parameter<T>::getAsStringUnvalidated() const throw(ParameterValueException) 179 { 180 try { 181 return value.getAsStringUnvalidated(); 182 } catch(ParameterException &e) { 183 e << ParameterName(ParameterInterface::getName()); 184 throw; 185 } 186 } 187 173 188 /** Catch call to value.isValid() to add exception information. 174 189 * … … 258 273 try { 259 274 status = status && 260 ( value == _instance.value);275 (getUnvalidated() == _instance.getUnvalidated()); 261 276 status = status && (ParameterInterface::getName() == _instance.ParameterInterface::getName()); 262 277 } catch(ParameterException &e) { … … 276 291 Parameter<T> *instance = new Parameter<T>(ParameterInterface::getName(), value.getValidator()); 277 292 // do not use get, we do not check for validity here 278 if (value. ValueSet)279 instance->set(value. value);293 if (value.isSet()) 294 instance->set(value.getUnvalidated()); 280 295 return instance; 281 296 } -
src/Parameters/Value.hpp
r101d2d r78ea3c 67 67 friend class ValueTest; 68 68 friend class ContinuousValueTest; 69 friend class Parameter<T>;69 // friend class Parameter<T>; 70 70 public: 71 71 Value(); … … 85 85 bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException); 86 86 const std::string getAsString() const throw(ParameterValueException); 87 const std::string getAsStringUnvalidated() const throw(ParameterValueException); 87 88 void setAsString(const std::string &_value) throw(ParameterException); 88 89 … … 123 124 #include "Specifics/Value_molecule.hpp" 124 125 #include "Specifics/Value_string.hpp" 126 #include "Specifics/Value_vector.hpp" 125 127 126 128 #include "Value_impl.hpp" -
src/Parameters/Value_impl.hpp
r101d2d r78ea3c 22 22 #include "CodePatterns/Log.hpp" 23 23 24 #include "Actions/toPythonString.hpp" 24 25 #include "Validators/DummyValidator.hpp" 25 26 #include "Validators/DiscreteValidator.hpp" … … 184 185 { 185 186 return toString(get()); 187 } 188 189 /** Getter of unvalidated value, returning string. 190 * 191 * @return string value 192 */ 193 template <class T> 194 inline const std::string Value<T>::getAsStringUnvalidated() const throw(ParameterValueException) 195 { 196 return toPythonString(getUnvalidated()); 186 197 } 187 198 -
src/Parameters/unittests/Makefile.am
r101d2d r78ea3c 31 31 libUnitTest.la \ 32 32 ../libMolecuilder.la \ 33 ../libMolecuilderParameters.la \ 34 ../libMolecuilderGeometry.la \ 33 35 $(top_builddir)/ThirdParty/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \ 34 36 ${CodePatterns_LIBS} \ … … 47 49 ../Parameters/ValueInterface.hpp 48 50 ContinuousValueTest_LDADD = \ 51 ../libMolecuilderParameters.la \ 52 ../libMolecuilderGeometry.la \ 49 53 $(PARAMETERSLIBS) 50 54 -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
r101d2d r78ea3c 48 48 #include <boost/preprocessor/facilities/empty.hpp> 49 49 50 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 51 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 52 50 53 // iterate over all parameter query types for query declarations 51 54 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type … … 57 60 #undef SUFFIX 58 61 #endif 62 63 class VectorCommandLineQuery; 64 class VectorsCommandLineQuery; 59 65 60 66 // iterate over all parameter query types for forward declarations -
src/UIElements/CommandLineUI/CommandLineParser.cpp
r101d2d r78ea3c 75 75 shape("shape options"), 76 76 fragmentation("Fragmentation options"), 77 geometry("Geometry options"), 77 78 graph("Graph options"), 78 79 molecule("Molecule options"), … … 93 94 CmdParserLookup["shape"] = &shape; 94 95 CmdParserLookup["fragmentation"] = &fragmentation; 96 CmdParserLookup["geometry"] = &geometry; 95 97 CmdParserLookup["graph"] = &graph; 96 98 CmdParserLookup["options"] = &options; -
src/UIElements/CommandLineUI/CommandLineParser.hpp
r101d2d r78ea3c 62 62 po::options_description shape; 63 63 po::options_description fragmentation; 64 po::options_description geometry; 64 65 po::options_description graph; 65 66 po::options_description molecule; -
src/UIElements/CommandLineUI/CommandLineParser_validate.cpp
r101d2d r78ea3c 66 66 std::string("value"), 67 67 std::string("VectorValue") 68 ); 69 #endif 70 } 71 VV.vectorstring = values.at(0); 72 v = boost::any(VectorValue(VV)); 73 } 74 75 void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int) 76 { 77 RealSpaceMatrixValue RSMV; 78 std::vector<std::string> components; 79 80 // split comma-separated values 81 if (values.size() != 1) { 82 std::cerr << "Not one vector but " << values.size() << " given " << std::endl; 83 #if BOOST_VERSION < 104200 84 throw boost::program_options::validation_error("Unequal to one vector given"); 85 #else 86 throw boost::program_options::validation_error( 87 boost::program_options::validation_error::invalid_option_value, 88 std::string("value"), 89 std::string("BoxValue") 68 90 ); 69 91 #endif … … 83 105 components.push_back(std::string(Biter,argument.end())); 84 106 85 if (components.size() != 3) {86 std::cerr << "Specified vector does not have three components but " << components.size() << std::endl;87 #if BOOST_VERSION < 10420088 throw boost::program_options::validation_error("Specified vector does not have three components");89 #else90 throw boost::program_options::validation_error(91 boost::program_options::validation_error::invalid_option_value,92 std::string("value"),93 std::string("VectorValue")94 );95 #endif96 }97 for (size_t i=0;i<NDIM;++i)98 VV.vector[i] = boost::lexical_cast<double>(components.at(i));99 v = boost::any(VectorValue(VV));100 }101 102 void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int)103 {104 RealSpaceMatrixValue RSMV;105 std::vector<std::string> components;106 107 // split comma-separated values108 if (values.size() != 1) {109 std::cerr << "Not one vector but " << values.size() << " given " << std::endl;110 #if BOOST_VERSION < 104200111 throw boost::program_options::validation_error("Unequal to one vector given");112 #else113 throw boost::program_options::validation_error(114 boost::program_options::validation_error::invalid_option_value,115 std::string("value"),116 std::string("BoxValue")117 );118 #endif119 }120 std::string argument(values.at(0));121 std::string::iterator Aiter = argument.begin();122 std::string::iterator Biter = argument.begin();123 for (; Aiter != argument.end(); ++Aiter) {124 if (*Aiter == ',') {125 components.push_back(std::string(Biter,Aiter));126 do {127 Aiter++;128 } while (*Aiter == ' ' || *Aiter == '\t');129 Biter = Aiter;130 }131 }132 components.push_back(std::string(Biter,argument.end()));133 134 107 if (components.size() != 6) { 135 108 std::cerr << "Specified vector does not have three components but " << components.size() << std::endl; -
src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp
r101d2d r78ea3c 24 24 }; 25 25 26 class CommandLineDialog::VectorCommandLineQuery : public Dialog::TQuery<Vector> { 27 public: 28 VectorCommandLineQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~VectorCommandLineQuery(); 30 virtual bool handle(); 31 }; 32 33 class CommandLineDialog::VectorsCommandLineQuery : public Dialog::TQuery< std::vector<Vector> > { 34 public: 35 VectorsCommandLineQuery(Parameter< std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~VectorsCommandLineQuery(); 37 virtual bool handle(); 38 }; 39 26 40 /** With the following boost::preprocessor code we generate forward declarations 27 41 * of query class for all desired query types in the Qt specialization class of -
src/UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp
r101d2d r78ea3c 53 53 54 54 bool CommandLineDialog::VectorCommandLineQuery::handle() { 55 VectorValue _temp;55 VectorValue temporary; 56 56 if (CommandLineParser::getInstance().vm.count(getTitle())) { 57 try { 58 _temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 59 } catch(boost::bad_any_cast &e) { 60 for (size_t i=0;i<NDIM;++i) 61 _temp.vector[i] = 0.; 62 return false; 63 } 64 temp = _temp.toVector(); 57 temporary = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 58 temp = temporary.vectorstring; 65 59 return true; 66 60 } -
src/UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp
r101d2d r78ea3c 46 46 47 47 CommandLineDialog::VectorsCommandLineQuery::VectorsCommandLineQuery(Parameter<std::vector<Vector> > &_param, const std::string &_title, const std::string &_description) : 48 Dialog::TQuery< std::vector<Vector> >(_param, _title, _description)48 Dialog::TQuery< std::vector<Vector> >(_param, _title, _description) 49 49 {} 50 50 … … 53 53 54 54 bool CommandLineDialog::VectorsCommandLineQuery::handle() { 55 std::vector<VectorValue> temporary; 55 std::vector<std::string> temporary; 56 std::stringstream output; 56 57 if (CommandLineParser::getInstance().vm.count(getTitle())) { 57 try { 58 temporary = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<VectorValue> >(); 59 } catch(boost::bad_any_cast &e) { 60 temporary.clear(); 61 return false; 62 } 63 for(std::vector<VectorValue>::iterator iter = temporary.begin(); iter != temporary.end(); ++iter) { 64 Vector temp_element = (*iter).toVector(); 65 temp.push_back(temp_element); 66 } 58 temp = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<std::string> >(); 67 59 return true; 68 60 } -
src/UIElements/Dialog.cpp
r101d2d r78ea3c 134 134 queryEmpty(param, title, description); 135 135 }*/ 136 template <> 137 void Dialog::query<Vector>(Parameter<Vector> ¶m, const std::string title, const std::string description) 138 { 139 queryVector(param, title, description); 140 } 141 template <> 142 void Dialog::query< std::vector<Vector> >(Parameter< std::vector<Vector> > ¶m, const std::string title, const std::string description) 143 { 144 queryVectors(param, title, description); 145 } 146 147 static const std::string concatenateStrings(const std::vector<std::string> &_strings) 148 { 149 std::stringstream output; 150 for (std::vector<std::string>::const_iterator iter = _strings.begin(); 151 iter != _strings.end(); ++iter) 152 output << *iter << " "; 153 return output.str(); 154 } 155 156 bool Dialog::TQuery< std::vector<Vector> >::isValid() 157 { 158 return param.isValidAsString(concatenateStrings(temp)); 159 } 160 void Dialog::TQuery< std::vector<Vector> >::setResult() 161 { 162 param.setAsString(concatenateStrings(temp)); 163 } 136 164 137 165 /** With the following boost::preprocessor code we generate template -
src/UIElements/Dialog.hpp
r101d2d r78ea3c 158 158 virtual void queryEmpty(const std::string ="", const std::string = "")=0; 159 159 160 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0; 161 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = "")=0; 162 160 163 /** With the following boost::preprocessor code we generate virtual function 161 164 * definitions for all desired query types in the abstract class Dialog. … … 250 253 }; 251 254 252 253 255 template<class T> 254 256 class TQuery : public Query { … … 282 284 }; 283 285 286 // we have specialization of Vector to allow internal storing as string 287 template <> 288 void Dialog::query<Vector>(Parameter<Vector> &, const std::string, const std::string); 289 template <> 290 void Dialog::query< std::vector<Vector> >(Parameter< std::vector<Vector> > &, const std::string, const std::string); 291 292 /** Template specialization for Query<Vector> to allow internal storing of a 293 * string instead of a Vector. 294 * 295 * Because we need to evaluate the string as a possible GeometryRegistry key 296 * and we may do this only when the Action (whose options we are querying) 297 * is executed, not before. 298 */ 299 template <> 300 class Dialog::TQuery<Vector> : public Query { 301 public: 302 TQuery(Parameter<Vector> &_param, const std::string title, const std::string _description = "") : 303 Query(title, _description), param(_param) {} 304 virtual ~TQuery(){} 305 virtual bool handle()=0; 306 virtual bool isValid(){ return param.isValidAsString(temp); } 307 virtual void setResult(){ param.setAsString(temp); } 308 protected: 309 std::string temp; 310 Parameter<Vector> ¶m; 311 }; 312 313 template <> 314 class Dialog::TQuery< std::vector<Vector> > : public Query { 315 public: 316 TQuery(Parameter< std::vector<Vector> > &_param, const std::string title, const std::string _description = "") : 317 Query(title, _description), param(_param) {} 318 virtual ~TQuery(){} 319 virtual bool handle()=0; 320 virtual bool isValid(); 321 virtual void setResult(); 322 protected: 323 std::vector<std::string> temp; 324 Parameter< std::vector<Vector> > ¶m; 325 }; 326 327 284 328 #endif /* DIALOG_HPP_ */ -
src/UIElements/GlobalListOfParameterQueries.hpp
r101d2d r78ea3c 28 28 (Molecule) \ 29 29 (Molecules) \ 30 (Vector) \31 (Vectors) \32 30 (RealSpaceMatrix) \ 33 31 (Element) \ … … 52 50 (const molecule *) \ 53 51 (std::vector<const molecule *> ) \ 54 (Vector) \55 (std::vector<Vector> ) \56 52 (RealSpaceMatrix) \ 57 53 (const element *) \ -
src/UIElements/Makefile.am
r101d2d r78ea3c 190 190 UIElements/Menu/Qt4/QtMenuPipe.cpp \ 191 191 UIElements/Views/Qt4/QtFragmentList.cpp \ 192 UIElements/Views/Qt4/QtGeometryList.cpp \ 192 193 UIElements/Views/Qt4/QtHomologyList.cpp \ 193 194 UIElements/Views/Qt4/QtInfoBox.cpp \ … … 225 226 UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp \ 226 227 UIElements/Views/Qt4/QtFragmentList.hpp \ 228 UIElements/Views/Qt4/QtGeometryList.hpp \ 227 229 UIElements/Views/Qt4/QtHomologyList.hpp \ 228 230 UIElements/Views/Qt4/QtInfoBox.hpp \ … … 308 310 libMolecuilderParser.la \ 309 311 libMolecuilderParameters.la \ 312 libMolecuilderGeometry.la \ 310 313 libMolecuilderShapes.la \ 311 314 libMolecuilderLinkedCell.la \ -
src/UIElements/Menu/MenuDescription.cpp
r101d2d r78ea3c 61 61 // put each menu into its place, "" means top level 62 62 MenuPositionMap->insert(std::make_pair("analysis",TopPosition("tools",1))); 63 MenuPositionMap->insert(std::make_pair("atom",TopPosition("edit", 1)));64 MenuPositionMap->insert(std::make_pair("bond",TopPosition("edit", 2)));63 MenuPositionMap->insert(std::make_pair("atom",TopPosition("edit",2))); 64 MenuPositionMap->insert(std::make_pair("bond",TopPosition("edit",3))); 65 65 MenuPositionMap->insert(std::make_pair("command",TopPosition("",3))); 66 66 MenuPositionMap->insert(std::make_pair("edit",TopPosition("",2))); 67 67 MenuPositionMap->insert(std::make_pair("fill",TopPosition("tools",5))); 68 68 MenuPositionMap->insert(std::make_pair("fragmentation",TopPosition("tools",3))); 69 MenuPositionMap->insert(std::make_pair("geometry",TopPosition("edit",5))); 69 70 MenuPositionMap->insert(std::make_pair("graph",TopPosition("tools",4))); 70 MenuPositionMap->insert(std::make_pair("molecule",TopPosition("edit", 3)));71 MenuPositionMap->insert(std::make_pair("molecule",TopPosition("edit",4))); 71 72 MenuPositionMap->insert(std::make_pair("potential",TopPosition("tools",7))); 72 MenuPositionMap->insert(std::make_pair("parser",TopPosition("edit", 4)));73 MenuPositionMap->insert(std::make_pair("selection",TopPosition("edit", 5)));73 MenuPositionMap->insert(std::make_pair("parser",TopPosition("edit",6))); 74 MenuPositionMap->insert(std::make_pair("selection",TopPosition("edit",1))); 74 75 MenuPositionMap->insert(std::make_pair("tesselation",TopPosition("tools",2))); 75 76 MenuPositionMap->insert(std::make_pair("shape",TopPosition("tools",6))); … … 85 86 MenuDescriptionsMap->insert(std::make_pair("fill","Fill")); 86 87 MenuDescriptionsMap->insert(std::make_pair("fragmentation","Fragmentation")); 88 MenuDescriptionsMap->insert(std::make_pair("geometry","Geometry")); 87 89 MenuDescriptionsMap->insert(std::make_pair("graph","Graph")); 88 90 MenuDescriptionsMap->insert(std::make_pair("molecule","Parse files into system")); … … 103 105 MenuNameMap->insert(std::make_pair("fill","Fill")); 104 106 MenuNameMap->insert(std::make_pair("fragmentation","Fragmentation")); 107 MenuNameMap->insert(std::make_pair("geometry","Geometry")); 105 108 MenuNameMap->insert(std::make_pair("graph","Graph")); 106 109 MenuNameMap->insert(std::make_pair("molecule","Molecules")); -
src/UIElements/Qt4/QtDialog.hpp
r101d2d r78ea3c 36 36 virtual void queryEmpty(const std::string ="", const std::string = ""); 37 37 38 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 39 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 40 38 41 /** With the following boost::preprocessor code we generate virtual function 39 42 * definitions for all desired query types in the abstract class Dialog. … … 64 67 65 68 class EmptyQtQuery; 69 70 class VectorQtQuery; 71 class VectorsQtQuery; 66 72 67 73 /** With the following boost::preprocessor code we generate forward declarations -
src/UIElements/Qt4/QtMainWindow.cpp
r101d2d r78ea3c 59 59 #include "Views/Qt4/QtHomologyList.hpp" 60 60 #include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp" 61 #include "Views/Qt4/QtGeometryList.hpp" 61 62 #include "Views/Qt4/QtLogBox.hpp" 62 63 #include "Views/Qt4/QtShapeController.hpp" … … 112 113 homologyList = new QtHomologyList(worldTab); 113 114 fragmentList = new QtFragmentList(worldTab); 115 geometryList = new QtGeometryList(worldTab); 114 116 logBox = new QtLogBox(std::cout, worldTab); 115 117 errorlogBox = new QtLogBox(std::cerr, worldTab); … … 147 149 worldTab->addTab(fragmentList, "All Fragments"); 148 150 worldTab->addTab(homologyList, "All Homologies"); 151 worldTab->addTab(geometryList, "All Geometries"); 149 152 worldTab->addTab(logBox, "Log"); 150 153 worldTab->addTab(errorlogBox, "Errors"); -
src/UIElements/Qt4/QtMainWindow.hpp
r101d2d r78ea3c 27 27 class QtElementList; 28 28 class QtFragmentList; 29 class QtGeometryList; 29 30 class QtHomologyList; 30 31 class QtLogBox; … … 60 61 QtMoleculeList *moleculeList; 61 62 QtElementList *elementList; 63 QtGeometryList *geometryList; 62 64 QtHomologyList *homologyList; 63 65 QtFragmentList *fragmentList; -
src/UIElements/Qt4/Query/QtQuery.hpp
r101d2d r78ea3c 414 414 415 415 public slots: 416 void pageChanged(int); 417 void onUpdateName(int); 416 418 void onUpdateX(double); 417 419 void onUpdateY(double); … … 424 426 QBoxLayout *subLayout; 425 427 QBoxLayout *coordLayout; 426 QLabel *coordLabel;427 428 QDoubleSpinBox *coordInputX; 428 429 QDoubleSpinBox *coordInputY; 429 430 QDoubleSpinBox *coordInputZ; 430 431 Dialog *dialog; 431 }; 432 433 class QtDialog::VectorsQtQuery : public QWidget, public QtQuery<std::vector<Vector> >, public QtQueryList<Vector> { 432 QBoxLayout *nameLayout; 433 QComboBox *nameComboBox; 434 }; 435 436 class QtDialog::VectorsQtQuery : 437 public QWidget, 438 public QtQuery<std::vector<Vector> >, 439 public QtQueryList<Vector> { 434 440 Q_OBJECT 435 441 public: -
src/UIElements/Qt4/Query/QtQueryList.hpp
r101d2d r78ea3c 100 100 std::vector<T> &tempRef; 101 101 Parameter<T> *subParam; 102 }; 103 104 template<> 105 class QtQueryList<Vector> : public QtQueryListUntyped { 106 public: 107 QtQueryList(Parameter<std::vector<Vector> > &parentParam, QBoxLayout *parent, Dialog *_dialog, std::vector<std::string> &_temp) : QtQueryListUntyped(parent, _dialog), tempRef(_temp) 108 { 109 // do we have an STLVectorValidator? 110 Validator<std::vector<Vector> > *val = &parentParam.getValidator(); 111 STLVectorValidator<std::vector<Vector> > *vector_val = NULL; 112 113 // might be hidden inside an And_Validator 114 And_Validator<std::vector<Vector> > * and_val = dynamic_cast<And_Validator<std::vector<Vector> > *>(val); 115 if (and_val){ 116 if (dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getA())) 117 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getA()); 118 else if (dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getB())) 119 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getB()); 120 }else{ 121 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(val); 122 } 123 124 if (vector_val){ 125 // if so, try to use its ElementwiseValidator 126 subParam = new Parameter<Vector>("sub-param", *(vector_val->getElementwiseValidator())); 127 }else{ 128 subParam = new Parameter<Vector>("sub-param"); 129 } 130 } 131 virtual ~QtQueryList() 132 { 133 delete(subParam); 134 } 135 136 void addElement() { 137 // add item to both 138 addElementToListWidget(subParam->getAsString()); 139 tempRef.push_back(subParam->getAsString()); 140 onUpdate(); 141 } 142 void removeElements() 143 { 144 std::vector<int> rows = getSelectedRows(); 145 removeSelectedRows(rows); 146 for (int i = rows.size() - 1; i >= 0; i --){ 147 ASSERT((size_t)(rows[i]) < tempRef.size(), "QtQueryList<Vector>::removeElements() trying to remove invalid element."); 148 tempRef.erase(tempRef.begin() + rows[i]); 149 } 150 onUpdate(); 151 } 152 protected: 153 std::vector<std::string> &tempRef; 154 Parameter<Vector> *subParam; 102 155 }; 103 156 -
src/UIElements/Qt4/Query/VectorQtQuery.cpp
r101d2d r78ea3c 37 37 #include <Qt/qcombobox.h> 38 38 #include <Qt/qlabel.h> 39 #include <Qt/qstackedwidget.h> 39 40 40 41 //#include "CodePatterns/MemDebug.hpp" … … 42 43 #include "UIElements/Qt4/Query/QtQuery.hpp" 43 44 45 #include "CodePatterns/toString.hpp" 46 47 #include "Geometry/GeometryRegistry.hpp" 48 #include "Parameters/Specifics/Value_vector.hpp" 44 49 45 50 QtDialog::VectorQtQuery::VectorQtQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description, QBoxLayout *_parent,Dialog *_dialog) : … … 48 53 dialog(_dialog) 49 54 { 50 temp = Vector(0, 0, 0); 51 if (param.isSet()) 52 temp = param.get(); 55 Vector temporary(0, 0, 0); 56 temp = "0, 0, 0"; 57 if (param.isSet()) { 58 temporary = param.get(); 59 temp = param.getAsString(); 60 } 53 61 mainLayout= new QHBoxLayout(); 54 62 titleLabel = new QLabel(QString(getTitle().c_str())); 55 63 titleLabel->setToolTip(QString(getDescription().c_str())); 56 64 mainLayout->addWidget(titleLabel); 57 subLayout = new Q VBoxLayout();65 subLayout = new QHBoxLayout(); 58 66 mainLayout->addLayout(subLayout); 59 67 // QComboBox* inputBox = new QComboBox(); 68 69 QWidget *firstPageWidget = new QWidget; 70 QWidget *secondPageWidget = new QWidget; 71 72 QStackedWidget *stackedWidget = new QStackedWidget; 73 stackedWidget->addWidget(firstPageWidget); 74 stackedWidget->addWidget(secondPageWidget); 75 76 QComboBox *pageComboBox = new QComboBox; 77 pageComboBox->addItem(tr("x,y,z")); 78 pageComboBox->addItem(tr("vector name")); 79 connect(pageComboBox, SIGNAL(activated(int)), 80 stackedWidget, SLOT(setCurrentIndex(int))); 81 connect(pageComboBox, SIGNAL(activated(int)), 82 this, SLOT(pageChanged(int))); 83 subLayout->addWidget(pageComboBox); 84 subLayout->addWidget(stackedWidget); 85 86 // first widget with coordinates 60 87 coordLayout = new QHBoxLayout(); 61 subLayout->addLayout(coordLayout);62 coordLabel = new QLabel(QString("x,y,z"));63 coordLayout->addWidget(coordLabel);64 88 coordInputX = new QDoubleSpinBox(); 65 89 coordInputX->setRange(-std::numeric_limits<double>::max(),std::numeric_limits<double>::max()); 66 coordInputX->setValue(temp [0]);90 coordInputX->setValue(temporary[0]); 67 91 // coordInputX->setRange(0,M.at(i,i)); 68 92 coordInputX->setDecimals(3); … … 70 94 coordInputY = new QDoubleSpinBox(); 71 95 coordInputY->setRange(-std::numeric_limits<double>::max(),std::numeric_limits<double>::max()); 72 coordInputY->setValue(temp [1]);96 coordInputY->setValue(temporary[1]); 73 97 // coordInputY->setRange(0,M.at(i,i)); 74 98 coordInputY->setDecimals(3); … … 76 100 coordInputZ = new QDoubleSpinBox(); 77 101 coordInputZ->setRange(-std::numeric_limits<double>::max(),std::numeric_limits<double>::max()); 78 coordInputZ->setValue(temp [2]);102 coordInputZ->setValue(temporary[2]); 79 103 // coordInputZ->setRange(0,M.at(i,i)); 80 104 coordInputZ->setDecimals(3); … … 83 107 connect(coordInputY,SIGNAL(valueChanged(double)),this,SLOT(onUpdateY(double))); 84 108 connect(coordInputZ,SIGNAL(valueChanged(double)),this,SLOT(onUpdateZ(double))); 109 firstPageWidget->setLayout(coordLayout); 110 111 // second widget with string field 112 nameLayout = new QHBoxLayout(); 113 nameComboBox = new QComboBox; 114 GeometryRegistry ® = GeometryRegistry::getInstance(); 115 // nameComboBox->setEditable(true); 116 GeometryRegistry::const_iterator iter; 117 for (iter = reg.getBeginIter(); iter != reg.getEndIter(); iter ++){ 118 GeometryObject *v = iter->second; 119 nameComboBox->addItem(tr(v->getName().c_str())); 120 nameComboBox->setItemData(nameComboBox->count()-1, tr(toString<Vector>(v->getVector()).c_str()), Qt::ToolTipRole); 121 } 122 connect(nameComboBox, SIGNAL(activated(int)), 123 this, SLOT(onUpdateName(int))); 124 nameLayout->addWidget(nameComboBox); 125 secondPageWidget->setLayout(nameLayout); 126 85 127 parent->addLayout(mainLayout); 86 128 } … … 89 131 {} 90 132 133 static void updateVectorString(std::string &_temp, const double newDouble, int component) 134 { 135 //!> Internal converter from string to internal type 136 Vector vec = Value<Vector>::parseAsVector(_temp); 137 vec[component] = newDouble; 138 _temp = Value<Vector>::setFromVector(vec); 139 } 140 141 void QtDialog::VectorQtQuery::pageChanged(int pagenr) { 142 if (pagenr == 1) { 143 // change from x,y,z input 144 onUpdateName(nameComboBox->currentIndex()); 145 dialog->update(); 146 } else if (pagenr == 0) { 147 // change from name input 148 if (GeometryRegistry::getInstance().isPresentByName(temp)) { 149 const GeometryObject * const v = GeometryRegistry::getInstance().getByName(temp); 150 coordInputX->setValue(v->getVector()[0]); 151 coordInputY->setValue(v->getVector()[1]); 152 coordInputZ->setValue(v->getVector()[2]); 153 } else { 154 coordInputX->setValue(0.); 155 coordInputY->setValue(0.); 156 coordInputZ->setValue(0.); 157 } 158 dialog->update(); 159 } else { 160 ASSERT(0, "VectorQtQuery::pageChanged() - unknown page for pageComboBox."); 161 } 162 } 163 164 void QtDialog::VectorQtQuery::onUpdateName(int index) { 165 const QString itemtext = nameComboBox->itemText(index); 166 temp = itemtext.toStdString(); 167 dialog->update(); 168 } 169 91 170 void QtDialog::VectorQtQuery::onUpdateX(double newDouble) { 92 temp[0] = newDouble;171 updateVectorString(temp, newDouble, 0); 93 172 dialog->update(); 94 173 } 95 174 96 175 void QtDialog::VectorQtQuery::onUpdateY(double newDouble) { 97 temp[1] = newDouble;176 updateVectorString(temp, newDouble, 1); 98 177 dialog->update(); 99 178 } 100 179 101 180 void QtDialog::VectorQtQuery::onUpdateZ(double newDouble) { 102 temp[2] = newDouble;181 updateVectorString(temp, newDouble, 2); 103 182 dialog->update(); 104 183 } -
src/UIElements/TextUI/Query/TextQuery.hpp
r101d2d r78ea3c 24 24 }; 25 25 26 class TextDialog::VectorTextQuery : public Dialog::TQuery<Vector> { 27 public: 28 VectorTextQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~VectorTextQuery(); 30 virtual bool handle(); 31 }; 32 33 class TextDialog::VectorsTextQuery : public Dialog::TQuery< std::vector<Vector> > { 34 public: 35 VectorsTextQuery(Parameter< std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~VectorsTextQuery(); 37 virtual bool handle(); 38 }; 26 39 27 40 /** With the following boost::preprocessor code we generate forward declarations -
src/UIElements/TextUI/Query/VectorTextQuery.cpp
r101d2d r78ea3c 83 83 84 84 // check vector 85 return World::getInstance().getDomain().isValid(temp);85 return true; 86 86 } 87 87 -
src/UIElements/TextUI/Query/VectorsTextQuery.cpp
r101d2d r78ea3c 41 41 #include "CodePatterns/Log.hpp" 42 42 #include "CodePatterns/Verbose.hpp" 43 #include "Geometry/GeometryRegistry.hpp" 43 44 #include "LinearAlgebra/Vector.hpp" 44 45 #include "LinearAlgebra/RealSpaceMatrix.hpp" … … 54 55 55 56 bool TextDialog::VectorsTextQuery::handle() { 57 std::stringstream output; 56 58 std::cout << getDescription() << std::endl; 57 59 char coords[3] = {'x', 'y', 'z'}; 58 60 const RealSpaceMatrix &M = World::getInstance().getDomain().getM(); 59 for (int i=0;i<3;i++) 60 std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: "); 61 std::cout << "Enter three comma-separated coordinates, vector name, ? for list or empty for end." << std::endl; 62 while (true) { 63 for (int i=0;i<3;i++) 64 std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: "); 61 65 62 std::string line;63 getline(std::cin,line);66 std::string line; 67 getline(std::cin,line); 64 68 65 // dissect by "," 66 double coord = 0.; 67 std::string::iterator olditerspace = line.begin(); 68 std::string::iterator olditercomma = line.begin(); 69 int counter = 0; 70 Vector temp_element; 71 for(std::string::iterator vectoriter = line.begin(); vectoriter != line.end(); ++vectoriter) { 72 if (*vectoriter == ',') 73 counter++; 74 if ((*vectoriter == ' ') && (counter == 2)) { 75 counter = 0; 76 for(std::string::iterator componentiter = olditerspace; (componentiter != vectoriter) && (counter !=3); ++componentiter) { 77 if (*componentiter == ',') { 78 std::istringstream stream(std::string(componentiter, olditercomma)); 79 stream >> coord; 80 temp_element[counter++] = coord; 81 olditercomma = componentiter; 82 } 69 if (line == "?") { 70 GeometryRegistry ® = GeometryRegistry::getInstance(); 71 72 GeometryRegistry::const_iterator iter; 73 for (iter = reg.getBeginIter(); iter != reg.getEndIter(); iter ++){ 74 GeometryObject *v = iter->second; 75 std::cout << "\t" << *v << std::endl; 83 76 } 84 if ((olditercomma != line.begin()) && (counter != 3)) { // insert last part also 85 std::istringstream stream(std::string(olditercomma, vectoriter)); 86 stream >> coord; 87 temp_element[counter++] = coord; 88 } 89 if (World::getInstance().getDomain().isValid(temp_element)) 90 temp.push_back(temp_element); 91 olditerspace = vectoriter; 77 } else if (line.empty()) { 78 break; 79 } else { 80 // simply append with white-space delimiter 81 temp.push_back(line); 92 82 } 93 83 } -
src/UIElements/TextUI/TextDialog.hpp
r101d2d r78ea3c 34 34 virtual void queryEmpty(const std::string ="", const std::string = ""); 35 35 36 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 37 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 38 36 39 /** With the following boost::preprocessor code we generate virtual function 37 40 * definitions for all desired query types in the abstract class Dialog. … … 59 62 class EmptyTextQuery; 60 63 64 class VectorTextQuery; 65 class VectorsTextQuery; 66 61 67 /** With the following boost::preprocessor code we generate forward declarations 62 68 * of query class for all desired query types in the Qt specialization class of -
src/cleanUp.cpp
r101d2d r78ea3c 54 54 #include "Fragmentation/Summation/Containers/FragmentationResultContainer.hpp" 55 55 56 #include "Geometry/GeometryRegistry.hpp" 57 56 58 #include "MoleculeObserver.hpp" 57 59 … … 95 97 // make sure that ActionQueue is already purged! 96 98 FragmentationResultContainer::purgeInstance(); 99 GeometryRegistry::purgeInstance(); 97 100 Chronos::purgeInstance(); 98 101 PotentialFactory::purgeInstance(); -
tests/GuiChecks/Makefile.am
r101d2d r78ea3c 12 12 $(srcdir)/./Fragmentation/FragmentationAutomation/testsuite-fragmentation-fragmentation-automation.at \ 13 13 $(srcdir)/./Fragmentation/AnalyseFragmentationResults/testsuite-fragmentation-analyse-fragment-results.at \ 14 $(srcdir)/./Geometry/Remove/testsuite-geometry-remove.at \ 15 $(srcdir)/./Geometry/PositionToVector/testsuite-geometry-position-to-vector.at \ 16 $(srcdir)/./Geometry/DistanceToVector/testsuite-geometry-distance-to-vector.at \ 17 $(srcdir)/./Geometry/testsuite-geometry.at \ 18 $(srcdir)/./Geometry/testsuite-geometry-common.at \ 19 $(srcdir)/./Geometry/InputToVector/testsuite-geometry-input-to-vector.at \ 20 $(srcdir)/./Geometry/PlaneToVector/testsuite-geometry-plane-to-vector.at \ 14 21 $(srcdir)/./Atoms/ChangeElement/testsuite-atoms-change-element.at \ 15 22 $(srcdir)/./Atoms/Add/testsuite-atoms-add.at \ -
tests/GuiChecks/testsuite.at
r101d2d r78ea3c 36 36 m4_include(Options/testsuite-options.at) 37 37 38 m4_include(WorldTime/testsuite-worldtime.at) 39 38 40 m4_include(Parser/testsuite-parser.at) 39 41 … … 41 43 42 44 m4_include(Bond/testsuite-bond.at) 45 46 m4_include(Geometry/testsuite-geometry.at) 43 47 44 48 m4_include(Selection/testsuite-selection.at) -
tests/Python/AllActions/options.dat
r101d2d r78ea3c 45 45 convex-envelope "50." 46 46 convex-file "convexfile" 47 coordinates "1,0,0" 47 48 copy-molecule "0" 48 49 count "12" … … 59 60 distance-to-molecule "1.5" 60 61 distance-to-molecule "2.1" 62 distance-to-vector "named_vector" 61 63 domain-position "0. 0. 0." 62 64 domain-position "0 0 0" … … 93 95 id-mapping "1" 94 96 input "test.data" 97 input-to-vector "named_vector" 95 98 inter-order "2" 96 99 interpolation-degree "5" … … 142 145 periodic "0" 143 146 plane-offset "5." 147 plane-to-vector "named_vector" 144 148 position "0 0 0" 145 149 position "0 0 1" … … 151 155 position "7.283585982 3.275186040 3.535886037" 152 156 position "9.78 2.64 2.64" 157 position-to-vector "named_vector" 153 158 potential-charges "1 1" 154 159 potential-type "morse" … … 158 163 random-number-distribution-parameters "max=20;" 159 164 random-number-engine-parameters "seed=2;" 165 remove-geometry "named_vector" 160 166 repeat-box "1 1 1" 161 167 reset 1 168 reverse "0" 162 169 rotate-around-bond "90." 163 170 rotate-around-origin "180." -
tests/regression/Makefile.am
r101d2d r78ea3c 119 119 $(srcdir)/Fragmentation/ParseSaveFragmentResults/testsuite-fragmentation-parse-save-fragment-results.at \ 120 120 $(srcdir)/Fragmentation/StoreSaturatedFragment/testsuite-fragmentation-store-saturated-fragment.at \ 121 $(srcdir)/Geometry/testsuite-geometry.at \ 122 $(srcdir)/Geometry/testsuite-geometry-common.at \ 123 $(srcdir)/Geometry/DistanceToVector/testsuite-geometry-distance-to-vector.at \ 124 $(srcdir)/Geometry/InputToVector/testsuite-geometry-input-to-vector.at \ 125 $(srcdir)/Geometry/PlaneToVector/testsuite-geometry-plane-to-vector.at \ 126 $(srcdir)/Geometry/PositionToVector/testsuite-geometry-position-to-vector.at \ 127 $(srcdir)/Geometry/Remove/testsuite-geometry-remove.at \ 121 128 $(srcdir)/Graph/testsuite-graph.at \ 122 129 $(srcdir)/Graph/CreateAdjacency/testsuite-graph-create-adjacency.at \ -
tests/regression/Options/DryRun/post/session.py
r101d2d r78ea3c 5 5 pyMoleCuilder.AtomAdd("1", "0,0,0") 6 6 pyMoleCuilder.SelectionAllAtoms() 7 pyMoleCuilder.AtomTranslate(" 0,0,0", "0")7 pyMoleCuilder.AtomTranslate("5,5,5", "0") 8 8 pyMoleCuilder.CommandNoDryRun() 9 9 # =========================== Stored Session END =========================== -
tests/regression/Options/DryRun/testsuite-options-dryrun-storesession.at
r101d2d r78ea3c 20 20 AT_SETUP([Standard Options - dry run and store session]) 21 21 AT_KEYWORDS([options dry-run no-dry-run store-session]) 22 AT_SKIP_IF([../../molecuilder --help store-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 22 23 23 24 # sample session 24 25 file="session.py" 25 AT_CHECK([../../molecuilder --dry-run --input hydrogen.xyz --add-atom 1 --domain-position "0,0,0" --select-all-atoms --translate-atoms "5,5,5" --no-dry-run --store-session $file --session-type python], 0, [ignore], [ignore])26 AT_CHECK([../../molecuilder --dry-run --input hydrogen.xyz --add-atom 1 --domain-position "0,0,0" --select-all-atoms --translate-atoms --position "5,5,5" --no-dry-run --store-session $file --session-type python], 0, [ignore], [ignore]) 26 27 AT_CHECK([test -f $file], 0, [ignore], [ignore]) 27 28 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Options/DryRun/post/$file], 0, [ignore], [ignore]) -
tests/regression/Options/Session/post/complextest.py
r101d2d r78ea3c 9 9 pyMoleCuilder.GraphSubgraphDissection() 10 10 pyMoleCuilder.SelectionMoleculeOfAtom() 11 pyMoleCuilder.FillRegularGrid("3 3 3", " 0.5,0.5,0.5", "1", "0", "0", "0", "0")11 pyMoleCuilder.FillRegularGrid("3 3 3", ".5,.5,.5", "1", "0", "0", "0", "0") 12 12 pyMoleCuilder.CommandVersion() 13 13 # =========================== Stored Session END =========================== -
tests/regression/Options/Session/pre/complextest.py
r101d2d r78ea3c 9 9 pyMoleCuilder.GraphSubgraphDissection() 10 10 pyMoleCuilder.SelectionMoleculeOfAtom() 11 pyMoleCuilder.FillRegularGrid("3 3 3", " 0.5,0.5,0.5", "1", "0", "0", "0", "0")11 pyMoleCuilder.FillRegularGrid("3 3 3", ".5,.5,.5", "1", "0", "0", "0", "0") 12 12 pyMoleCuilder.CommandVersion() 13 13 # =========================== Stored Session END =========================== -
tests/regression/testsuite.at
r101d2d r78ea3c 44 44 m4_include(Bond/testsuite-bond.at) 45 45 46 m4_include(Geometry/testsuite-geometry.at) 47 46 48 m4_include(Selection/testsuite-selection.at) 47 49
Note:
See TracChangeset
for help on using the changeset viewer.