source: doc/userguide/userguide.xml@ e7ad08

Candidate_v1.6.1 ChemicalSpaceEvaluator PythonUI_with_named_parameters TremoloParser_IncreasedPrecision
Last change on this file since e7ad08 was e7ad08, checked in by Frederik Heber <frederik.heber@…>, 7 years ago

Python interface now converts dashes in tokens to underscores, store-session used keyword arguments.

  • MoleCuilder's python functions (i.e. commands) typically have quite a number of arguments and therefore can be easily confused. We circumvent this by using keyword (or named) arguments that are also independent of position. Moreover, in that case only the non-default arguments need to be given.
  • TESTS: Marked failing python tests as XFAIL for the moment.
  • Property mode set to 100644
File size: 180.2 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
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<!ENTITY molecuilder_logo SYSTEM "pictures/molecuilder_logo.png" NDATA PNG>
4<!ENTITY dialog_box SYSTEM "pictures/dialog_box.png" NDATA PNG>
5<!ENTITY dialog_add-atom_tooltip SYSTEM "pictures/dialog_add-atom_tooltip.png" NDATA PNG>
6<!ENTITY dialog_complex SYSTEM "pictures/dialog_complex.png" NDATA PNG>
7<!ENTITY dialog_exit SYSTEM "pictures/dialog_exit.png" NDATA PNG>
8<!ENTITY example_basic_view SYSTEM "pictures/example_basic_view.png" NDATA PNG>
9]>
10<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" version="5.0">
11 <info>
12 <title>MoleCuilder - a Molecule Builder</title>
13 <author>
14 <personname>
15 <firstname>Frederik</firstname>
16 <surname>Heber</surname>
17 </personname>
18 <affiliation>
19 <orgname>heber@ins.uni-bonn.de</orgname>
20 </affiliation>
21 </author>
22 <pubdate>07/03/14</pubdate>
23 </info>
24 <chapter>
25 <title>Introduction</title>
26 <figure>
27 <title>MoleCuilder logo depicting a tesselated buckyball and a benzene molecule</title>
28 <mediaobject>
29 <imageobject>
30 <imagedata width="100%" scalefit="1" entityref="molecuilder_logo"/>
31 </imageobject>
32 </mediaobject>
33 </figure>
34 <section xml:id="whatis">
35 <title xml:id="whatis.title">What is MoleCuilder?</title>
36 <para>In Short,<command> MoleCuilder</command> is a concatenation of
37 molecule and builder.</para>
38 <para>In more words, molecular dynamics simulations are frequently
39 employed to simulate material behavior under stress, chemical reactions
40 such as of cementitious materials, or folding pathways and docking
41 procedures of bio proteins. Even if the computational load, due to the
42 large number of atoms, is very demanding, nonetheless they may serve as
43 a starting point, e.g. extracting parameters for a coarser model.
44 However, what is on the other hand the starting point of molecular
45 dynamics simulations? It is the coordinate and element of each atom
46 combined with potential functions that model the interactions.</para>
47 <para>MoleCuilder allows to fully construct such a starting point:
48 letting the user construct atomic and molecular geometries by a simple
49 point&amp;click approach, a CAD-pendant on the nanoscale. Creating
50 suitable empirical potentials by fitting parameters to ab-initio
51 calculations within hours. Specific emphasis is placed on a
52 simple-to-use interface, allowing for the quick-and-dirty building of
53 molecular systems, and on scriptability. The last being important a eventually not a single, but
54 many, related molecular systems have to be created.</para>
55 <para>We hope you will enjoy using MoleCuilder as much as we had creating
56 it and still continue extending it. It obtains its flexibility from the use of
57 agile programming techniques and state-of-the-art libraries such as Boost.
58 If you feel dissatiesfied with certain parts, please do not hesitate to give
59 feedback (see below).</para>
60 <section xml:id="installation">
61 <title xml:id="installation.title">Installation requirements</title>
62 <para>For installations requirements and instructions we refer to the
63 internal documentation of MoleCuilder, created via <productname>doxygen</productname>. from the
64 source code.</para>
65 </section>
66 <section xml:id="license">
67 <title xml:id="license.title">License</title>
68 <para>As long as no other license statement is given, MoleCuilder is
69 free for user under the GNU Public License (GPL) Version 2 (see
70 <uri>www.gnu.de/documents/gpl-2.0.de.html</uri>).</para>
71 </section>
72 <section xml:id="disclaimer">
73 <title xml:id="disclaimer.title">Disclaimer</title>
74 <para>We quote section 11 from the GPLv2 license:</para>
75 <remark>Because the program is licensed free of charge, there is not warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing in the copyright holders and/or other parties provide the program &quot;as is&quot; without warranty of any kind, either expressed or implied. Including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair, or correction.</remark>
76 </section>
77 <section xml:id="feedback">
78 <title xml:id="feedback.title">Feedback</title>
79 <para>If you encounter any bugs, errors, or would like to submit
80 feature request, please use the email address provided at the very
81 beginning of this user guide. The author is especially thankful for
82 any description of all related events prior to occurrence of the
83 error, saved &quot;session scripts&quot; (see below) and auxiliary files. Please
84 mind sensible space restrictions of email attachments.</para>
85 </section>
86 <section xml:id="notation">
87 <title xml:id="notation.title">Notation</title>
88 <para>We briefly explain a few specific wordings associated with the
89 program:</para>
90 <itemizedlist>
91 <listitem>
92 <para><emphasis>Action</emphasis> is a command that allows for
93 undoing and redoing, i.e. a single atomic procedure for
94 manipulating the molecular system. Here, atomic refers to indivisible and not to atoms. It is also referred to as a command.</para>
95 </listitem>
96 <listitem>
97 <para>Selection refers to a subsets from the set of instances of a
98 particular type, e.g. atoms, molecules, shapes, ...</para>
99 </listitem>
100 <listitem>
101 <para>Shape means a specific region of the domain that can be
102 described in the way of constructive geometry, i.e. as the
103 intersection, negation, and combination of primitives such as
104 spheres, cubes, or cylinders.</para>
105 </listitem>
106 <listitem>World refers to the whole of the molecular system, i.e. all
107 atoms with coordinates and element type (over all time steps), all
108 bonds between pairs of atoms, the size of the simulation domain.
109 This is also referred to as the state.</listitem>
110 <listitem>Time step is the current discrete position in time. Molecular
111 dynamics simulations are executed in discrete (but very small) time
112 steps. Each atom has a distinct position per time step. The discrete
113 positions over the discrete time steps samples its trajectory during a
114 simulation.</listitem>
115 </itemizedlist>
116 </section>
117 <section xml:id="completeness">
118 <title xml:id="completeness.title">Completeness</title>
119 <para>This documentation takes quite some effort to write. Hence, the
120 described features and especially the actions herein are settled with
121 respect to their functionality, while newer features or actions are
122 probably missing. This should be a clear sign to you that these are
123 probably not safe to use yet. If you nonetheless require them, you
124 should acquire some familiarity with the code itself. This suggests
125 changing to the developer documentation which is maintained along
126 with the source code with <productname>doxygen</productname>.
127 </para>
128 </section>
129 </section>
130 </chapter>
131 <chapter>
132 <title>Features</title>
133 <para>Basically, <command>MoleCuilder</command> parses geometries from
134 files, manipulates them, and stores them again in files. The manipulation
135 can be done either via a command-line interface or via the graphical user
136 interface.</para>
137 <section xml:id="concepts">
138 <title xml:id="concepts.title">Concepts</title>
139 <para>In general, we divide the molecular systems into three different
140 components or scales.</para>
141 <orderedlist>
142 <listitem>
143 <para>Atoms</para>
144 <para>Atoms are the undividable objects of the molecular systems.
145 They have at least an element <quote>Z</quote> and three coordinates
146 <quote>(x,y,z)</quote>.</para>
147 </listitem>
148 <listitem>
149 <para>Molecules</para>
150 <para>Molecules are bound conglomeration of atoms. They contain a
151 number of atoms, i.e. by beginning at an arbitrary atom of the molecule and traversing its bond graph eventually all of the molecule&apos;s atoms are visited. Currently, a bond refers to a covalent bonding between atoms. Also, molecules may have a
152 bounding box, i.e. a subdomain that contains all of the atoms in the
153 molecule.</para>
154 <para>Note that the molecular structure of the system, i.e. the
155 bonding graph, is determined by MoleCuilder and used to dissect the
156 system into distinct molecules on request.</para>
157 </listitem>
158 <listitem>
159 <para>Clusters</para>
160 <para>Clusters are unbound conglomeration of atoms. Clusters serves
161 as groups of atoms for specific operations that would be to
162 restricted if they worked on just molecules.</para>
163 </listitem>
164 <listitem>
165 <para>Domain</para>
166 <para>The domain refers to the simulation domain. It is the
167 parallelepiped in
168 <inlineequation>
169 <mml:math display="inline">
170 <mml:mrow>
171 <mml:msup>
172 <mml:mi>R</mml:mi>
173 <mml:mn>3</mml:mn>
174 </mml:msup>
175 </mml:mrow>
176 </mml:math>
177 </inlineequation>
178 where either periodic, wrapped, or open boundary
179 conditions apply. The domain contains all atoms, i.e. the box
180 containing all atoms.</para>
181 </listitem>
182 </orderedlist>
183 </section>
184 <section xml:id="interfaces">
185 <title xml:id="interfaces.title">Interfaces</title>
186 <para>MoleCuilder has four different interfaces: Command-line, text
187 menu, graphical user interface, and python interface.</para>
188 <orderedlist>
189 <listitem>
190 <para>Command-Line</para>
191 <para>The command-line interface allows to use MoleCuilder
192 non-interactively via a terminal session. The program is executed by
193appending to the shell command a number of commands including all
194 required options that are then executed one after the other. After
195 execution of the last command, the program quits. The command-line
196 interface usually works on a specific file that is given as input,
197 manipulated, analysed, ... via the sequence of commands and
198 eventually all changes are stored in the this file. Hence, the input
199 file acts as the state of the starting configuration that is
200 modified via MoleCuilder.</para>
201 </listitem>
202 <listitem>
203 <para>Text menu</para>
204 <para>The text-menu is similar to the command-line interface with
205 the exception that it allows for interactive sessions. Commands are
206 chosen from a text menu and executed directly after selection by the
207 user.</para>
208 </listitem>
209 <listitem>
210 <para>Graphical interface</para>
211 <para>The graphical interface is based on Qt. It features a full graphical, three-dimensional
212representation of the simulation domain with atoms and
213 their bonds. It allows manipulation in point&amp;click fashion.
214 Commands are selected from pull-down menus and dialogs are used to
215 query the user for all required parameters to such a command.</para>
216 </listitem>
217 <listitem>
218 <para>Python interface</para>
219 <para>The last interface is accessible only within the python
220 programming language. MoleCuilder can be loaded as a module and its
221 commands can be executed with either the python interpreter
222 interactively or via python scripts non-interactively. Note that
223 this allows auxiliary calculations to be performed in pythons whose
224 results may be used as parameters in subsequent commands.</para>
225 </listitem>
226 </orderedlist>
227 </section>
228 <section xml:id="fileformats">
229 <title xml:id="fileformats.title">Known File formats</title>
230 <para>We briefly list the file formats MoleCuilder can parse and
231 store. We refer to external websites for more detailed information where appropriate.</para>
232 <itemizedlist>
233 <listitem>
234 <para>XYZ, <filename>.xyz</filename> (simplest of all formats,
235 line-wise element and three coordinates with two line header, number
236 of lines and a comment line)</para>
237 </listitem>
238 <listitem>
239 <para><link xlink:href="http://www.mpqc.org/">
240 <productname>MPQC </productname>
241 </link>, <filename>.in</filename></para>
242 </listitem>
243 <listitem>
244 <para><link xlink:href="http://www.pdb.org/">PDB</link>, <filename> .pdb</filename></para>
245 </listitem>
246 <listitem>
247 <para><productname>ESPACK</productname>, <filename>.conf</filename>
248 (electronic structure package by Institute for Numerical Simulation,
249 University of Bonn, code not in circulation)</para>
250 </listitem>
251 <listitem>
252 <para><link xlink:href="http://www.psicode.org/">
253 <productname>PSI4 </productname>
254 </link>, <filename>.psi</filename></para>
255 </listitem>
256 <listitem>
257 <para><link xlink:href="http://www.tremolo-x.org/">
258 <productname> TREMOLO</productname>
259 </link>, <filename>.data</filename></para>
260 </listitem>
261 <listitem>
262 <para>XML, <filename>.xml</filename> (XML as read by
263 <link xlink:href="http://www.scafacos.org/">ScaFaCoS</link>
264 project)</para>
265 </listitem>
266 </itemizedlist>
267 <para>These are identified via their suffixes and can be converted from
268 one into another (with possible loss of data outside of the intersection of
269 stored properties of the two involved file formats).</para>
270 <para>Note that the various formats differ in how much information they
271 can store. This restriction may come from two sources: either the file format
272 specification does not support more or the implementation is still lacking
273 specific features.</para>
274 <para>What all formats can store at least is the element per atom and a
275 position in three spatial coordinates for a single time step.</para>
276 <para>In the following we list some restrictions:</para>
277 <itemizedlist>
278 <listitem>
279 <para>Multiple time steps supported by</para>
280 <itemizedlist>
281 <listitem>
282 <para>Pdb</para>
283 </listitem>
284 <listitem>
285 <para>Tremolo (note entries allows to change over steps are: x, u, F)</para>
286 </listitem>
287 <listitem>
288 <para>Xyz</para>
289 </listitem>
290 </itemizedlist>
291 </listitem>
292 <listitem>
293 <para>Bond information supported by</para>
294 <itemizedlist>
295 <listitem>
296 <para>Pdb</para>
297 </listitem>
298 <listitem>
299 <para>Tremolo</para>
300 </listitem>
301 </itemizedlist>
302 </listitem>
303 <listitem>
304 <para>Full atom state storable (i.e. position, velocity, and force)</para>
305 <itemizedlist>
306 <listitem>
307 <para>Tremolo</para>
308 </listitem>
309 </itemizedlist>
310 </listitem>
311 <listitem>
312 <para>Domain information (however, this is not parsed only stored)</para>
313 <itemizedlist>
314 <listitem>
315 <para>Tremolo</para>
316 </listitem>
317 </itemizedlist>
318 </listitem>
319 </itemizedlist>
320 <para>You easily notice that the <productname>Tremolo</productname> format is currently
321 the most versatile. However, by advised that you need to give a specific
322 <emphasis>ATOMINFO</emphasis> line that specifies what needs to be stored,
323 see <link linkend="various-specific.set-tremolo-atomdata">set-tremolo-atomdata</link>.</para>
324 </section>
325 </chapter>
326 <chapter>
327 <title>Interfaces</title>
328 <para>In this chapter, we explain the intention and use of the four
329 interfaces.</para>
330 <para>We will give the most extensive explanation of the command-line
331 interface, all subsequent interfaces are explained in highlighting their
332 differences with respect to the command-line interface. This is because
333 the command-line lends itself very well to representation in this textual
334 user guide. Although some images of the graphical interface are given
335 below, they would blow the size of the guide out of proportion.</para>
336 <para>In any case, you should make yourself familiar with at least one of
337 the interactive (text menu, GUI) and one of the non-interactive
338 (command-line, python) interfaces to use MoleCuilder to its full potential:
339 The interactive interface gives you the immediate feedback in constructing
340 &quot;synthesis&quot; (build) chains (of commands) for constructing your specific
341 molecular system in the computer. The non-interactive interface lends
342 itself to quick creation of related systems that differ only by specific
343 parameters you have modified in the script (command-line can be used in
344 shell scripts, python itself is a scripted language). Also, the
345 non-interactive interfaces are used for storing sessions which helps you
346 in documentation your experiments and later on understanding of what has
347 been actually created by the prescribed commands, i.e. debugging.</para>
348 <section xml:id="command-line-interface">
349 <title xml:id="command-line-interface.title">Command-line interface</title>
350 <para>The command-line interface reads options and commands from the
351 command line and executes them sequentially. This may be for example:
352 Open an empty file, add 2 hydrogen atoms and add 1 oxygen atom, recognize the bond graph, choose a
353 simulation box, fill the box with this given &quot;filler&quot; molecule, save the
354 file. This enables the use of MoleCuilder in simple script-files to
355 create a whole range of geometries that only differ in a few parameters
356 automatically.</para>
357 <para>Traditionally, <command>MoleCuilder</command> operates on a single
358 configuration file - the state - which may also store additional
359 information depending on the chosen file format such as parameters for
360 ab-initio computations. To some small extent <command>MoleCuilder</command> also allows manipulation of these paramters. An example for the above procedure is given
361 below:</para>
362 <programlisting>
363 ./molecuilder \
364 -i sample.xyz \
365 --add-atom H \
366 --domain-position &quot;0.,0.,0.&quot; \
367 ...
368 </programlisting>
369 <para>The first argument is the executable itself. Second, there is a
370 slew of arguments -- one per line split with a backslash telling the comman
371 shell that the line still continues -- consisting of the input action and
372 an arbitrarily named file <filename>sample.xyz</filename>, which may be
373 empty and whose file format is chosen by the given extension. The third
374 is the add-atom action following by an option that gives the position in
375 the domain where to add the &quot;H&quot;ydrogen atom. An action is always
376 introduced via a double hyphen and its full name (containing just
377 non-capital letters and hyphens) or a single hyphen and a single letter
378 for its shortform, such as <emphasis role="bold"> -a</emphasis> for adding an atom to the system. It is
379 followed by a fixed number of options. Most of these have default values
380 and in this do not have to be specified.</para>
381 <formalpara><title>Invalid values</title><para>Certain options accept only very specific input. For example, the option value associated with <emphasis role="bold">add-atom</emphasis></para>, i.e. the chemical element, can only be one of the chemical symbols that exist and not any arbitrary string. Each option value is checked on parsing the command-line. If any value is not valid, an error message is given and none of the actions is executed.</formalpara>
382 <formalpara>
383 <title>Shortforms of Actions</title>
384 <para>Note that not all action have shortforms and it is best practice
385 to have the full action name instead of its shortform to make the
386 command-line comprehendable to you in years to come.</para>
387 </formalpara>
388 <note>
389 <para>Note further that when placing a slew of commands in a script file
390 it is generally recommended to use the above formatting: One command
391 or option per line and each receives an extra tab for indentation.</para>
392 </note>
393 <section xml:id="preliminaries">
394 <title xml:id="preliminaries.title">Preliminaries</title>
395 <para>Some preliminary remarks are in order which we have gathered
396 here on how these actions work in general.</para>
397 <para>We first delve into some details about secondary structure
398 such as selections, shapes, and randomization required to specify
399 subsets of atoms and molecules you wish to manipulate. Then, we have
400give the details on the manipulation ordered by the
401 scale they act upon - single atoms, multiple atoms organized as
402 molecules, and all atoms organized by their containing domain.</para>
403 <para>In the following we will always give a command to illustrate the
404 procedure but just its necessary parts, i.e. &quot;...&quot; implies to prepend
405 it with the executable and input command for a specific configuration
406 file, for storing the manipulated state of the molecular system. </para>
407 <para>So if we write</para>
408 <programlisting>... --help</programlisting>
409 <para>Then we actually mean you to write</para>
410 <programlisting>./molecuilder --help</programlisting>
411 <para>Note that this specific exemplary command is very useful as it will always give you a list of all available actions and also a
412 brief explanation on how to properly enter values of a specific type,
413 e.g. an element, a vector, or a list of numbers. Details to a specific
414 action can be requested when its full name is known, e.g. for
415 &quot;add-atom&quot;,</para>
416 <programlisting>./molecuilder --help add-atom</programlisting>
417 <para>which fills you in on each option to the action: its full name,
418 its expected type, and a possibly present default value, and a brief
419 description of the option.</para>
420 <para>An Action can be undone and redone, e.g. undo adding an atom as
421 follows,</para>
422 <programlisting>... --add-atom H --domain-position &quot;0,0,0&quot; --undo</programlisting>
423 <para>and redo as follows</para>
424 <programlisting>... --add-atom H --domain-position &quot;0,0,0&quot; --undo --redo</programlisting>
425 <para>With the non-interactive interfaces this may seem rather
426 superfluous but it comes in very handy in the interactive ones. Also
427 this should tell you that actions are placed internally in a queue, i.e. a history,
428 that undo and redo manipulate.</para>
429 <para>Due to a current limitation of the implementation each command can be used on the command-line only once. Note that this <emphasis role="italic">only</emphasis> applies to the command-line interface. All other interfaces, especially all interactive ones, do not have such a restriction. For the command-line interface there are several ways to work around it. Either by splitting the whole chain of commands into several chunks, each using only unique commands and using the input file (the state) to contain and transport the intermediate stages as input for the next stage. Or to switch to other commands: often there are several possible ways of achieving a goal, especially when using selections.</para>
430 <para>Being done now with the preliminaries we now go through all available actions present in MoleCuilder.</para>
431 </section>
432 <section xml:id="fileparsers">
433 <title xml:id="fileparsers.title">File parsers</title>
434 <para>We have already given a list of all known file formats, see
435 <link linkend="fileformats">File formats</link>. Next, we explain how these
436 file formats are picked and manipulated.</para>
437 <section xml:id="fileparsers.parsing">
438 <title xml:id="fileparsers.parsing.title">Parsing files</title>
439 <para>We already discussed that the command-line interface works
440 state-based and hence you should supply it with a file to work
441 on.</para>
442 <programlisting>... --input water.data</programlisting>
443 <para>This will load all information, especially atoms with their
444 element and position, from the file <filename>water.data</filename>
445 into the state. Most importantly, all changes will eventually be stored to this file,
446 or to files with the prefix <filename>water</filename> and suffixes
447 of desired file formats, e.g. <filename>water.in</filename> if you
448 specified <productname>MPQC</productname>.</para>
449 <programlisting>... --load morewater.xyz</programlisting>
450 <para>This will load another file <filename>water.xyz</filename>,
451 however changes will still be written to files prefixed with
452 <filename>water</filename> as designated by the
453 <emphasis role="bold">input</emphasis> command. Note that now already
454 two state files will stored, <filename>water.data</filename> and
455 <filename>water.xyz</filename> as these two different file formats
456 have been used. This is the default behavior: any additional file
457 format used in loading is registered internally and the output file
458 will then be written in all registered formats on exit.</para>
459 <note>If the loaded file is empty, then no parser is registered. This
460 means if a new state file needs to be written,then the output format
461 has to be stated explicitly, e.g.
462 <programlisting>... --input hydrogen.xyz \
463 --set-output xyz \
464 --add-atom H --domain-position "0,0,0" </programlisting>
465 </note>
466 <note xml:id="various.fastparsing">
467 <para>In the case that parsing all time steps from a given input
468 file will take too long, especially for larger systems, fast parsing
469 may be activated, only the first time step is loaded, all other are
470 ignored.</para>
471 <programlisting>... --fastparsing 1</programlisting>
472 </note>
473 </section>
474 <section xml:id="fileparsers.set-output">
475 <title xml:id="fileparsers.set-output.tile">Adding output file formats</title>
476 <para>We already know that loading a file also picks a file format
477 by its suffix. We may add further file formats to which the state of
478 the molecular system is written to on program exit.</para>
479 <programlisting>... --set-output mpqc tremolo</programlisting>
480 <para>This will store the final state of the molecular systems as
481 <productname>MPQC</productname> and as
482 <productname>TREMOLO</productname> configuration file. See
483 <link linkend="fileformats">File formats</link> for the list of all file formats available.</para>
484 </section>
485 <section xml:id="fileparsers.storing">
486 <title xml:id="fileparsers.storing.title">Storing to files</title>
487 <para>Storing the current World, i.e. all its atoms, to a
488 given file, happens automaticallyon program exists if an
489 <link linkend="fileparsers.parsing">input</link> file has been
490 specified. However, this can also be forced at any point in between
491 by using one of two actions:</para>
492 <programlisting>... --output</programlisting>
493 <para>This action does not use an argument and will simply use the
494 currently registered input file and store the state of the World there
495 This is handy if an intermediate state is required (making sense for
496 interactive and python interfaces).</para>
497 <programlisting>... --output-as world.xyz</programlisting>
498 <para>This action on the other hand will be write the current state
499 to a new file "world.xyz".</para>
500 </section>
501 <section xml:id="fileparsers.save-selected-molecules">
502 <title xml:id="fileparsers.save-selected-molecules.title">Output the current molecular system</title>
503 <para>This will store all atoms contained in the currently selected
504 molecules to file. This is different to<emphasis role="bold">store-saturated-fragment</emphasis>
505 as it will not saturate dangling bonds because only whole molecules,
506 i.e. whose bond graph is connected, will be stored.</para>
507 <programlisting>... --save-selected-molecules waters.pdb
508 </programlisting>
509 </section>
510 </section>
511 <section xml:id="selections">
512 <title xml:id="selections.title">Selections and unselections</title>
513 <para>In order to tell MoleCuilder on what subset of atoms a specific
514 Action is to be performed, there are <emphasis>selection actions</emphasis>. Note that a selection per se does not change
515 anything in the state of the molecular system in any way. Essentially, it is just a filter.</para>
516 <para>Selections either work on atoms, on molecules, or on shapes
517 (this we explain later on). A given selection is maintained from the
518 execution of the selection action to the end of program or until
519 modified by another selection applied on the same type (atom,
520 molecule, shape). Selections are not stored to file (i.e. do not belong to the state).</para>
521 <para>We only give here a brief list on the available kind of selections for each of the three types they work on.
522Each action is executed either as follows, exemplified by selecting
523 all atoms.</para>
524 <programlisting>.... --select-all-atoms</programlisting>
525 <para>or, exemplified by unselecting the last molecule,</para>
526 <programlisting>... --unselect-molecule-by-order -1</programlisting>
527 <para>i.e. they are prepended by either <emphasis role="bold">select</emphasis> or <emphasis role="bold">unselect</emphasis>.</para>
528 <itemizedlist>
529 <listitem>
530 <para>Atoms</para>
531 <itemizedlist>
532 <listitem>
533 <para>All</para>
534 <programlisting>
535 ... --select-all-atoms
536 </programlisting>
537 </listitem>
538 <listitem>
539 <para>None</para>
540 <programlisting>
541 ... --unselect-all-atoms
542 </programlisting>
543 <programlisting>
544 ... --clear-atom-selection
545 </programlisting>
546 </listitem>
547 <listitem>
548 <para>Invert selection</para>
549 <programlisting>
550 ... --invert-atoms
551 </programlisting>
552 </listitem>
553 <listitem>
554 <para>By Element (all hydrogen atoms, all sulphur atoms, ...)</para>
555 <programlisting>
556 ... --select-atom-by-element 1
557 </programlisting>
558 <programlisting>
559 ... --unselect-atom-by-element 1
560 </programlisting>
561 </listitem>
562 <listitem>
563 <para>By name (atom with molecule internal name "H1", e.g.
564 this will select all "H1" atoms in every present water molecule)</para>
565 <programlisting>
566 ... --select-atom-by-name "H1"
567 </programlisting>
568 <programlisting>
569 ... --unselect-atom-by-name "H1"
570 </programlisting>
571 </listitem>
572 <listitem>
573 <para>By Id (atom with id 76)</para>
574 <programlisting>
575 ... --select-atom-by-id 76
576 </programlisting>
577 <programlisting>
578 ... --unselect-atom-by-id 76
579 </programlisting>
580 </listitem>
581 <listitem>
582 <para>By Order (the first (1), the second, ... the last
583 created(-1), the last but one)</para>
584 <programlisting>
585 ... --select-atom-by-order 1
586 </programlisting>
587 <programlisting>
588 ... --unselect-atom-by-order -2
589 </programlisting>
590 </listitem>
591 <listitem>
592 <para id="selections.select-atom-inside-volume">By Shape (all
593 atoms inside the volume specified by the currently selected
594 shape)</para>
595 <programlisting>
596 ... --select-atom-inside-volume
597 </programlisting>
598 <programlisting>
599 ... --unselect-atoms-inside-volume
600 </programlisting>
601 </listitem>
602 <listitem>
603 <para>By Molecule (all atoms belonging to currently selected
604 molecules)</para>
605 <programlisting>
606 ... --select-molecules-atoms
607 </programlisting>
608 <programlisting>
609 ... --unselect-molecules-atoms
610 </programlisting>
611 </listitem>
612 <listitem>
613 <para>Push/Pop the current selection to/from a stack to store
614 it momentarily and allow modifications in MakroActions (this is
615 very specific and used mostly internally).</para>
616 <programlisting>
617 ... --push-atom-selection
618 </programlisting>
619 <programlisting>
620 ... --pop-atom-selection
621 </programlisting>
622 </listitem>
623 </itemizedlist>
624 </listitem>
625 <listitem>
626 <para>Molecules</para>
627 <itemizedlist>
628 <listitem>
629 <para>All</para>
630 <programlisting>
631 ... --select-all-molecules
632 </programlisting>
633 </listitem>
634 <listitem>
635 <para>None</para>
636 <programlisting>
637 ... --unselect-all-molecules
638 </programlisting>
639 <programlisting>
640 ... --clear-molecule-selection
641 </programlisting>
642 </listitem>
643 <listitem>
644 <para>Invert selection</para>
645 <programlisting>
646 ... --invert-molecules
647 </programlisting>
648 </listitem>
649 <listitem>
650 <para>By Id (molecule with id 4)</para>
651 <programlisting>
652 ... --select-molecule-by-id 2
653 </programlisting>
654 <programlisting>
655 ... --unselect-molecule-by-id 2
656 </programlisting>
657 </listitem>
658 <listitem>
659 <para>By Order (first created molecule, second created
660 molecule, ...)</para>
661 <programlisting>
662 ... --select-molecule-by-order 2
663 </programlisting>
664 <programlisting>
665 ... --unselect-molecule-by-order -2
666 </programlisting>
667 </listitem>
668 <listitem>
669 <para>By Formula (molecule with H2O as formula)</para>
670 <programlisting>
671 ... --select-molecules-by-formula &quot;H2O&quot;
672 </programlisting>
673 <programlisting>
674 ... --unselect-molecules-by-formula &quot;H2O&quot;
675 </programlisting>
676 </listitem>
677 <listitem>
678 <para>By Name (all molecules named &quot;water4&quot;)</para>
679 <programlisting>
680 ... --select-molecules-by-name &quot;water4&quot;
681 </programlisting>
682 <programlisting>
683 ... --unselect-molecules-by-name &quot;water4&quot;
684 </programlisting>
685 </listitem>
686 <listitem>
687 <para>By Atom (all molecules for which at least one atom is
688 currently selected)</para>
689 <programlisting>
690 ... --select-atoms-molecules
691 </programlisting>
692 <programlisting>
693 ... --unselect-atoms-molecules
694 </programlisting>
695 </listitem>
696 <listitem>
697 <para>Push/Pop the current selection to/from a stack to store
698 it momentarily and allow modifications in MakroActions.</para>
699 <programlisting>
700 ... --push-molecule-selection
701 </programlisting>
702 <programlisting>
703 ... --pop-molecule-selection
704 </programlisting>
705 </listitem>
706 </itemizedlist>
707 </listitem>
708 <listitem>
709 <para>Shapes</para>
710 <itemizedlist>
711 <listitem>
712 <para>All</para>
713 <programlisting>
714 ... --select-all-shapes
715 </programlisting>
716 </listitem>
717 <listitem>
718 <para>None</para>
719 <programlisting>
720 ... --unselect-all-shapes
721 </programlisting>
722 </listitem>
723 <listitem>
724 <para>By Name (all shapes named &quot;sphere1&quot;)</para>
725 <programlisting>
726 ... --select-shape-by-name &quot;sphere1&quot;
727 </programlisting>
728 <programlisting>
729 ... --unselect-shape-by-name &quot;sphere1&quot;
730 </programlisting>
731 </listitem>
732 </itemizedlist>
733 </listitem>
734 </itemizedlist>
735 <remark>Note that an unselected instance (e.g. an atom) remains unselected upon further unselection and vice versa with selection.</remark>
736 <para>These above selections work then in conjunction with other
737 actions and make them very powerful, e.g. you can remove all atoms
738 inside a sphere by a selecting the spherical shape and subsequently
739 selecting all atoms inside the shape and then removing them.</para>
740 </section>
741 <section xml:id="shapes">
742 <title xml:id="shapes.title">Shapes</title>
743 <para>Shapes are specific regions of the domain. There are just a few
744 so-called <emphasis>primitive</emphasis> shapes such as cuboid,
745 sphere, cylinder, the whole domain, or none of it. However, these can be
746 combined via boolean operations such as and, or, and not. This
747 approach is called <emphasis>constructive geometry</emphasis>. E.g. by
748 combining a sphere with the negated (<emphasis role="italic">not</emphasis> operation) of a smaller sphere, we
749 obtain a spherical surface of specific thickness.</para>
750 <note>Shapes are especially useful in the QtGui where all selected
751 shapes are visualized by their translucent boundary. This makes it
752 especially easy to e.g. recognize all atoms that would be removed
753 after <link linkend="selections.select-atom-inside-volume">selecting
754 all atoms inside the volume</link> of a selected shape.</note>
755 <section xml:id="shapes.create-shape">
756 <title xml:id="shapes.create-shape.title">Creating shapes</title>
757 <para>Primitive shapes can be created as follows,</para>
758 <programlisting>
759 ... --create-shape \
760 --shape-type sphere \
761 --shape-name &quot;sphere1&quot; \
762 --stretch &quot;2,2,2&quot; \
763 --translation &quot;5,5,5&quot;
764 </programlisting>
765 <para>This will create a sphere of radius 2 (initial radius is 1)
766 with name &quot;sphere1&quot; that is centered at (5,5,5). Other primitives are
767 cuboid and cylinder, where a rotation can be specified as
768 follows.</para>
769 <programlisting><programlisting>
770 ... --create-shape \
771 --shape-type cuboid \
772 --shape-name &quot;box&quot; \
773 --stretch &quot;1,2,2&quot; \
774 --translation &quot;5,5,5&quot; \
775 --angle-x &quot;90&quot;
776 </programlisting>
777 ... --create-shape \
778 --shape-type cylinder \
779 --shape-name &quot;cylinder&quot; \
780 --stretch &quot;1,2,2&quot; \
781 --translation &quot;5,5,5&quot; \
782 --angle-y &quot;90&quot;
783 </programlisting>
784 </section>
785 <section xml:id="shapes.combine-shapes">
786 <title xml:id="shapes.combine-shapes.title">Combining shapes</title>
787 <para>Any two shapes can be combined by boolean operations as follows</para>
788 <programlisting>
789 ... --combine-shapes \
790 --shape-name &quot;combinedshape&quot; \
791 --shape-op &quot;AND&quot;
792 </programlisting>
793 <para>This will combine two currently selected shapes vis the &quot;AND&quot; operation
794 and create a new shape called &quot;combinedshape&quot;. Note that the two old shapes
795 are still present after this operation. We briefly explain each operation:
796 </para>
797 <itemizedlist>
798 <listitem>
799 <para><emphasis>AND</emphasis> combines two currently selected shapes
800 into a new shape that consists of only the volume where shapes overlap.</para>
801 </listitem>
802 <listitem>
803 <para><emphasis>OR</emphasis> combines two currently selected shapes
804 into a new shape that consists of all the volume that either shape
805 occupies.</para>
806 </listitem>
807 <listitem>
808 <para><emphasis>NOT</emphasis> creates the inverse to a currently selected
809 single shape that contains the volume with respect to the simulation domain
810 that the present one does not.</para>
811 </listitem>
812 </itemizedlist>
813 </section>
814 <section xml:id="shapes.remove-shape">
815 <title xml:id="shapes.remove-shape.title">Removing shapes</title>
816 <para>Removing a shape is as simple as removing an atom.</para>
817 <programlisting>... --remove-shape </programlisting>
818 <para>This removes all currently selected shapes.</para>
819 </section>
820 <section xml:id="shapes.manipulation">
821 <title xml:id="shapes.manipulation.title">Manipulating shapes</title>
822 <para>Shapes can be stretched, scaled, rotated, and translated to
823 modify primitives or combined primitive shapes. As you have seen
824 this manipulation could have occurred already at creation but we may also
825do it later on. As usual, we just list examples of the various manipulations
826 below, each of them works on the currently selected shapes.</para>
827 <programlisting>
828 ... --stretch-shapes &quot;1,1,2&quot; \
829 --stretch-center &quot;5,5,5&quot;
830 </programlisting>
831 <para>This stretches the shapes relative to the center at (5,5,5)
832 (default is origin) by a factor of 2 in the z direction.</para>
833 <programlisting>
834 ... --rotate-shapes \
835 --center &quot;10,2,2&quot; \
836 --angle-x 90 \
837 --angle-y 0 \
838 --angle-z 0
839 </programlisting>
840 <para>This way all selected shapes are rotated by 90 degrees around
841 the x axis with respect to the center at (10,2,2).</para>
842 <programlisting>... --translate-shapes &quot;5,0,0&quot; </programlisting>
843 <para>This translates all selected shapes by 5 along the x
844 axis.</para>
845 </section>
846 </section>
847 <section xml:id="geometry">
848 <title xml:id="geometry.title">Geometry Objects</title>
849 <para>Although we use the term geometry objects in the title, we
850 actually mean vectors, i.e. a position or direction in the
851 three-dimensional space. But maybe we have need for the more
852 general term in the future.</para>
853 <para>Vectors are required as input to many of the Actions further
854 below: translating atoms, rotating atoms around a specific axis,
855 aligning a molecule with a vector, ...</para>
856 <para>Therefore, vectors can be stored and referenced using a given
857 name. This allows for a very powerful and handy manipulation of the
858 molecular system afterwards. And to give a concrete example, let's have
859 a look at translating a set of selected atoms, see subsection on
860 <link linkend='atoms.translate-atom'>Translating atoms</link>. </para>
861 <programlisting>
862... --translate-atoms &quot;unitVectorX&quot;
863 </programlisting>
864 <para>This would use the automatically created reference
865 &quot;unitVectorX&quot;, i.e. the vector with components (1,0,0) as
866 the translation vector for the given set of atoms. In other words, all
867 selected atoms get shifted by 1 unit (e.g. Angstr&ouml;m) in +X
868 direction.</para>
869 <para>We have the following automatically created geometry objects
870 whose names are self-explanatory:</para>
871 <itemizedlist>
872 <listitem>zeroVector</listitem>
873 <listitem>unitVectorX</listitem>
874 <listitem>unitVectorY</listitem>
875 <listitem>unitVectorZ</listitem>
876 </itemizedlist>
877 <para>However, more vectors can be simply constructed from atomic
878 positions, such as the position of an atom directly, the distance between
879 two atoms (in case they are bonded, then this would be the bond vector)
880 or from three atoms, defining a plane and giving its normal vector.
881 </para>
882 <remark>We have refrained from giving automated names to vectors and even
883 keeping them up-to-date automatically, i.e. the distance between two atoms
884 O1 and O2 could be named &quot;distance_O1_O2&quot; or similar. However, we want
885 the user to have full control and maybe come up with more suitable names
886 such as &quot;rotation_axis&quot; in this case.</remark>
887 <warning>Note that names have to be unique and the Action will fail if
888 the name is already used.</warning>
889 <section xml:id="geometry.distance-to.vector">
890 <title xml:id="geometry.distance-to-vector.title">Atomic distance to stored vector</title>
891 <para>The distance between two selected atoms is stored as a vector as follows,</para>
892 <programlisting>
893 ... --distance-to-vector &quot;distance_vec&quot; \
894 --reverse 0
895 </programlisting>
896 <para>where the distance vector can be referenced by &quot;distance_vec&quot;
897 from then on in other Actions requiring a vector as input.</para>
898 <note>Since selected atoms are used in the fixed order of their ids
899 (and not in the order they were clicked at in
900 <link linkend="graphical-user-interface">QtGui</link>), the
901 direction can be inverted by giving the "reverse" option. It is
902 off (or 0) by default.</note>
903 </section>
904 <section xml:id="geometry.input-to.vector">
905 <title xml:id="geometry.input-to-vector.title">Coordinates to stored vector</title>
906 <para>We may also create a geometry vector simply by supplying the
907 three coordinates of a vector.</para>
908 <programlisting>
909 ... --input-to-vector &quot;vector&quot; \
910 --position &quot;1,2,3&quot;
911 </programlisting>
912 <para>where the vector with components (1,2,3) can be referenced
913 by &quot;vector&quot; .</para>
914 </section>
915 <section xml:id="geometry.plane-to.vector">
916 <title xml:id="geometry.plane-to-vector.title">Normal of plane to stored vector</title>
917 <para>Three positions in space (if they are not linear dependent)
918 define a plane in three-dimensional space.</para>
919 <para>Therefore, when exactly three atoms are selected, this Action
920 will construct the resulting plane and store its normal vector as a
921 geometry object for later reference.</para>
922 <programlisting>
923 ... --plane-to-vector &quot;planenormal&quot; \
924 --reverse 1
925 </programlisting>
926 <para>where the plane's normal vector can be referenced by
927 &quot;planenormal&quot;. The additional "reverse" option will invert
928 the plane's normal vector as this is ambiguous about the direction.</para>
929 </section>
930 <section xml:id="geometry.position-to.vector">
931 <title xml:id="geometry.position-to-vector.title">Atomic position to stored vector</title>
932 <para>Storing the position of a singly selected atom as a vector is simply done as follows,</para>
933 <programlisting>
934 ... --position-to-vector &quot;vector_O1&quot; \
935 </programlisting>
936 <para>where the vector can be referenced by &quot;vector_O1&quot;
937 from then on.</para>
938 </section>
939 <section xml:id="geometry.remove-geometry">
940 <title xml:id="geometry.remove-geometry.title">Remove a stored vector</title>
941 <para>Finally, a stored vector can also be removed.</para>
942 <programlisting>
943 ... --remove-geometry &quot;vector_O1&quot; \
944 </programlisting>
945 <para>this removes the stored &quot;vector_O1&quot;.</para>
946 </section>
947 </section>
948 <section xml:id="randomization">
949 <title xml:id="randomization.title">Randomization</title>
950 <para>Some operations require randomness as input, e.g. when filling a
951 domain with molecules these may be randomly translated and rotated.
952 Random values are obtained by a random number generator that consists
953 of two parts: engine and distribution. The engine yields a <emphasis role="italic">uniform</emphasis> set
954 of random numbers in a specific interval, the distribution modifies
955 them, e.g. to become gaussian.</para>
956 <para>There are several Actions to modify the specific engine and
957 distribution and their parameters. One example usage is that with the
958 aforementioned filling of the domain (see below) molecules are rotated randomly.
959 If you specify a random number generator that randomly just spills out
960 values 0,1,2,3, then the randomness is just the orientation of the
961 molecule with respect to a specific axis: x,y,z. (rotation is at most
962 360 degrees and 0,1,2,3 act as divisor, hence rotation angle will then be always
963 a multiple of 90 degrees).</para>
964 <programlisting>
965 ... --set-random-number-distribution &quot;uniform_int&quot; \
966 --random-number-distribution-parameters &quot;p=1&quot;
967 </programlisting>
968 <para>This changes the distribution to &quot;uniform_int&quot;, i.e. integer
969 numbers that are distributed uniformly.</para>
970 <programlisting>
971 ... --set-random-number-engine &quot;mt19937&quot; \
972 --random-numner-engine-parameters &quot;seed=10&quot;
973 </programlisting>
974 <para>Specifying the seed allows you to obtain the same sequence of
975 random numbers for testing purposes.</para>
976 <para>Moreover, actions such as
977 <link linkend="atoms.random-perturbation">random perturbation</link>
978 of atoms and <link linkend="filling">filling</link> of molecules into the
979 domain use the random number generator.</para>
980 </section>
981 <section xml:id="atoms">
982 <title xml:id="atoms.title">Manipulate atoms</title>
983 <para>Here, we explain in detail how to add, remove atoms, change its
984 element type, scale the bond in between or measure the bond length or
985 angle.</para>
986 <section xml:id="atoms.add-atom">
987 <title xml:id="atoms.add-atom.title">Adding atoms</title>
988 <para>Adding an atom to the domain requires the element of the atom
989 and its coordinates as follows,</para>
990 <programlisting>
991 ... --add-atom O \
992 --domain-position &quot;2.,3.,2.35&quot;
993 </programlisting>
994 <para>where the element is given via its chemical symbol and the
995 vector gives the position within the domain</para>
996 <para>Note that instead of giving an explicit vector you may also use
997 a vector stored as a geometry object, see section
998 <link linkend='geometry'>Geometry</link>.</para>
999 </section>
1000 <section xml:id="atoms.random-perturbation">
1001 <title xml:id="atoms.random-perturbation.title">Randomly perturb atoms</title>
1002 <para>The positions of a set of selected atom(s) can be randomly
1003 perturbed by giving a maximum noise level..</para>
1004 <programlisting>... --random-number-distribution "uniform_01" \
1005 --random-perturbation 0.1</programlisting>
1006 <para>This will perturb all atomic positions by adding a vector
1007 with components chosen randomly from the interval [-level, level].</para>
1008 <para>Note that the manner these random numbers are picked depends
1009 on the current random number distribution (and also on the engine),
1010 see <link linkend='randomization'>Randomization</link>. The default
1011 one will not give good results, therefore the example uses the
1012 uniform_01 distribution</para>
1013 </section>
1014 <section xml:id="atoms.remove-atom">
1015 <title xml:id="atoms.remove-atom.title">Removing atoms</title>
1016 <para>Removing atom(s) does not need any option and operates on the
1017 currently selected ones.</para>
1018 <programlisting>... --remove-atom</programlisting>
1019 </section>
1020 <section xml:id="atoms.saturate-atom">
1021 <title xml:id="atoms.saturate-atom.title">Saturating atoms</title>
1022 <para>Newly instantiated atoms have no bonds to any other atom. If
1023 you want to fill up their valence by a slew of hydrogen atoms
1024 residing on a sphere around this atom, use this action.</para>
1025 <programlisting>
1026 ... --saturate-atoms
1027 </programlisting>
1028 <para>A number of hydrogen atoms is added around each selected atom
1029 corresponding to the valence of the chemical element. The hydrogen
1030 atoms are placed at the same distance to the selected atom which is
1031 taken from an internal database for the typical hydrogen bond length
1032 and approximately with same distance to their nearest neighbor
1033 hydrogens. Already present bonds (i.e. the position of neighboring
1034 atoms) are taken into account and left intact.</para>
1035 </section>
1036 <section xml:id="atoms.translate-atom">
1037 <title xml:id="atoms.translate-atom.title">Translating atoms</title>
1038 <para>In order to translate the current selected subset of atoms you
1039have to specify a translation vector.</para>
1040 <programlisting>
1041 ... --translate-atoms &quot;-1,0,0&quot; \
1042 --periodic 0
1043 </programlisting>
1044 <para>This translates all atoms by &quot;-1&quot; along the x axis and does not
1045 mind the boundary conditions, i.e. it might shift atoms outside of the
1046 domain.</para>
1047 <para>Again, note that instead of giving an explicit vector you may
1048 also use a vector stored as a geometry object, see section
1049 <link linkend='geometry'>Geometry</link>.</para>
1050 </section>
1051 <section xml:id="atoms.mirror-atoms">
1052 <title xml:id="atoms.mirror-atoms.title">Mirroring atoms</title>
1053 <para>Present (and selected) atoms can be mirrored with respect to
1054 a certain plane. You have to specify the normal vector of the plane
1055 and the offset with respect to the origin as follows</para>
1056 <programlisting>
1057 ... --mirror-atoms &quot;1,0,0&quot; \
1058 --plane-offset 10.1 \
1059 --periodic 0
1060 </programlisting>
1061 <para>And of course instead of giving an explicit vector you may also
1062 use a vector stored as a geometry object, see section
1063 <link linkend='geometry'>Geometry</link>.</para>
1064 </section>
1065 <section xml:id="atoms.translate-to-origin">
1066 <title xml:id="atoms.translate-to-origin.title">Translating atoms to origin</title>
1067 <para>The following Action is convenient to place a subset of atoms
1068 at a known position, the origin, and then translate them to some other
1069 absolute coordinate. It calculates the average position of the set
1070 of selected atoms and then translates all atoms by the negative of
1071 this center, i.e. the center over all selected atoms is afterwards at the origin.</para>
1072 <programlisting>... --translate-to-origin</programlisting>
1073 <para>Note that this naturally does not heed the boundary conditions of the simulation domain.</para>
1074 </section>
1075 <section xml:id="atoms.change-element">
1076 <title xml:id="atoms.change-element.title">Changing an atoms element </title>
1077 <para>You can easily turn lead or silver into gold, by selecting the
1078 silver atom and calling the change element action.</para>
1079 <programlisting>... --change-element Au</programlisting>
1080 </section>
1081 </section>
1082 <section xml:id="bond">
1083 <title xml:id="bond.title">Bond-related manipulation</title>
1084 <para>Atoms can also be manipulated with respect to the bonds.
1085 <remark>Note that with bonds we always mean covalent bonds.</remark> First, we explain how to modify the bond structure itself, then we go
1086 in the details of using the bond information to change bond distance
1087 and angles.</para>
1088 <section xml:id="bond.create-adjacency">
1089 <title xml:id="bond.create-adjacency.title">Creating a bond graph </title>
1090 <para>In case you have loaded a configuration file with no bond
1091 information, e.g. XYZ, it is necessary to create the bond graph.
1092 This is done by either of two options, based on a heuristic criterion.</para>
1093 <para>By default it is based on van-der-Waals radii,
1094 i.e. if we look at two atoms indexed by &quot;a&quot; and &quot;b&quot;</para>
1095 <equation>
1096 <title></title>
1097 <mml:math display="block">
1098 <mml:mrow>
1099 <mml:mi>V(a) + V(b) - &tau; &lt;</mml:mi>
1100 <mml:msub>
1101 <mml:mi>R</mml:mi>
1102 <mml:mn>ab</mml:mn>
1103 </mml:msub>
1104 <mml:mi>&lt; V(a) + V(b) + &tau;</mml:mi>
1105 </mml:mrow>
1106 </mml:math>
1107 </equation>
1108 where
1109 <inlineequation>
1110 <mml:math display="inline">
1111 <mml:mrow>
1112 <mml:mi>V(.)</mml:mi>
1113 </mml:mrow>
1114 </mml:math>
1115 </inlineequation>
1116 is the lookup table for the radii for a given element and \tau is a threshold value, set to 0.4.
1117 <para>As a alternative option, you may load a file containing bond table
1118 information.</para>
1119 <programlisting>... --bond-table table.dat</programlisting>
1120 <para>which would parse a file <filename>table.dat</filename> for a
1121 table giving typical bond distances between elements a and b. These
1122 are used in the above criterion as
1123 <inlineequation>
1124 <mml:math display="inline">
1125 <mml:mrow>
1126 <mml:mi>V(a,b)</mml:mi>
1127 </mml:mrow>
1128 </mml:math>
1129 </inlineequation>
1130 in place of
1131 <inlineequation>
1132 <mml:math display="inline">
1133 <mml:mrow>
1134 <mml:mi>V(a) + V(b)</mml:mi>
1135 </mml:mrow>
1136 </mml:math>
1137 </inlineequation>
1138 .</para>
1139 <para>In either case,</para>
1140 <programlisting>... --create-adjacency</programlisting>
1141 <para> will then create the bond graph based on above criterion.</para>
1142 </section>
1143 <section xml:id="bond.destroy-adjacency">
1144 <title xml:id="bond.destroy-adjacency.title">Destroying the bond graph</title>
1145 <para>The bond graph can be removed completely (and all bonds along
1146 with it).</para>
1147 <programlisting>... --destroy-adjacency</programlisting>
1148 </section>
1149 <section xml:id="bond.correct-bonddegree">
1150 <title xml:id="bond.correct-bonddegree.title">Correcting bond degrees</title>
1151 <para>Typically, after loading an input file with bond information, e.g.
1152 a PDB file, the bond graph is complete but we lack the weights. That
1153 is we do not know whether a bond is single, double, triple, ...
1154 This action corrects the bond degree by enforcing charge neutrality
1155 among the connected atoms.
1156 </para>
1157 <para>This action is in fact quadratically scaling in the number of
1158 atoms. Hence, for large systems this may take longer than expected.
1159 </para>
1160 <programlisting>... --correct-bonddegree</programlisting>
1161 <para>However, in normal use scenarios the action is fast and linear scaling.</para>
1162 </section>
1163 <section xml:id="bond.depth-first-search">
1164 <title xml:id="bond.depth-first-search.title">Analysing a bond graph</title>
1165 <para>You can perform a depth-first search analysis that reveals
1166 cycles and other graph-related information.</para>
1167 <programlisting>... --depth-first-search</programlisting>
1168 <para>Note that this will only print some information and has no other impact on the state.</para>
1169 </section>
1170 <section xml:id="bond.subgraph-dissection">
1171 <title xml:id="bond.subgraph-dissection.title">Dissecting the molecular system into molecules</title>
1172 <para>The bond graph information can be used to recognize the
1173 molecules within the system. It removes the current bond graph (if
1174 any bonds are presents) and recreates it. Afterwards it walks it along
1175 and finds any disconnected subgraphs, associating a molecule with
1176 each. Note that this is just structural information and does not
1177 change the state of the system.</para>
1178 <programlisting>... --subgraph-dissection</programlisting>
1179 </section>
1180 <section xml:id="bond.update-molecules">
1181 <title xml:id="bond.update-molecules.title">Updating molecule structure</title>
1182 <para>When the bond information has changed, new molecules might
1183 have formed, this action updates all the molecules by scanning
1184 the connectedness of the bond graph of the molecular system. </para>
1185 <para>Moreover, Imagine you have just loaded a PDB file
1186 containing bond information. However, initially all atoms are dumped
1187 into the same molecule. Before you can start manipulating, you need
1188 to dissect the system into individual molecules.
1189 </para>
1190 <programlisting>... --update-molecules</programlisting>
1191 </section>
1192 <section xml:id="bond.adds-bond">
1193 <title xml:id="bond.adds-bond.title">Adding a bond manually</title>
1194 <para>When the automatically created adjacency or bond graph
1195 contains faulty bonds or lacks some, you can add them manually.
1196 </para>
1197 <programlisting>... --add-bonds</programlisting>
1198 <para>If two atoms are selected, the single bond in between is added, if not
1199already present. If more than two atoms are selected, than the
1200 bond between any pair of these is added.</para>
1201 <note>
1202 <para>This is especially useful in conjunction with the
1203 fragmentation scheme (explained later on). If you want to know the contribution from
1204 certain fragments whose subgraph is not connected, you can simply
1205 make the associated subset of atoms connected by selecting all
1206 bonds and adding the bonds.</para>
1207 </note>
1208 </section>
1209 <section xml:id="bond.remove-bonds">
1210 <title xml:id="bond.remove-bonds.title">Removing a bond manually </title>
1211 <para>In much the same way as adding a bond, you can also remove a
1212 bond.</para>
1213 <programlisting>... --remove-bonds</programlisting>
1214 <para>Similarly, if more than two atoms are selected, then all bonds
1215 found between any pair of these is removed.</para>
1216 </section>
1217 <section xml:id="bond.set-bond-degree">
1218 <title xml:id="bond.set-bond-degree.title">Setting the bond degree manually </title>
1219 <para>The bond degrees are usually automatically set to fulfill the
1220 valency constraints of each bond partner. However, degrees can also be
1221 set manually for a set of selected atoms. Note that the degree is set
1222 to the given value for all bonds in between any pair of atoms within
1223 the set.</para>
1224 <programlisting>... --set-bond-degree 2</programlisting>
1225 <para>Similarly, if more than two atoms are selected, then all bonds
1226 found between any pair of these are modified.</para>
1227 </section>
1228 <section xml:id="bond.save-bonds">
1229 <title xml:id="bond.save-bonds.title">Saving bond information </title>
1230 <para>Bond information can be saved to a file in
1231 <productname>TREMOLO </productname>&apos;s dbond style.</para>
1232 <programlisting>... --save-bonds system.dbonds</programlisting>
1233 <para>Similarly is the following Action which saves the bond
1234 information as a simple list of one atomic id per line and in
1235 the same line, separated by spaces, the ids of all atoms connected
1236 to it.</para>
1237 <programlisting>... --save-adjacency system.adj</programlisting>
1238 <para>This corresponds to the <emphasis role="bold">bond-file</emphasis> Action.</para>
1239 </section>
1240 <section xml:id="fileparsers.bond-file">
1241 <title xml:id="fileparsers.bond-file.title">Load extra bond information</title>
1242 <para>The reverse Action of <emphasis role="bold">save-bonds</emphasis> is the following which loads bond information from the file <emphasis role="bold">water.dbond</emphasis>.</para>
1243 <programlisting>... --bond-file water.dbond</programlisting>
1244 <para>Note that because of the use of ids the bond file is intimately connected to the associated input file containing the atomic coordinates and thus both should parsed right after another and to the very beginning of any sequence of Actions.</para>
1245 </section>
1246 <section xml:id="bond.stretch-bond">
1247 <title xml:id="bond.stretch-bond.title">Stretching a bond</title>
1248 <para>Stretching a bond actually refers to translation of the
1249 associated pair of atoms. However, this action will keep the rest of
1250 the molecule to which both atoms belong to invariant as well.</para>
1251 <programlisting>... --stretch-bond 1.2</programlisting>
1252 <para>This scales the original bond distance to the new bond
1253 distance 1.2, shifting the right hand side and the left hand side of
1254 the molecule accordingly.</para>
1255 <warning>
1256 <para>this fails with aromatic rings (but you can always
1257 undo).</para>
1258 </warning>
1259 </section>
1260 <section xml:id="bond.change-bond-angle">
1261 <title xml:id="bond.change-bond-angle.title">Changing a bond angle </title>
1262 <para>In the same way as stretching a bond, you can change the angle
1263 in between two bonds. This works if exactly three atoms are selected
1264 and two pairs are bonded.</para>
1265 <programlisting>... --change-bond-angle 90</programlisting>
1266 <para>This will change the angle from its value to 90 degrees by
1267 translating the two outer atoms of this triangle (the atom connected
1268 to both other atoms serves as rotation joint).</para>
1269 </section>
1270 </section>
1271 <section xml:id="molecule">
1272 <title xml:id="molecule.title">Manipulate molecules</title>
1273 <para>Molecules are agglomerations of atoms that are (covalently) bonded. Hence,
1274 the Actions working on molecules differ from those working on atoms.
1275 Joining two molecules can only be accomplished by adding a bond in
1276 between, and in the reverse fashion splitting a molecule by removing
1277some or even all bonds in between. The Actions below mostly deal with copying
1278 molecules. Removing of molecules is done via selecting the molecule&apos;s
1279 atoms and removing them, which removes the atoms as well.</para>
1280 <note>
1281 <para>Initially when you load a file via the input action all atoms
1282 are placed in a single molecule despite any present bond
1283 information, see <link linkend="fragmentation">Dissecting the molecular system into molecules</link></para>
1284 </note>
1285 <section xml:id="molecule.copy">
1286 <title xml:id="molecule.copy.title">Copy molecules</title>
1287 <para>A basic operation is to duplicate a molecule. This works on a
1288 single, currently selected molecule. Afterwards, we elaborate on a
1289 more complex manner of copying, filling a specific shape with
1290 molecules.</para>
1291 <programlisting>
1292 ... --copy-molecule \
1293 --position &quot;10,10,10&quot;
1294 </programlisting>
1295 <para>This action copies the selected molecule and inserts it at the
1296 position (10,10,10) in the domain with respect to the molecule&apos;s
1297 center. In effect, it copies all the atoms of the original molecule
1298 and adds new bonds in between these copied atoms such that their
1299 bond subgraphs are identical.</para>
1300 <para>Here, instead of giving an explicit vector you may also use
1301 a vector stored as a geometry object, see section
1302 <link linkend='geometry'>Geometry</link>.</para>
1303 </section>
1304 <section xml:id="molecule.change-molname">
1305 <title xml:id="molecule.change-molname.title">Change a molecules name</title>
1306 <para>You can change the name of a molecule which is important for
1307 selection.</para>
1308 <programlisting>... -change-molname &quot;test</programlisting>
1309 <para>This will change the name of the (only) selected molecule to
1310 &quot;test&quot;.</para>
1311 <para>Connected with this is the default name an unknown molecule
1312 gets.</para>
1313 <programlisting>... --default-molname test</programlisting>
1314 <para>This will change the default name of new molecules to
1315 &quot;test&quot;.</para>
1316 <note>
1317 <para>Note that a molecule loaded from file gets the filename
1318 (without suffix) as its name.</para>
1319 </note>
1320 </section>
1321 <section xml:id="molecule.remove-molecule">
1322 <title xml:id="molecule.remove-molecule.title">Remove molecules </title>
1323 <para>This removes one or multiple selected molecules.</para>
1324 <programlisting>... -remove-molecule</programlisting>
1325 <para>This essentially just removes all of the molecules&apos; atoms
1326 which in turn also causes the removal of the molecule.</para>
1327 </section>
1328 <section xml:id="molecule.translate-molecules">
1329 <title xml:id="molecule.translate-molecules.title">Translate molecules </title>
1330 <para>This translates one or multiple selected molecules by a
1331 specific offset..</para>
1332 <programlisting>... -translate-molecules</programlisting>
1333 <para>As before, this is actually just an operation on all of the
1334 molecule&apos;s atoms, namely translating them.</para>
1335 <para>Same as with <link linkend='atoms.translate-atom'>translate-atoms</link>
1336 instead of giving an explicit vector you may also use a vector stored
1337 as a geometry object, see section
1338 <link linkend='geometry'>Geometry</link>.</para>
1339 </section>
1340 <section xml:id="molecule.rotate-around-bond">
1341 <title xml:id="molecule.rotate-around-bond.title">Rotate around bond </title>
1342 <para>This rotates parts of a molecule around a given bond, i.e. the
1343 bond vector becomes the rotation axis but only atoms on the side of
1344 second atom get rotated. This naturally does not work for bonds in a
1345 cycle.</para>
1346 <programlisting>
1347 ... --rotate-around-bond &quot;90&quot; \
1348 --bond-side 0
1349 </programlisting>
1350 </section>
1351 <section xml:id="molecule.rotate-around-self">
1352 <title xml:id="molecule.rotate-around-self.title">Rotate around self </title>
1353 <para>You can rotate a molecule around its own axis.</para>
1354 <programlisting>
1355 ... --rotate-around-self &quot;90&quot; \
1356 --axis &quot;0,0,1&quot;
1357 </programlisting>
1358 <para>This rotates the molecule around the z axis by 90 degrees as
1359 if the origin were at its wn center of origin.</para>
1360 </section>
1361 <section xml:id="molecule.rotate-around-origin">
1362 <title xml:id="molecule.rotate-around-origin.title">Rotate around origin</title>
1363 <para>In the same manner the molecule can be rotated around an
1364 external origin.</para>
1365 <programlisting>
1366 ... --rotate-around-origin 90 \
1367 --position &quot;0,0,1&quot;\
1368 </programlisting>
1369 <para>This rotates the molecule around an axis from the origin to
1370 the position (0,0,1), i.e. around the z axis, by 90 degrees, where
1371 for the position you may also use a stored vector, see section
1372 <link linkend='geometry'>Geometry</link>.</para>
1373 </section>
1374 <section xml:id="molecule.rotate-to-principal-axis-system">
1375 <title xml:id="molecule.rotate-to-principal-axis-system.title"> Rotate to principal axis system</title>
1376 <para>The principal axis system is given by an ellipsoid that mostly
1377 matches the molecules shape. The principal axis system can be
1378 simply determined by</para>
1379 <programlisting>... --principal-axis-system</programlisting>
1380 <para>To rotate the molecule around itself to align with this system
1381 do as follows</para>
1382 <programlisting>... --rotate-to-principal-axis-system &quot;0,0,1&quot;
1383 </programlisting>
1384 <para>This rotates the molecule in such a manner that the ellipsoids
1385 largest axis is aligned with the z axis. <remark>Note that
1386 &quot;0,0,-1&quot; would align anti-parallel.</remark></para>
1387 <para>Again instead of giving the coordinates explicitly you may also
1388 use a vector stored as a geometry object, see section
1389 <link linkend='geometry'>Geometry</link>.</para>
1390 </section>
1391 <section xml:id="molecule.verlet-integration">
1392 <title xml:id="molecule.verlet-integration.title">Perform verlet integration</title>
1393 <para>Atoms not only have a position, but each instance also stores
1394 velocity and a force vector. These can be used in a velocity verlet
1395 integration step. Velocity verlet is an often employed time
1396 integration algorithm in molecular dynamics simulations.</para>
1397 <programlisting>
1398 ... --verlet-integration \
1399 --deltat 0.1 \
1400 --keep-fixed-CenterOfMass 0
1401 </programlisting>
1402 <para>This will integrate with a timestep of
1403 <inlineequation>
1404 <mml:math display="inline">
1405 <mml:mrow>
1406 <mml:mi>
1407 <mml:msub>
1408 <mml:mi>&Delta;</mml:mi>
1409 <mml:mn>t</mml:mn>
1410 </mml:msub>
1411 <mml:mi>= V(a) + V(b)</mml:mi>
1412 </mml:mi>
1413 </mml:mrow>
1414 </mml:math>
1415 </inlineequation>
1416 and correcting forces and velocities such that
1417 the sum over all atoms is zero.</para>
1418 <note>Although it may be useful in rare cases to use this Action
1419 directly, most of the time it is far more convenient to use the
1420 MakroAction <link linkend="dynamics.molecular-dynamics">molecular-dynamics</link>
1421 which incorporates also the force calculation and allows for time
1422 integration over more than just a single time step.</note>
1423 </section>
1424 <section xml:id="molecule.force-annealing">
1425 <title xml:id="molecule.force-annealing.title">Anneal the atomic forces</title>
1426 <para>This will shift the atoms in a such a way as to decrease (or
1427 anneal) the forces acting upon them.</para>
1428 <para>Forces may either be already present for the set of atoms by
1429 some other way (e.g. from a prior fragmentation calculation) or,
1430 as shown here, loaded from an external file. We anneal the forces for
1431 one step with a certain initial step width of 0.5 atomic time
1432 units and do not create a new timestep for each optimization
1433 step.</para>
1434 <programlisting>... --force-annealing \
1435 --forces-file test.forces \
1436 --deltat 0.5 \
1437 --steps 1 \
1438 --output-every-step 0
1439 </programlisting>
1440 <note>Same as before, although in rare useful, we refer to the
1441 MakroAction <link linkend="dynamics.optimize-structure">optimize-structure</link>
1442 which incorporates also the force calculation and allows for
1443 structure optimization over more than just a single step.</note>
1444 </section>
1445 <section xml:id="molecule.linear-interpolation-of-trajectories">
1446 <title xml:id="molecule.linear-interpolation-of-trajectories.title"> Linear interpolation between configurations</title>
1447 <para>This is similar to verlet integration, only that it performs
1448 a linear integration irrespective of the acting atomic forces.
1449 </para>
1450 <para>The following call will produce an interpolation between the
1451 configurations in time step 0 and time step 1 with 98 intermediate
1452 steps, i.e. current step 1 will end up in time step 99. In this
1453 case an identity mapping is used to associated atoms in start and
1454 end configuration.</para>
1455 <programlisting>... --linear-interpolation-of-trajectories \
1456 --start-step 0 \
1457 --end-step 1 \
1458 --interpolation-steps 100 \
1459 --id-mapping 1
1460 </programlisting>
1461 </section>
1462 </section>
1463 <section xml:id="domain">
1464 <title xml:id="domain.title">Manipulate domain</title>
1465 <para>Here, we elaborate on how to duplicate all the atoms inside the
1466 domain, how to scale the coordinate system, how to center the atoms
1467 with respect to certain points, how to realign them by given
1468 constraints, how to mirror and most importantly how to specify the
1469 domain.</para>
1470 <section xml:id="domain.change-box">
1471 <title xml:id="domain.change-box.title">Changing the domain</title>
1472 <para>The domain is specified by a symmetric 3x3 matrix. The
1473 eigenvalues (diagonal entries in case of a diagonal matrix) give the
1474 length of the edges, additional entries specify transformations of
1475 the box such that it becomes a more general parallelepiped.</para>
1476 <programlisting>... change-box &quot;20,0,20,0,0,20&quot;</programlisting>
1477 <para>As the domain matrix is symmetric, six values suffice to fully
1478 specify it. We have to give the six components of the lower triangle matrix. Here, we change the box to a cuboid of equal edge length of
1479 20.<warning>
1480 <para>In case of the python interface an upper triangle matrix is given. Hence, the above would read &quot;20,0,0,20,0,20&quot;.</para>
1481 </warning></para>
1482 </section>
1483 <section xml:id="domain.bound-in-box">
1484 <title xml:id="domain.bound-in-box.title">Bound atoms inside box </title>
1485 <para>The following applies the current boundary conditions to the
1486 atoms. In case of periodic or wrapped boundary conditions the atoms
1487 will be periodically translated to be inside the domain
1488 again.</para>
1489 <programlisting>... --bound-in-box</programlisting>
1490 </section>
1491 <section xml:id="domain.center-in-box">
1492 <title xml:id="domain.center-in-box.title">Center atoms inside the domain</title>
1493 <para>This is a combination of changing the box and bounding the
1494 atoms inside it.</para>
1495 <programlisting>... --center-in-box &quot;20,0,20,0,0,20&quot;</programlisting>
1496 </section>
1497 <section xml:id="domain.center-edge">
1498 <title xml:id="domain.center-edge.title">Center the atoms at an edge</title>
1499 <para>MoleCuilder can calculate the minimum box (parallel to the
1500 cardinal axis) all atoms would fit in and translate all atoms in
1501 such a way that the lower, left, front edge of this minimum is at
1502 the origin (0,0,0).</para>
1503 <programlisting>... --center-edge</programlisting>
1504 </section>
1505 <section xml:id="domain.add-empty-boundary">
1506 <title xml:id="domain.add-empty-boundary.title">Extending the boundary by adding an empty boundary</title>
1507 <para>In the same manner as above a minimum box is determined that
1508 is subsequently expanded by a boundary of the given additional
1509 thickness. This applies to either side, i.e. left and right, top and bottom, front and back.</para>
1510 <programlisting>... --add-empty-boundary &quot;5,5,5&quot;</programlisting>
1511 <para>This will enlarge the box in such a way that every atom is at
1512 least by a distance of 5 away from the boundary of the domain (in
1513 the infinity norm).</para>
1514 </section>
1515 <section xml:id="domain.scale-box">
1516 <title xml:id="domain.scale-box.title">Scaling the box</title>
1517 <para>You can enlarge the domain by simple scaling factors.</para>
1518 <programlisting>... --scale-box &quot;1,1,2.5&quot;</programlisting>
1519 <para>Here, the domain is stretched in the z direction by a factor
1520 of 2.5. Also, all positions are scaled by the same factor.</para>
1521 </section>
1522 <section xml:id="domain.repeat-box">
1523 <title xml:id="domain.repeat-box.title">Repeating the box</title>
1524 <para>Under periodic boundary conditions often only the minimal
1525 periodic cell is stored. E.g. for a crystallic system this minimal cell is all that&apos;s needed to completely specify a larger body. If need be, multiple images can be easily
1526 added to the current state of the system by repeating the box, i.e.
1527 the box along with all contained atoms is copied and placed
1528 adjacently.</para>
1529 <programlisting>... --repeat-box &quot;1,2,2&quot;</programlisting>
1530 <para>This will create a 2x2 grid of the current domain, replicating
1531 it along the y and z direction along with all atoms. If the domain
1532 contained before a single water molecule, we will now have four of
1533 them.</para>
1534 </section>
1535 <section xml:id="domain.set-boundary-conditions">
1536 <title xml:id="domain.set-boundary-conditions.title">Change the boundary conditions</title>
1537 <para>Various boundary conditions can be applied that affect how
1538 certain Actions work, e.g. translate-atoms. We briefly give a list
1539 of all possible conditions:</para>
1540 <itemizedlist>
1541 <listitem>
1542 <para>Wrap</para>
1543 <para>Coordinates are wrapped to the other side of the domain,
1544 i.e. periodic boundary conditions.</para>
1545 </listitem>
1546 <listitem>
1547 <para>Bounce</para>
1548 <para>Coordinates are bounced back into the domain, i.e. they
1549 are reflected from the domain walls.</para>
1550 </listitem>
1551 <listitem>
1552 <para>Ignore</para>
1553 <para>No boundary conditions apply.</para>
1554 </listitem>
1555 </itemizedlist>
1556 <para>The following will set the boundary conditions to periodic.
1557 </para>
1558 <programlisting>... --set-boundary-conditions &quot;Wrap Wrap Wrap&quot;</programlisting>
1559 <para>Note that boundary conditions are not enforced unless explicitly requested, e.g. by the <emphasis role="bold">bound-in-box</emphasis> action</para>
1560 </section>
1561 </section>
1562 <section xml:id="filling">
1563 <title xml:id="filling.title">Filling</title>
1564 <para>Filling a specific part of the domain with one type of
1565 molecule, e.g. a water molecule, is the more advanced type of
1566 copying of a molecule (see <emphasis role="bold">copy-molecule</emphasis>) and for this we need several
1567 ingredients.</para>
1568 <para>First, we need to specify the part of the domain. This is done
1569 via a shape. We have already learned how to create and select
1570 shapes. The currently selected shape will serve as the fill-in
1571 region.</para>
1572 <para>Then, there are three types of filling: domain, volume, and
1573 surface. The domain is filled with a regular grid of fill-in points.
1574 A volume and a surface are filled by a set of equidistant points
1575 distributed within the volume or on the surface of a selected
1576 shape. The latter is closed connected to the respective shape selected. Molecules will then be copied and translated points when they
1577 &quot;fit&quot;. Note that not only primitive shape can be used for filling in molecules inside their volume or on their surface but also any kind of combined shape. </para>
1578 <remark>Note however that not all combinations may already be fully working.</remark>
1579 <para>The filler procedure checks each fill-in point whether there
1580 is enough space for the set of atoms. To this end, we require a cluster
1581 instead of a molecule. A cluster is more general than a molecule as it is not restricted to a connected subgraph with respect to the bond graph. A cluster is just a general agglomeration of atoms
1582 combined with a bounding box that contains all of them and serves as
1583 its minimal volume. I.e. we need such a cluster. For this a number of
1584 atoms have to be specified, the minimum bounding box is generated
1585 automatically by which it is checked whether sufficient space is available at the fill-in point.</para>
1586 <para>On top of that, molecules can be selected whose volume is
1587 additionally excluded from the filling region.</para>
1588 <section xml:id="filling.fill-regular-grid">
1589 <title xml:id="filling.fill-regular-grid.title">Fill the domain with molecules</title>
1590 <para>The call to fill the volume of the selected shape with the
1591 selected atoms is then as follows,</para>
1592 <programlisting>
1593 ... --fill-regular-grid \
1594 --mesh-size &quot;5,5,5&quot; \
1595 --mesh-offset &quot;.5,.5,.5&quot; \
1596 --DoRotate 1 \
1597 --min-distance 1. \
1598 --random-atom-displacement 0.05 \
1599 --random-molecule-displacement 0.4 \
1600 --tesselation-radius 2.5
1601 </programlisting>
1602 <para>This generates a cardinal grid of 5x5x5 fill-in points within the
1603 sphere that are offset such as to lie centered within the sphere, defined by a relative offset per axis in [0,1]. Hence, with an offset of &quot;0&quot; we have the points left-aligned, with &quot;0.5&quot; centered, and with &quot;1&quot; right-aligned. Additionally, each molecule is rotated
1604 by a random rotation matrix, each atom is translated randomly by at
1605 most 0.05, each molecule&apos;s center similarly but at most by 0.4. The selected
1606 molecules&apos; volume is obtained by tesselating their surface and
1607 excluding every fill-in point whose distance to this surface does
1608 not exceed 1. We refer to our comments in
1609 <link linkend="randomization">Randomization</link>for details on
1610 changing the randomness and obtaining some extra flexibility thereby.</para>
1611 </section>
1612 <section xml:id="filling.fill-volume">
1613 <title xml:id="filling.fill-volume.title">Fill a shape&apos;s volume with molecules</title>
1614 <para>More specifically than filling the whole domain with molecules,
1615 maybe except areas where other molecules already are, we also can
1616 fill only specific parts by selecting a shape and calling upon
1617 the following action:</para>
1618 <programlisting>
1619 ... --fill-volume \
1620 --counts 12 \
1621 --min-distance 1. \
1622 --DoRotate 1 \
1623 --random-atom-displacement 0.05 \
1624 --random-molecule-displacement 0.4 \
1625 --tesselation-radius 2.5
1626 </programlisting>
1627 <para>The specified option all have the same function as before. Here, we specified to generate 12 points inside the volume of the selected shape.</para>
1628 </section>
1629 <section xml:id="filling.fill-surface">
1630 <title xml:id="filling.fill-surface.title">Fill a shape&apos;s surface with molecules</title>
1631 <para>Filling a surface is very similar to filling its volume.
1632 Again the number of equidistant points has to be specified.
1633 However, randomness is constrained as the molecule has to be aligned
1634 with the surface in a specific manner. The idea is to have the molecules point away from the surface in a similar way. This is done by aligning an axis with the surface normal. The alignment axis refers
1635 to the largest principal axis of the filler molecule and will
1636 be aligned parallel to the surface normal at the fill-in point.
1637This is the same syntax as with <emphasis role="bold">rotate-around-self</emphasis>. </para>
1638 <para>The call below will fill in 12 points with a minimum distance
1639 between the instances of 1 angstroem. We allow for certain random
1640 displacements and use the z-axis for aligning the molecules on
1641 the surface.</para>
1642 <programlisting>
1643 ... --fill-surface \
1644 --counts 12 \
1645 --min-distance 1. \
1646 --DoRotate 1 \
1647 --random-atom-displacement 0.05 \
1648 --random-molecule-displacement 0.4 \
1649 --Alignment-Axis &quot;0,0,1&quot;
1650 </programlisting>
1651 <para>Note that instead of giving an explicit axis you may also use
1652 a vector stored as a geometry object, see section
1653 <link linkend='geometry'>Geometry</link>.</para>
1654 </section>
1655 <section xml:id="filling.suspend-in-molecule">
1656 <title xml:id="filling.suspend-in-molecule.title">Suspend in molecule </title>
1657 <para>Add a given molecule in the simulation domain in such a way
1658 that the total density is as desired.</para>
1659 <programlisting>
1660 ... --suspend-in-molecule 1.
1661 </programlisting>
1662 </section>
1663 <section xml:id="filling.fill-molecule">
1664 <title xml:id="filling.fill-molecule.title">Fill in molecule</title>
1665 <para>This action will be soon be removed.</para>
1666 <programlisting>
1667 ... --fill-molecule
1668 </programlisting>
1669 </section>
1670 <section xml:id="filling.fill-void">
1671 <title xml:id="filling.fill-void.title">Fill void with molecule </title>
1672 <para>This action will be soon be removed.</para>
1673 <programlisting>
1674 ... --fill-void
1675 </programlisting>
1676 </section>
1677 </section>
1678 <section xml:id="analysis">
1679 <title xml:id="analysis.title">Analysis</title>
1680 <para>If atoms are manipulated and molecules are filled in, it is also a good idea to check on the manner of the filling. This can be done by for example looking at the pair correlation or angular correlation function. This may be useful in checking what is the mean distance between water molecules and how they are aligned with respect to each other.</para>
1681 <section xml:id="analysis.pair-correlation">
1682 <title xml:id="analysis.pair-correlation.title">Pair Correlation </title>
1683 <para>For two given elements Pair correlation checks on the typical
1684 distance in which they can be found with respect to one another. E.g. for
1685 water one might be interested what is the typical distance for
1686 hydrogen and oxygen atoms.</para>
1687 <programlisting>... --pair-correlation \
1688 --elements 1 8 \
1689 --bin-start 0 \
1690 --bin-width 0.7 \
1691 --bin-end 10 \
1692 --output-file histogram.dat \
1693 --bin-output-file bins.dat \
1694 --periodic 0
1695 </programlisting>
1696 <para>This will compile a histogram for the interval [0,10] in steps
1697 of 0.7 and increment a specific bin if the distance of one such pair
1698 of a hydrogen and an oxygen atom can be found within its distance
1699 interval. These data files can be used for plotting the distribution right away in order to check on the correlation between the elements.</para>
1700 </section>
1701 <section xml:id="analysis.dipole-correlation">
1702 <title xml:id="analysis.dipole-correlation.title">Dipole Correlation </title>
1703 <para>The dipole correlation is similar to the pair correlation, only
1704 that it correlates the orientation of dipoles in the molecular
1705 system with one another.</para>
1706 <para>Note that the dipole correlation works on the currently
1707 selected molecules, e.g. all water molecules if so selected.</para>
1708 <programlisting>... --dipole-correlation \
1709 --bin-start 0 \
1710 --bin-width 0.7 \
1711 --bin-end 10 \
1712 --output-file histogram.dat \
1713 --bin-output-file bins.dat \
1714 --periodic 0
1715 </programlisting>
1716 <para>Hence, instead of calculating a function of the distance in [0,infinity), it calculates the angular histogram in [0,2pi).</para>
1717 </section>
1718 <section xml:id="analysis.dipole-angular-correlation">
1719 <title xml:id="analysis.dipole-angular-correlation.title">Dipole Angular Correlation</title>
1720 <para>The dipole angular correlation looks at the angles of a
1721 dipole over time. It takes the orientation of a certain time step
1722 as the zero angle and bins all other orientations found in later
1723 time steps relative to it.
1724 </para>
1725 <para>Note that in contrast to the dipole correlation the dipole
1726 angular correlation works on the molecules determined by a formula.
1727 This is because selections do not work over time steps as molecules
1728 might change.
1729 </para>
1730 <programlisting>... --dipole-angular-correlation H2O \
1731 --bin-start 0 \
1732 --bin-width 5 \
1733 --bin-end 360 \
1734 --output-file histogram.dat \
1735 --bin-output-file bins.dat \
1736 --periodic 0 \
1737 --time-step-zero 0
1738 </programlisting>
1739 </section>
1740 <section xml:id="analysis.point-correlation">
1741 <title xml:id="analysis.point-correlation.title">Point Correlation </title>
1742 <para>Point correlation is very similar to pair correlation, only
1743 that it correlates not positions of atoms among one another but
1744 against a fixed, given point.</para>
1745 <programlisting>... --point-correlation \
1746 --elements 1 8 \
1747 --position &quot;0,0,0&quot; \
1748 --bin-start 0 \
1749 --bin-width 0.7 \
1750 --bin-end 10 \
1751 --output-file histogram.dat \
1752 --bin-output-file bins.dat \
1753 --periodic 0
1754 </programlisting>
1755 <para>This would calculate the correlation of all hydrogen and
1756 oxygen atoms with respect to the origin.</para>
1757 <para>Naturally, instead of giving explicit coordinates you may also
1758 use a vector stored as a geometry object for position, see section
1759 <link linkend='geometry'>Geometry</link>.</para>
1760 </section>
1761 <section xml:id="analysis.surface-correlation">
1762 <title xml:id="analysis.surface-correlation.title">Surface Correlation</title>
1763 <para>The surface correlation calculates the distance of a set
1764 of atoms with respect to a tesselated surface.</para>
1765 <programlisting>... --surface-correlation \
1766 --elements 1 8 \
1767 --bin-start 0 \
1768 --bin-width 0.7 \
1769 --bin-end 10 \
1770 --output-file histogram.dat \
1771 --bin-output-file bins.dat \
1772 --periodic 0
1773 </programlisting>
1774 </section>
1775 <section xml:id="analysis.molecular-volume">
1776 <title xml:id="analysis.molecular-volume.title">Molecular Volume </title>
1777 <para>This simply calculates the volume that a selected molecule
1778 occupies. For this the molecular surface is determined via a
1779 tesselation of its surface. Note that this surface is minimal in
1780 that respect that each node of the tesselation consists of an atom
1781 of the molecule.</para>
1782 <programlisting>... --molecular-volume</programlisting>
1783 <note>The rolling sphere used in the tesselation algorithm has a
1784 default diameter of 10 angström.</note>
1785 </section>
1786 <section xml:id="analysis.average-molecule-force">
1787 <title xml:id="analysis.average-molecule-forcetitle">Average force acting on a molecule</title>
1788 <para>This sums up all the forces of each atom of a currently
1789 selected molecule and returns the average force vector. This should
1790 give you the general direction of acceleration of the molecule.
1791 </para>
1792 <programlisting>... --molecular-volume</programlisting>
1793 </section>
1794 </section>
1795 <section xml:id="fragmentation">
1796 <title xml:id="fragmentation.title">Fragmentation</title>
1797 <para>Fragmentation refers to a so-called linear-scaling method called
1798 &quot;Bond-Order diSSection in an ANOVA-like fashion&quot; (BOSSANOVA),
1799 developed by <personname>Frederik Heber</personname>. In this section
1800 we briefly explain what the method does and how the associated actions
1801 work.</para>
1802 <para>The central idea behind the BOSSANOVA scheme is to fragment the
1803 graph of the molecular system into connected subgraphs of a certain
1804 number of vertices, namely a fixed number of atoms. To give an example, loading a ethane atom
1805 with the chemical formula C2H6, fragmenting the molecule up to order 1
1806 means creating two fragments, both methane-like from either carbon
1807 atom including surrounding hydrogen atoms. Fragmenting up to order 2
1808 would return both the methane fragments and additionally the full
1809 ethane molecule as it resembles a fragment of order 2, namely
1810 containing two (non-hydrogen) atoms.</para>
1811 <para>The reason for doing this is that usual ab-initio calculations
1812 of molecular systems via methods such as Density Functional Theory or
1813 Hartree-Fock scale at least as
1814 <inlineequation>
1815 <mml:math display="inline">
1816 <mml:mrow>
1817 <mml:mi>O(</mml:mi>
1818 <mml:msup>
1819 <mml:mi>M</mml:mi>
1820 <mml:mn>3</mml:mn>
1821 </mml:msup>
1822 <mml:mi>)</mml:mi>
1823 </mml:mrow>
1824 </mml:math>
1825 </inlineequation>
1826 with the number of atoms
1827 <inlineequation>
1828 <mml:math display="inline">
1829 <mml:mrow>
1830 <mml:mi>M</mml:mi>
1831 </mml:mrow>
1832 </mml:math>
1833 </inlineequation>
1834 . In general, this cost is prohibitive for calculating ground state energies and forces (required for molecular dynamics simulations) for larger molecules such as bio proteins. By fragmenting the molecular system and looking at fragments of fixed size, calculating the ground state energy of a
1835 number of fragment molecules becomes a linear scaling operation with the number of atoms. In the doctoral thesis of Frederik
1836 Heber, it is explained why this is a sensible ansatz mathematically
1837 and shown that it delivers a very good accuracy if electrons (and
1838 hence interactions) are in general localized.</para>
1839 <para>Long-range interactions (e.g. Coulomb or van-der-Waals interactions) are artificially truncated, however,
1840 with this fragmentation ansatz. It can be obtained in a perturbation manner
1841 by sampling the resulting electronic and nuclei charge density on a
1842 grid, summing over all fragments, and solving the associated Poisson
1843 equation. Such a calculation is implemented via the solver
1844 <productname>vmg</productname> by Julian Iseringhausen that is
1845 contained in the <link xlink:href="http://www.scafacos.org/">
1846 <productname>ScaFaCoS</productname>
1847 </link>. This enhancement is currently implemented via another program package named <productname>JobMarket</productname> that is at the moment not available publicly (contact the author Frederik Heber if interested).</para>
1848 <para>Note that we treat hydrogen special (but can be switched off) as
1849 fragments are calculated as closed shell (total spin equals zero).
1850 Also, we use hydrogen to saturate any dangling bonds that occur as
1851 bonds are cut when fragmenting a molecule (this, too, can be switched
1852 off).</para>
1853 <para>Eventually, the goal of fragmentation is to yield an energy and gradients with respect to nuclear positions per atom for each fragment. These forces can be used for molecular dynamics simulations, for structure optimization or for fitting empirical potential functions. The underlying operation consists of three parts. The first part is always the act of splitting up the selected atoms in the molecular system into fragments. The energies of the fragments are calculated in the second part via an external ab-initio solver, where the actual solver used is arbitrary and to some extent up to the user (<productname>MPQC </productname> is used by default). The second part of the fragmentation is to combine fragment results to energy and gradients for the total molecular system.</para>
1854 <para>Note that the molecular system itself is not touched in any way by this fragmentation. </para>
1855 <section xml:id="fragmentation.fragment-molecule">
1856 <title xml:id="fragmentation.fragment-molecule.title">Fragmenting a molecular system</title>
1857 <para>For the current selection of atoms, all fragments consisting
1858 of these (sub)set of atoms are created in the following
1859 manner.</para>
1860 <programlisting>
1861 ... --fragment-molecule &quot;BondFragment&quot; \
1862 --DoCyclesFull 1 \
1863 --distance 3. \
1864 --order 3 \
1865 --grid-level 5 \
1866 --output-types xyz mpqc
1867 </programlisting>
1868 <para>We go through each of the options one after the other. During
1869 fragmentation some files are created storing state information, i.e.
1870 the vertex/atom indices per fragment and so on. These files are used when re-performing the fragmentation on a slightly modified state (e.g. after a time integration step with essentially the same bond graph) for faster operation. These files all need
1871 a common prefix, here &quot;BondFragment&quot;. Then, we specify that cycles
1872 should be treated fully. This compensates for electrons in aromatic
1873 rings being delocalized over the ring. If cycles in the graph,
1874 originating from aromatic rings, are always calculated fully, i.e.
1875 the whole ring becomes a fragment, we partially overcome these
1876 issues. This does however not work indefinitely and accuracy of the
1877 approximation is limited (
1878 <inlineequation>
1879 <mml:math display="inline">
1880 <mml:mrow>
1881 <mml:mi>&gt;</mml:mi>
1882 <mml:msup>
1883 <mml:mi>10</mml:mi>
1884 <mml:mn>-4</mml:mn>
1885 </mml:msup>
1886 </mml:mrow>
1887 </mml:math>
1888 </inlineequation>) in systems with many interconnected aromatic
1889 rings, such as graphene. Next, we give a distance cutoff of 3 angstroem used
1890 in bond graph creation. Then, we specify the maximum order, i.e. the
1891 maximum number of (non-hydrogen) atoms per fragment, here 3. The
1892 higher this number the more expensive the calculation becomes
1893 (because substantially more fragments are created) but also the more
1894 accurate. The grid level refers to the part where long-range Coulomb
1895 interactions are calculated. This is done via solving the associated
1896 Poisson equation with a multigrid solver -- however, this requires the <productname>JobMarket</productname> package. As input the solver
1897 requires the density which is sampled on a cartesian grid whose
1898 resolution these parameter defines (<inlineequation>
1899 <mml:math display="inline">
1900 <mml:mrow>
1901 <mml:msup>
1902 <mml:mi>2</mml:mi>
1903 <mml:mn>level</mml:mn>
1904 </mml:msup>
1905 </mml:mrow>
1906 </mml:math>
1907 </inlineequation>). And finally, we give the output file formats,
1908 i.e. which file formats are used for writing each fragment
1909 configuration (prefix is &quot;BondFragment&quot;, remember?). Here, we use
1910 XYZ (mainly for checking the configurations visually) and MPQC,
1911 which is a very robust Hartree-Fock solver. We refer to the
1912 discussion of the <link linkend="fileparsers">Parsers</link>
1913 on how to change the parameters of the ab-initio calculation. That is to the extent implemented in Molecuilder the created configuration files for the specific solver are manipulated with the options also manipulating the state file written on program exit.</para>
1914 <para>After having written all fragment configuration files, you
1915 need to calculate each fragment, grab the resulting energy (and
1916 force vectors) and place them into a result file manually. This at
1917 least is necessary if you have specified output-types above. If not,
1918 the fragments are not written to file but stored internally. Read
1919 on.</para>
1920 <para>All created fragments, i.e. their id sets, are stored in an
1921 internal structure that associates each atom with all fragments it
1922 is contained in. This AtomFragments container structure can be parsed
1923 and stored, see <link linkend="atomfragments">AtomFragments</link>.
1924 They are used e.g. for fitting partial charges. There, a selection of
1925 atoms is used to fit partial charges to all fragments (and the charge
1926 grids obtained from long-range calculations, see <link linkend="fragmentation.fragment-automation">FragmentAutomation</link>,
1927 and the container is needed to know all fragments.
1928 <note>This structure is cleared by this action and created fragment
1929 information is inserted afterwards, i.e. it contains only the
1930 associations from the current fragmentation.</note>
1931 </para>
1932 </section>
1933 <section xml:id="fragmentation.fragment-automation">
1934 <title xml:id="fragmentation.fragment-automation.title">Calculating fragment energies automatically</title>
1935 <para>Another way of doing this is enabled if you have
1936the <productname>JobMarket</productname> package. Initially, the package was required but now it is only recommended as then calculations can be performed in parallel or arbitrarily many cores (and also the long-range calculation are only available then). JobMarket implements a
1937 client/server ansatz, i.e. two (or more) independent programs are
1938 running (even on another computer but connected via an IP network),
1939 namely a server and at least one client. The server receives
1940 fragment configurations from MoleCuilder and assigns these to a
1941 client who is not busy. The client launches an executable that is
1942 specified in the work package he is assigned and gathers after
1943 calculation a number of values, likewise specified in the package.
1944 The results are gathered together by the server and can be requested
1945 from MoleCuilder once they are done. This essentially describes what
1946 is happening during the execution of this action.</para>
1947 <para>Stored fragment jobs can also be parsed again, i.e. reversing
1948 the effect of having output-types specified in <link linkend="fragmentation.fragment-molecule">Fragmenting a molecule </link>.</para>
1949 <programlisting>
1950 ... --parse-fragment-jobs \
1951 --fragment-jobs &quot;BondFragment00.in&quot; &quot;BondFragment01.in&quot; \
1952 --fragment-path &quot;./&quot; \
1953 --grid-level 5
1954 </programlisting>
1955 <para>Here, we have specified two files, namely
1956 <filename>BondFragment00.in</filename> and
1957 <filename>BondFragment01.in</filename>, to be parsed from the path
1958 &quot;./&quot;, i.e. the current directory. Also, we have specified to sample
1959 the electronic charge density obtained from the calculated ground
1960 state energy solution with a resolution of 5 (see fragment molecule
1961 and also below).</para>
1962 <para>This allows for automated and parallel calculation of all
1963 fragment energies and forces directly within MoleCuilder. The
1964 FragmentationAutomation action takes the fragment configurations
1965 from an internal storage wherein they are placed if in
1966 FragmentMolecule no output-types have been specified.</para>
1967 <programlisting>
1968 ... --fragment-automation \
1969 --fragment-executable mpqc \
1970 --DoLongrange 1 \
1971 --DoValenceOnly 1 \
1972 --grid-level 5 \
1973 --interpolation-degree 3 \
1974 --near-field-cells 4 \
1975 --server-address 127.0.0.1 \
1976 --server-port 1025
1977 </programlisting>
1978 <para>Again, we go through each of the action&apos;s options step by
1979 step.</para>
1980 <para>The executable is required if you do not have a patched
1981 version of <productname>MPQC</productname> that may directly act as
1982 a client to JobMarket&apos;s server.</para>
1983 <note>
1984 <para>Long-calculations are only possible with a client that knows
1985 how to handle VMG jobs. If you encounter failures, then it is most
1986 likely that you do not have a suitable client.</para>
1987 </note>
1988 <para>In the next line, we have all options related to calculation
1989 of long-range interactions. We only sample valence charges on the
1990 grid, i.e. not core electrons and the nuclei charges are reduced
1991 suitably. This avoids problems with sampling highly localized
1992 charges on the grid and is in general recommended. Next, there
1993 follow parameters for the multi grid solver, namely the resolution
1994 of the grid, see under fragmenting the molecule, the interpolation
1995 degree and the number of near field cells. A grid level of 6 is
1996 recommended but costly in terms of memory, the other values are at
1997 their recommend values.</para>
1998 <para>In the last line, parameters are given on how to access the
1999 JobMarket server, namely it address and its port. If the JobMarket
2000 package is not available, then these option values cannot be given.
2001 Instead the solver is called internally on the same machine and one
2002 fragment energy is calculated after the other.</para>
2003 <note>The structure storing the fragment results internally is
2004 cleared prior to this action and calculated fragment results
2005 is inserted afterwards, i.e. it contains only the
2006 calculations from the current run.</note>
2007 <note>All calculated results may be placed in a result file for
2008 later parsing, see
2009 <link linkend="fragmentation.save-fragment-results">save fragment results</link>
2010 .</note>
2011 </section>
2012 <section xml:id="fragmentation.analyse-fragment-results">
2013 <title xml:id="fragmentation.analyse-fragment-results.title"> Analyse fragment results</title>
2014 <para>After the energies and force vectors of each fragment have
2015 been calculated, they need to be summed up to an approximation for
2016 the energy and force vectors of the whole molecular system. This is
2017 done by calling this action.</para>
2018 <programlisting>
2019 ... --analyse-fragment-results \
2020 --fragment-prefix &quot;BondFragment&quot; \
2021 --store-grids 1
2022 </programlisting>
2023 <para>The purpose of the prefix should already be known to you. The
2024 last option states that the sampled charge densities and the
2025 calculated potential from the long-range calculations should be
2026 stored with the summed up energies and forces. Note that this makes
2027 the resulting files substantially larger (Hundreds of megabyte or
2028 even gigabytes as currently the densities are stored on the full cartesian grid). Fragment energies and forces are stored in
2029 so-called internal homology containers. These are explained in the
2030 next section.</para>
2031 <para>Note that this action sets the force vector if these have been
2032 calculated for the fragment. Hence, a
2033 <link linkend="molecule.verlet-integration">verlet integration</link>
2034 is possible afterwards.</para>
2035 <note>If not obtained by
2036 <link linkend="fragmentation.fragment-automation">fragment automation</link>
2037 then fragment results need to be parsed from file, see
2038 <link linkend="fragmentation.parse-fragment-results">parse fragment results</link>
2039 .</note>
2040 </section>
2041 <section xml:id="fragmentation.store-saturated-fragment">
2042 <title xml:id="fragmentation.store-saturated-fragment.title">Store a saturated fragment</title>
2043 <para>This will store the currently selected atoms as a fragment
2044 where all dangling bonds (by atoms that are connected in the bond
2045 graph but have not been selected as well) are saturated with
2046 additional hydrogen atoms. The output formats are set to just xyz.
2047 </para>
2048 <programlisting>
2049 ... --store-saturated-fragment \
2050 --DoSaturate 1 \
2051 --output-types xyz
2052 </programlisting>
2053 </section>
2054 <section xml:id="fragmentation.parse-fragment-jobs">
2055 <title xml:id="fragmentation.parse-fragment-jobs.title">Parse fragment jobs from files</title>
2056 <para>The fragment jobs that are created by
2057 <link linkend="fragmentation.fragment-molecule">fragment molecule</link>
2058 may also be placed in a file for later retrieval. See the details of
2059 this action on how to create one file per job.</para>
2060 <para>Later, for parsing these job files, we need to use the parse
2061 fragment jobs action as follows:</para>
2062 <programlisting>
2063 ... --parse-fragment-jobs \
2064 --fragment-jobs &quot;BondFragment00.in&quot; &quot;BondFragment01.in&quot; \
2065 --fragment-path &quot;./&quot;
2066 </programlisting>
2067 <para>Here, we give a list of files by the first option and the second
2068 option gives an optional path where all these files are stored.</para>
2069 </section>
2070 <section xml:id="fragmentation.parse-fragment-results">
2071 <title xml:id="fragmentation.parse-fragment-results.title">Parse calculated fragment results from file</title>
2072 <para>Fragment results can either be obtained directly from
2073 solving the associated electronic structure problem for each
2074 of the fragment jobs. Or if that has been done at some earlier
2075 stage and results have been written to a file, see
2076 <link linkend="fragmentation.save-fragment-results">save fragment results</link>
2077 , then we may also parse these results.</para>
2078 <programlisting>
2079 ... --parse-fragment-results &quot;results.dat&quot;
2080 </programlisting>
2081 </section>
2082 <section xml:id="fragmentation.save-fragment-results">
2083 <title xml:id="fragmentation.save-fragment-results.title">Save calculated fragment results to file</title>
2084 <para>Calculated fragment results may be stored to a single file
2085 for later analysis as follows:</para>
2086 <programlisting>
2087 ... --save-fragment-results &quot;results.dat&quot;
2088 </programlisting>
2089 <note>Beware though that files from long-range calculations may be
2090 very large and are stored quite inefficiently at the moment.</note>
2091 </section>
2092 </section>
2093 <section xml:id="homology">
2094 <title xml:id="homology.title">Homologies</title>
2095 <para>After a fragmentation procedure has been performed fully, what
2096 to do with the results? The forces can be used for time integration and structure optimization but what about
2097 the energies? The energy value is basically the function evaluation of
2098 the Born-Oppenheimer surface of the molecular system. For molecular dynamics simulations
2099 continuous ab-initio calculations to evaluate the Born-Oppenheimer
2100 surface, especially the gradient at the current position of the molecular system&apos;s configuration, is not feasible. Instead usually empirical potential functions
2101 are fitted as to resemble the Born-Oppenheimer surface to a sufficient
2102 degree.</para>
2103 <para>One frequently employed method is the many-body expansion of said surface
2104 which is basically nothing else than the fragmentation ansatz described
2105 above. Potential functions resemble a specific term in this many-body
2106 expansion. These are discussed in the next section.</para>
2107 <para>For each of these terms all homologous fragments (i.e. having
2108 the same atoms with respect to the present elements and bonded in the
2109 same way), differing only in the coordinate of each atom, are just a
2110 sampling or a function evaluation of this term of the many-body
2111 expansion with respect to varying nuclei coordinates. Hence, it is
2112 appropriate to use these function evaluations in a non-linear
2113 regression procedure. That is, we want to tune the parameters of the
2114 empirical potential function in such a way as to most closely obtain
2115 the same function evaluation as the ab-initio calculation did using the
2116 same nuclear coordinates. Usually, this is done in a least-square
2117 sense, minimising the euclidean norm.</para>
2118 <para>Homologies -- in the sense used here -- are then nothing else but containers for a specific
2119 type of fragment of all the different, calculated configurations (i.e.
2120 varying nuclear coordinates of the same fragment, i.e. same atoms with identical bonding).</para>
2121 <para>Now, we explain the actions that parse and store
2122 homologies.</para>
2123 <programlisting>... --parse-homologies homologies.dat</programlisting>
2124 <para>This parses the all homologies contained in the file
2125 <filename>homologies.dat</filename> and <emphasis role="italic">appends</emphasis> them to the homology
2126 container.</para>
2127 <programlisting>... --save-homologies homologies.dat</programlisting>
2128 <para>Complementary, this stores the current contents of the homology
2129 container, <emphasis role="italic">overwriting</emphasis> the file
2130 <filename>homologies.dat</filename>.</para>
2131 </section>
2132 <section xml:id="atomfragments">
2133 <title xml:id="atomfragments.title">AtomFragments</title>
2134 <para>Similarly, to <link linkend="homology">Homologies</link> also
2135 the associations between atoms and the respective fragments they take
2136 part in can be stored to a file and parse again at a later time.</para>
2137 <programlisting>... --parse-atom-fragments atomfragments.dat</programlisting>
2138 <para>This parses the all atom fragment associattions contained in the file
2139 <filename>atomfragments.dat</filename> and <emphasis role="italic">appends</emphasis>
2140 them to the atom fragments associations container.</para>
2141 <programlisting>... --save-atom-fragments atomfragments.dat</programlisting>
2142 <para>Complementary, this stores the current contents of the atom fragments
2143 associations container, <emphasis role="italic">overwriting</emphasis> the file
2144 <filename>atomfragments.dat</filename>.</para>
2145 </section>
2146 <section xml:id="potentials">
2147 <title xml:id="potentials.title">Potentials</title>
2148 <para>In much the same manner as we asked before: what are homology
2149 files or containers good for? However, taking into account what we have just explained, it
2150 should be clear: We fit potential function to these function
2151 evaluations of terms of the many-body expansion of the Born-Oppenheimer
2152 surface of the full system.</para>
2153 <section xml:id="potentials.fit-potential">
2154 <title xml:id="potentials.fit-potential.title">Fitting empirical potentials</title>
2155 <para>Empirical potentials are function that represent a certain aspect
2156 of binding forces in molecular dynamics, e.g. a bond potential represents
2157 the force between two atoms arising because of a binding orbital in
2158 between that may be (in some approximartion) represented by a Hooke's
2159 spring law.
2160 In a more abstract view, an empirical potential consists of the
2161 following: a binding model representable as a graph consisting of nodes
2162 and edges, a function that takes the distance between nodes and the
2163 set of edges (representing bonds in the binding model) and last but
2164 not least a set of parameters that represent the respective strength
2165 of the bonds. For example, a torsion potential has a binding model
2166 containing four nodes and three edges connecting node 1 and 2, 2 and
2167 3, and 3 and 4. The function requires the six interatomic distances. And
2168 the parameters are coefficients in the functions that need to be
2169 evaluated to obtain the resulting force vector.
2170 </para>
2171 <para>In this manner, empirical potentials are implemented in
2172 MoleCuilder. They are not just a function but always an additional
2173 binding model that allows to associate atoms with a specific node
2174 in the model and thereby to assicate it with a particular interatomic
2175 distance. And said model determines in what order the elements have
2176 to be given.
2177 </para>
2178 <para>Let&apos;s take a look at an exemplary call to the fit potential
2179 action.</para>
2180 <programlisting>
2181 ... --fit-potential \
2182 --fragment-charges 8 1 1 \
2183 --potential-charges 8 1 \
2184 --potential-type morse \
2185 --take-best-of 5
2186 </programlisting>
2187 <para>Again, we look at each option in turn. The first is the
2188 charges or elements specifying the set of homologous fragments that
2189 we want to look at. Here, obviously we are interested in water
2190 molecules, consisting of a single oxygen (8) and two hydrogen atoms (1).
2191 Next, we specify the chemical element type of the potential, here a
2192 potential between oxygen (8) and hydrogen (1). We give the type of
2193 the potential as morse, which requires a single distance or two
2194 nuclear coordinates and the distance taken between the two. Finally,
2195 we state that the non-linear regression should be done with five
2196 random starting positions, i.e. five individual minimizations, and
2197 the set of parameters with the smallest L2 norm wins.</para>
2198 <note>
2199 <para>Due to translational and rotational degrees of freedom for
2200 fragments smaller than 7 atoms, it is appropriate to look at the
2201 pair-wise distances and not at the absolute coordinates. In the
2202 case of the water molecule as a the fragment whose energy we
2203 want to represent by a empirical potential, there are 3 atoms
2204 and therefore 3 unique distances between any pair of atoms.
2205 From this set of distances MoleCuilder needs to pick any subset
2206 that matches with the ones required by the binding model.
2207 In our case of the Morse potential, we need two atoms, oxygen
2208 and hydrogen, i.e. a single distance. If we had given a harmonic
2209 angular potential and the then required three charges/elements,
2210 &quot;1 8 1&quot;, i.e. oxygen and two hydrogens, we would have
2211 obtained three distances. The order of the elements, i.e.
2212 &quot;8 1 1&quot; would match a different angular interaction
2213 in the same fragment, depends on the binding model of the
2214 potential. In the case of the harmonic angle, the second element
2215 in the list is the central atom in the angle, while the first and
2216 third atom define either arm of the angle.Naturally, for the Morse
2217 potential the order does not matter as each distance is symmetric.
2218 </para>
2219 <para>MoleCuilder always adds a so-called constant potential to
2220 the fit containing only a single parameter, the energy offset.
2221 This offset compensates for the interaction energy associated with
2222 a fragment of order 1, e.g. a single hydrogen atom. Essentially,
2223 this captures the atomic energy that is not associated to any
2224 binding interactions.</para>
2225 <para>Note that by choosing "set-max-iterations" and "take-best-of"
2226 one can force the optimization to try either a single set of random
2227 initial parameters very thoroughly or many different sets just for
2228 a few iterations. Or any in between.</para>
2229 </note>
2230 </section>
2231 <section xml:id="potentials.fit-compound-potential">
2232 <title xml:id="potentials.fit-compound-potential.title">Fitting many empirical potentials simultaneously</title>
2233 <para>Another way is using a file containing a specific set of
2234 potential functions, possibly even with initial values.</para>
2235 <programlisting>
2236 ... --fit-compound-potential \
2237 --fragment-charges 8 1 1 \
2238 --potential-file water.potentials \
2239 --set-threshold 1e-3 \
2240 --training-file test.dat
2241 </programlisting>
2242 <para>Now, all empirical potential functions are summed up into a
2243 so-called compound potential over the combined set of parameters.
2244 These are now fitted simultaneously. For example, let&apos;s say the potential
2245 file <filename>water.potentials</filename> contains a harmonic bond
2246 potential between oxygen and hydrogen and another angular potential
2247 for the angle between hydrogen, oxygen, and hydrogen atom. Then, we would
2248 fit a function consisting of the sum of the two potentials functions in order to approximate the energy of a single
2249 water molecule (actually, it&apos;s the sum of three potentials. As mentioned before, a constant potential is always added to compensate non-bonding energies, i.e. not depending on interatomic distances). Here, the threshold criterion takes the place of the
2250<emphasis role="bold"> take-best-of</emphasis> option. Here, the minimization is reiterated so often on random (but to some extent chosen from a sensible range) starting parameters until the final L2 error is below 1e-3. Also, all data used
2251 for training, i.e. the tuples consisting of the fragments nuclei
2252 coordinates and the associated energy value are written to the file
2253 <filename>test.dat</filename>. This allows for graphical representation or other
2254way of analysis, e.g. for a Morse potential between oxygen and hydrogen the bonding energy can be plotted as a one-dimensional function and compared to the &quot;point cloud&quot; of sample points from the fragment term of Born-Oppenheimer surface. It is this point cloud, i.e. the training data, that is written to the file
2255 <filename>test.dat</filename>.</para>
2256 <para>Note that you can combine the two ways, i.e. start with a
2257 fit-potential call but give an empty potential file. The resulting
2258 parameters are stored in it. Fit other potentials and give different
2259 file names for each in turn. Eventually, you have to combine the file
2260 in a text editor at the moment. And perform a fit-compound-potential
2261 with this file.</para>
2262 <para>Here, also "set-max-iterations" and "take-best-of" can be used
2263 to mix thorough or shallow search from random initial parameter sets.
2264 </para>
2265 </section>
2266 <section xml:id="potentials.parse-potential">
2267 <title xml:id="potentials.parse-potential.title">Parsing an empirical potentials file</title>
2268 <para>Taking part in the compound potential is every potential
2269 function whose signature matches with the designated fragment-charges
2270 and who is currently known to MoleCuilder.</para>
2271 <para>More potentials can be registered (<emphasis role="bold">fit-potential</emphasis> will also
2272 register the potential it fits) by parsing them from a file.</para>
2273 <programlisting>
2274 ... --parse-potentials water.potentials
2275 </programlisting>
2276 <note>Currently, only <productname>TREMOLO</productname>potential files are understood and can be parsed.</note>
2277 </section>
2278 <section xml:id="potentials.save-potential">
2279 <title xml:id="potentials.save-potential.title">Saving an empirical potentials file</title>
2280 <para>The opposite to <emphasis role="bold">parse-potentials</emphasis> is to save all currently registered potential functions to the given
2281 file along with the currently fitted parameters</para>
2282 <programlisting>
2283 ... --save-potentials water.potentials
2284 </programlisting>
2285 <note>Again, only the <productname>TREMOLO</productname>potential format is understood currently and is written.</note>
2286 </section>
2287 <section xml:id="potentials.fit-partial-charges">
2288 <title xml:id="potentials.fit-partial-charges.title">Fitting partial particle charges</title>
2289 <para>The above empirical potential just model the short-range
2290 behavior in the molecular fragment, namely the (covalently) bonded interaction.
2291 In order to model the Coulomb long-range interaction as well without solving
2292 for the electronic ground state in each time step, partial charges
2293 are used that capture to some degree the created dipoles due to
2294 charge transfer from one atom to another when bonded. These are called
2295 partial charges because they combine both nuclei and electronic
2296 charges to yield an in general fractional charge.</para>
2297 <para>Note that so far the placement of partial charges is restricted
2298 to the position of nuclei in the molecular system. There are more
2299 complex ways of placing partial charges, e.g. as employed in higher
2300 TIP water molecules, that also use anti-bonding potentials. This is
2301 so far not implemented.</para>
2302 <para>To allow least-squares regression of these partial charges, we
2303 need the results of long-range calculations and the <emphasis role="bold">store-grids</emphasis>
2304 option (see above under <link linkend="fragmentation">Fragmentation </link>)
2305 must have been given.</para>
2306 <para>Furthermore, we require associations between selected atoms and
2307 the fragments, residing in the <link linkend="homology">Homology container</link>.
2308 These are contained in the <link linkend="atomfragments">AtomFragments association</link>
2309 container, that can also be parsed and stored.</para>
2310 <para>With these sampled charge density and Coulomb potential stored
2311 in the homology containers, we call this action as follows.</para>
2312 <programlisting>
2313 ... --fit-partial-charges \
2314 --potential-file water.particles \
2315 --radius 1.5
2316 </programlisting>
2317 <para>Assume that a water molecule has been selected previously. Then
2318 all homologous fragments that contain any of the water molecules are
2319 used as &quot;key&quot; to request all configurations of this type
2320 from the homologies container. For each of the atoms then an average
2321 partial charge is computed by fitting their respective Coulomb
2322 potential to the obtained from the fragment calculations. Resulting
2323 values are stored in <filename>water.particles</filename>. The
2324 radius is used to mask a certain region directly around the nuclei
2325 from the fit procedure. As here the charges of the core electrons and
2326 the nuclei itself dominate, we however are only interested in a good
2327 approximation to the long-range potential, this mask radius allows
2328 to give the range of the excluded zone.</para>
2329 </section>
2330 <section xml:id="potentials.parse-particle-parameters">
2331 <title xml:id="potentials.parse-particle-parameters.title">Parsing a particles file</title>
2332 <para>Empirical Potential contain parameters for function that model
2333 interactions between two or more specific particles. However,
2334 interactions can also be more general, such as a Coulomb
2335 potential, that interacts with any other particle with non-zero
2336 charge, or Lennard-Jones potential that interacts with any other
2337 particle close enough.
2338 Parameters for these particles are encoded in the internal Particle
2339 class and are parsed from and stored to a special particles file.
2340 This parse particle parameters function loads the parameters from
2341 a file, instantiates them in a new particle, and registers them
2342 such that they are known within molecuilder.</para>
2343 <para>More particles can be registered (<emphasis role="bold">fit-partial-charges</emphasis> will also
2344 register the particles it fits) by parsing them from a file.</para>
2345 <programlisting>
2346 ... --parse-particle-parameters water.particles
2347 </programlisting>
2348 <note>Currently, only <productname>TREMOLO</productname>particles files are understood and can be parsed.</note>
2349 </section>
2350 <section xml:id="potentials.save-particle-parameters">
2351 <title xml:id="potentials.save-particle-parameters.title">Saving a particles file</title>
2352 <para>The opposite to <emphasis role="bold">parse-particle-parameters</emphasis>
2353 is to save all currently registered particle and their parameters to
2354 the given file.</para>
2355 <programlisting>
2356 ... --save-particle-parameters water.particles
2357 </programlisting>
2358 <note>Again, only the <productname>TREMOLO</productname>particles format is understood currently and is written.</note>
2359 </section>
2360 </section>
2361 <section xml:id="dynamics">
2362 <title xml:id="dynamics.title">Dynamics</title>
2363 <para>For fitting potentials or charges we need many homologous but
2364 different fragments, i.e. atoms with slightly different positions.
2365 How can we generate these?</para>
2366 <para>One possibility is to use molecular dynamics. With the
2367 aforementioned fragmentation scheme we can quickly calculate not only
2368 energies but also forces if the chosen solver, such as
2369 <link xlink:href="http://www.mpqc.org/">
2370 <productname>MPQC </productname>
2371 </link>, supports it. Integrating these forces
2372 discretely over time gives insight into vibrational features of a
2373 molecular system close to the equilibrium and allows to generate those positions for fitting
2374 potentials that describe these vibrations.</para>
2375 <section xml:id="dynamics.molecular-dynamics">
2376 <title xml:id="dynamics.molecular-dynamics.title">Molecular dynamics </title>
2377 <para>The molecular dynamics action is a so-called macro Action,
2378 i.e. it combines several other Actions into one, namely:</para>
2379 <itemizedlist>
2380 <listitem>
2381 <para>--<emphasis role="bold">verlet-integration</emphasis></para>
2382 </listitem>
2383 <listitem>
2384 <para>--<emphasis role="bold">output</emphasis></para>
2385 </listitem>
2386 <listitem>
2387 <para>--<emphasis role="bold">clear-fragment-results</emphasis></para>
2388 </listitem>
2389 <listitem>
2390 <para>--<emphasis role="bold">destroy-adjacency</emphasis></para>
2391 </listitem>
2392 <listitem>
2393 <para>--<emphasis role="bold">create-adjacency</emphasis></para>
2394 </listitem>
2395 <listitem>
2396 <para>--<emphasis role="bold">update-molecules</emphasis></para>
2397 </listitem>
2398 <listitem>
2399 <para>--<emphasis role="bold">fragment-molecule</emphasis></para>
2400 </listitem>
2401 <listitem>
2402 <para>--<emphasis role="bold">fragment-automation</emphasis></para>
2403 </listitem>
2404 <listitem>
2405 <para>--<emphasis role="bold">analyse-fragment-results</emphasis></para>
2406 </listitem>
2407 </itemizedlist>
2408 <para>The following command will perform a molecular dynamics simulation
2409 for 100 time steps, each time step continuing over <emphasis role="bold">deltat</emphasis> equal to 0.5 atomic time units,
2410 i.e. 1.2e-17 s. Some of the other options listed below, such as <emphasis role="bold">order</emphasis>, <emphasis role="bold">distance</emphasis>, or <emphasis role="bold">fragment-executable</emphasis>, will seem familiar
2411 to you if you have read in this guide about the fragmentation actions. Look at the list above to see that they are a part of the makro action that performs molecular dynamics simulations. Below
2412 we will not keep the bond graph, i.e bonds and molecules may change
2413 over the simulation and hence also the created fragments per time
2414 step.
2415Furthermore, the forces are corrected such that the force add up to zero. </para>
2416 <programlisting>... --molecular-dynamics \
2417 --steps 100 \
2418 --keep-bondgraph 0 \
2419 --order 3 \
2420 --distance 3. \
2421 --deltat 0.5 \
2422 --keep-fixed-CenterOfMass 1 \
2423 --fragment-executable mpqc \
2424 </programlisting>
2425 <para>Keeping the bond graph is useful when simulating close to the equilibrium and no bond breaking or forming should occur. Note that in general the BOSSANOVA fragmentation scheme is discontinuous with respect to the formation of bonds in the energy. This discontinuity arrises because of the threshold criterion used for detecting the bond graph. After each simulation step the bond graph is recreated (if <emphasis role="bold">keep-bondgraph</emphasis> is switched off) to accomodate for any structural changes. If bonds are added because two atoms are suddenly within the required distance which before was not the case, additional fragments are generated, calculated, and added to the approximation of the whole system. As the addition of these contributions is sudden -- in general, they will already be non-zero when the bonds are detected -- a slight jump in the total energy of the system can be expected.</para>
2426 <para>To sum it up, the use of the BOSSANOVA scheme in bond breaking/forming scenarios is in general not recommended. That&apos;s why keeping the bond graph is always sensible. However, if potential energies are too far away from equilibrium the simulation may still produce unphysical results.</para>
2427 </section>
2428 <section xml:id="dynamics.optimize-structure">
2429 <title xml:id="dynamics.optimize-structure.title">Structure optimization</title>
2430 <para>Structure optimization is also a macro Action, it basically
2431 combines the same Actions as <emphasis role="bold">molecular-dynamics</emphasis> does. However, it
2432 uses the <emphasis role="bold">force-annealing</emphasis> action instead of <emphasis role="bold">verlet-integration</emphasis>.</para>
2433 <remark>Because it is a MacroAction we cannot use any more elaborate
2434 line search method during the optimization. In essence, we minimize the
2435 energy function that depends on the nuclei coordinates. The function is
2436 non-linear and non-convex. The best choice, given that we have gradient
2437 information, would be the Conjugate Gradient method (such as Fletcher-
2438 Reeves which work well also for non-linear functions). However, these
2439 methods perform a line search along the gradient direction which we
2440 cannot as our Actions do not contain any internal information (apart
2441 from the state for Undo/Redo). Therefore, we are restricted to the
2442 method of Barzilai-Borwein where no line-search is needed but that also
2443 works well for high-dimensional minimization problems.</remark>
2444 <para>The command below performs a structure optimization of the
2445 currently selected atoms (may also be a subset) for up to 100 time
2446 steps, where each time step is again 0.5 atomic time units. The time
2447 step here serves as the initial step width for annealing.
2448 </para>
2449 <programlisting>... --optimize-structure \
2450 --keep-bondgraph 1 \
2451 --output-every-step 1 \
2452 --steps 100 \
2453 --order 3 \
2454 --distance 3. \
2455 --deltat 0.5 \
2456 --keep-fixed-CenterOfMass 1 \
2457 --fragment-executable mpqc
2458 </programlisting>
2459 <para>Note that <emphasis role="bold">output-every-step</emphasis> will allow you to watch the
2460 optimization as each step is placed into a distinct time step.
2461 Otherwise only two time steps would be created: the initial and
2462 the final one containing the optimized structure.</para>
2463 <para>Because of the use of Barzilai-Borwein for computing the
2464 stepwidth we do not need any 'deltat' parameters. If the computed
2465 step width is zero, we use a default step width of 1.</para>
2466 </section>
2467 <section xml:id="dynamics.step-world-time">
2468 <title xml:id="dynamics.step-world-time.title">Step forward and backward through world time</title>
2469 <para>Some MacroActions are applied for a number of steps and need to
2470 increment the current world time, e.g. molecule dynamics or structure
2471 optimization. To this end, we may call upon
2472 </para>
2473 <programlisting>... --step-world-time 1</programlisting>
2474 <para>Note that the argument gives the number of steps to step forward
2475 and may be any integer. Hence, we may also step backwards.</para>
2476 </section>
2477 <section xml:id="dynamics.set-world-time">
2478 <title xml:id="dynamics.set-world-time.title">Set the world&apos;s time step</title>
2479 <para>In order to inspect or manipulate atoms and molecules at a
2480 certain time step, the World&apos;s time has to be set with the following
2481 Action.
2482 </para>
2483 <para>This will set the World&apos;s time to the fifth step (counting
2484 starts at zero).</para>
2485 <programlisting>... --set-world-time 4</programlisting>
2486 <para>Note that each atom has its own tracjectory storage and manages it in a clever way. That&apos;s why subsets of atoms may be time-integrated, while the other atoms will not get taken over on the time axis. They simply remain frozen during the integration.</para>
2487 </section>
2488 <section xml:id="dynamics.save-temperature">
2489 <title xml:id="dynamics.save-temperature.title">Save the temperature information</title>
2490 <para>For each present time step the temperature (i.e. the average velocity
2491 per atom multiplied with its mass) will be stored to a file.</para>
2492 <programlisting> ... --save-temperature temperature.dat</programlisting>
2493 <para>That is <emphasis role="italic">temperature.dat</emphasis> contains two columns: the first contains the time step and the second column contains the temperature of the system in atomic units.</para>
2494 </section>
2495 </section>
2496 <section xml:id="dynamics.tesselation">
2497 <title xml:id="dynamics.tesselation.title">Tesselations</title>
2498 <para>A tesselation is a set of triangles that form a closed surface. They are used to obtain molecular surfaces (and volumes) by rolling
2499 a virtual sphere of a certain radii on a molecule such that it always rests on at least three atoms. From such a resting position the sphere is rolled over all of its three sides until it rests again. This is continued until the closed
2500 surface of connected triangles is created.</para>
2501 <note>Tesselations are used internally by the graphical interface in
2502 order to show molecules by their surface. This is in general faster
2503 than displaying them as a ball-stick model consisting of spheres and
2504 cylinders.</note>
2505 <section xml:id="dynamics.tesselation.nonconvex-envelope">
2506 <title xml:id="dynamics.tesselation.nonconvex-envelope.title"> Non-convex envelope</title>
2507 <para>This will create a non-convex envelope for a molecule and store
2508 it to a file for viewing with external programs.</para>
2509 <programlisting>... --nonconvex-envelope 6. \
2510 --nonconvex-file nonconvex.dat
2511 </programlisting>
2512 <para>This tesselation file can be conveniently viewed with
2513 <productname>TecPlot</productname> or with one of the Tcl script
2514 in the <emphasis role="italic">util</emphasis> folder with <productname>VMD</productname>. Also,
2515 still pictures can be produced with <productname>Raster3D </productname>.
2516 <note>The required file header.r3d can be found in a subfolder of the util folder.</note>
2517 </para>
2518 </section>
2519 <section xml:id="dynamics.tesselation.convex-envelope">
2520 <title xml:id="dynamics.tesselation.convex-envelope.title">Convex envelope</title>
2521 <para>This will create a convex envelope for a molecule and give the
2522 volumes of both the non-convex and the convex envelope. This is good
2523 for measuring the space a molecule takes up, e.g. when filling a
2524 domain and taking care of correct densities.</para>
2525 <programlisting>... --convex-envelope 6. \
2526 --convex-file convex.dat
2527 </programlisting>
2528 <para>This tesselation file can be likewise viewed with
2529 <productname>TecPlot</productname> or with one of the Tcl script
2530 in the util folder with <productname>VMD</productname>.</para>
2531 </section>
2532 </section>
2533 <section xml:id="various">
2534 <title xml:id="various.title">Various commands</title>
2535 <para>Here, we gather all commands that do not fit into one of above
2536 categories for completeness.</para>
2537 <section xml:id="various.verbose">
2538 <title xml:id="various.verbose.title">Changing verbosity</title>
2539 <para>The verbosity level is the amount of stuff printed to screen.
2540 This information will in general help you to understand when
2541 something does not work. Mind the <emphasis>ERROR</emphasis> and
2542 <emphasis>WARNING</emphasis> messages in any case.</para>
2543 <para>This command below sets the verbosity from default of 2 to 4,</para>
2544 <programlisting>... --verbose 4</programlisting>
2545 <para>or shorter,</para>
2546 <programlisting>... -v 4</programlisting>
2547 </section>
2548 <section xml:id="various.dry-run">
2549 <title xml:id="various.dry-run.title">Dry runs</title>
2550 <para>A &quot;dry run&quot; refers to a test run where commands are not
2551 actually executed. You may bracket a certain set of actions by
2552 putting --<emphasis role="bold">dry-run</emphasis> before and --<emphasis role="bold">no-dry-run</emphasis> afterwards. Then, all
2553 actions in between will be looked at but not executed, i.e. they
2554 make it to the history but nothing is changed in the World.</para>
2555 <para>As an example, the following listing contains the adding of a
2556 hydrogen atom at position (5,5,5) inside the aforementioned dry run
2557 statements. Hence, no hydrogen atom is added but the <emphasis role="bold">add-atom</emphasis> action is
2558 stored in the history and will make it to a stored session.</para>
2559 <programlisting>... --dry-run \
2560 --add-atom 1 --domain-position &quot;5,5,5&quot;
2561 --no-dry-run</programlisting>
2562 <para>This is useful for converting shell commands into python scripts. Commands are not executed but all are eventually found in the written pyrthon file.</para>
2563 </section>
2564 <section xml:id="various.element-db">
2565 <title xml:id="various.element-db.title">Loading an element database</title>
2566 <para>Element databases contain information on valency, van der
2567 Waals-radii and other information for each element.</para>
2568 <para>This loads all element database from the current folder (in a
2569 unix environment):</para>
2570 <programlisting>... --element-db ./</programlisting>
2571 </section>
2572 <section xml:id="various.version">
2573 <title xml:id="various.version.title">Giving the version of the program</title>
2574 <para>This prints the version information of the code, especially
2575 important when you request the fixing of bugs or implementation of
2576 features.</para>
2577 <programlisting>... --version</programlisting>
2578 </section>
2579 <section xml:id="various.warranty">
2580 <title xml:id="various.warranty.title">Giving warranty information</title>
2581 <para>As follows warranty information is given,</para>
2582 <programlisting>... --warranty</programlisting>
2583 </section>
2584 <section xml:id="various.help-redistribute">
2585 <title xml:id="various.help-redistribute.title">Giving redistribution information</title>
2586 <para>This gives information on the license and how to redistribute
2587 the program and its source code</para>
2588 <programlisting>... --help-redistribute</programlisting>
2589 </section>
2590 </section>
2591 <section xml:id="sessions">
2592 <title xml:id="sessions.title">Sessions</title>
2593 <para>A session refers to the queue of actions you have executed.
2594 Together with the initial configuration (and all files required for
2595 actions in the queue) this may be seen as a clever way of storing
2596 the state and history of a molecular system manipulation session. When proceeding in a try&amp;error
2597 fashion to construct a certain system, it is a good idea, to store the
2598 session at the point where your attempts start to deviate from one
2599 another.</para>
2600 <para>Note only that but stored session used in the graphical interface may safe a lot of repetitive pointing and clicking. On top of that if the python session file is called <emphasis role="italic">molecuilder.py</emphasis> and resides in the folder you start MoleCuilder from, then it will be executed automatically and even before creating the graphical interface (i.e. it is also faster).</para>
2601 <section xml:id="sessions.store-session">
2602 <title xml:id="sessions.store-session.title">Storing a session </title>
2603 <para>Storing sessions is simple,</para>
2604 <programlisting>... --store-session &quot;session.py&quot; \
2605 --session-type python
2606 </programlisting>
2607 <para>Here, the session type is given as python (the other option is
2608&quot; cli&quot; for storing in the manner of the command-line interface, i.e. just as our example code snippets throughout this guide). The written
2609 python script <filename>session.py</filename> can even be used with
2610 the python interface described below, i.e. it is a full python script
2611 (that however requires the so-called <emphasis role="italic">pyMoleCuilder</emphasis> module).</para>
2612 <note>The python session will store a file with python commands using named arguments. As some actions have quite
2613 a number of arguments, all of them end up in a single function call. This makes it very hazard-prone to mix them up.
2614 Therefore, it is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts
2615 when employing MoleCuilder commands.</note>
2616 <para>When using named arguments for MoleCuilder commands in Python scripts, remember that dashes ("-") in
2617 argument names have been converted to underscores ("_") as the former characters are illegal. Apart from that
2618 the argument names resemble exactly the token names as encountered on the command line, e.g.
2619 <programlisting>
2620 pyMoleCuilder.CommandVerbose(verbose="1")
2621 ...
2622 </programlisting>
2623 where the keyword argument "verbose" is for the Action that changes MoleCuilder's output verbosity. Also,
2624 you see that arguments are always given as string.
2625 </para>
2626 </section>
2627 <section xml:id="sessions.load-session">
2628 <title xml:id="sessions.load-session.title">Loading a session</title>
2629 <para>Loading a session only works for python scripts, i.e. only for session type python and not for type cli. This actually
2630 blurs the line between the command-line interface and the python
2631 interface a bit. Again, MoleCuilder automatically executes a
2632 script called <filename>molecuilder.py</filename> if such a file is
2633 contained in the current directory.</para>
2634 <programlisting>... --load-session &quot;session.py&quot;</programlisting>
2635 <para>This will execute every action with its options contained in the
2636 script <filename>session.py</filename>.</para>
2637 </section>
2638 </section>
2639 <section xml:id="various-specific">
2640 <title xml:id="various-specific.title">Various specific commands </title>
2641 <para>In this (final) section of the action description we list a number
2642 Actions that are very specific to some purposes (or other programs).
2643 </para>
2644 <section xml:id="various-specific.save-selected-atoms-as-exttypes">
2645 <title xml:id="various-specific.save-selected-atoms-as-exttypes.title"> Saving exttypes of a set of atoms</title>
2646 <para>This saves the atomic ids of all currently selected atoms in a
2647 <link xlink:href="http://www.tremolo-x.com/">
2648 <productname>TREMOLO </productname>
2649 </link> exttypes file with the given name.</para>
2650 <programlisting>... --save-selected-atoms-as-exttypes \
2651 --filename test.exttypes </programlisting>
2652 </section>
2653 <section xml:id="various-specific.set-parser-parameters">
2654 <title xml:id="various-specific.set-parser-parameters.title">Setting parser specific parameters</title>
2655 <para>You can tweak the parameters stored in files associated to specific ab initio programs to some extent.
2656 For example, <productname>MPQC</productname> stores various
2657 parameters modifying the specific ab-initio calculation performed, e.g. the basis set used, the level of theory, whether gradients are calculated.
2658 For <link xlink:href="http://www.mpqc.org/">
2659 <productname>MPQC </productname>
2660 </link> and
2661 <link xlink:href="http://www.psicode.org/">
2662 <productname>Psi4 </productname>
2663 </link> this can be modified as follows.</para>
2664 <programlisting>... --set-parser-parameters mpqc \
2665 --parser-parameters &quot;theory=CLHF;basis=6-31*G;&quot;
2666 </programlisting>
2667 <para>This sets the ab-initio theory to closed-shell Hartree-Fock
2668 and the basis set to 6-31*G. Note the specific &quot;key=value;&quot; system. That is a key such as &quot;theory&quot; is followed by an equivalent sign and by a value, here &quot;CLHF&quot; for closed-shell Hartree-Fock, and finally a semicolon to separate the key-value pairs. Please avoid any unnecessary white spaces. Note that the implementation is probably not complete, hence do check the
2669 <productname>MPQC</productname> manual on further supported values that must be added by hand. We list below the currently implementd list of keys and their values.</para>
2670 <itemizedlist>
2671 <listitem>Hessian - yes/no
2672 </listitem>
2673 <listitem>savestate - yes/no
2674 </listitem>
2675 <listitem>do_gradient - yes/no
2676 </listitem>
2677 <listitem>maxiter - positive integer value
2678 </listitem>
2679 <listitem>memory - positive integer value
2680 </listitem>
2681 <listitem>stdapprox
2682 <itemizedlist>
2683 <listitem>A'</listitem>
2684 </itemizedlist>
2685 </listitem>
2686 <listitem>nfzc - positive integer value
2687 </listitem>
2688 <listitem>basis - any basis listed in data folder, e.g.
2689 <itemizedlist>
2690 <listitem>3-21G</listitem>
2691 <listitem>6-31+G*</listitem>
2692 <listitem>...</listitem>
2693 </itemizedlist>
2694 </listitem>
2695 <listitem>aux_basis - same as under basis
2696 </listitem>
2697 <listitem>integration
2698 <itemizedlist>
2699 <listitem>IntegralCints</listitem>
2700 </itemizedlist>
2701 </listitem>
2702 <listitem>theory
2703 <itemizedlist>
2704 <listitem>CLHF</listitem>
2705 <listitem>CLKS</listitem>
2706 <listitem>MBPT2</listitem>
2707 <listitem>MBPT2_R12</listitem>
2708 </itemizedlist>
2709 </listitem>
2710 <listitem>jobtype
2711 <itemizedlist>
2712 <listitem>Default</listitem>
2713 <listitem>Optimization</listitem>
2714 </itemizedlist>
2715 </listitem>
2716 </itemizedlist>
2717 </section>
2718 <section xml:id="various-specific.set-tremolo-atomdata">
2719 <title xml:id="various-specific.set-tremolo-atomdata.title">Tremolo specific options and potential files</title>
2720 <para><productname>TREMOLO</productname>&apos;s configuration files start
2721 with a specific line telling the amount of information that is contained in the
2722 file. This line can be modified, e.g. to enforce storing of
2723 velocities and forces as well as the atoms positions and
2724 element.</para>
2725 <programlisting>... --set-tremolo-atomdata &quot;id element u=3 v=3 F=3&quot; \
2726 --reset 1
2727 </programlisting>
2728 <para>This will not append but reset the old line and fill it with
2729 the given string. </para>
2730 <para>Find a list of all keys that are also used internally in MoleCuilder below:</para>
2731 <itemizedlist>
2732 <listitem><para>id number - Id</para></listitem>
2733 <listitem><para>chemical element - type</para></listitem>
2734 <listitem><para>position - x=3</para></listitem>
2735 <listitem><para>velocity - u=3</para></listitem>
2736 <listitem><para>force - F=3</para></listitem>
2737 <listitem><para>enumerating bonded atom ids - neighbors=4</para></listitem>
2738 <listitem><para>name of atom - name</para></listitem>
2739 <listitem><para>charge - Charge</para></listitem>
2740 </itemizedlist>
2741 <para>Furthermore, find the rest of all available keys:</para>
2742 <itemizedlist>
2743 <listitem><para>stress tensor - stress</para></listitem>
2744 <listitem><para>enumerating bonded atom ids for improper potential - imprData</para></listitem>
2745 <listitem><para>unknown - GroupMeasureTypeNo</para></listitem>
2746 <listitem><para>group association for external forces - exttype</para></listitem>
2747 <listitem><para>residual name of atom (see PDB) - resName</para></listitem>
2748 <listitem><para>chain Id (see PDB) - chainId</para></listitem>
2749 <listitem><para>residual sequence (see PDB) - resSeq</para></listitem>
2750 <listitem><para>occupancy of electron orbitals - occupancy</para></listitem>
2751 <listitem><para>temperature factor - tempFactor</para></listitem>
2752 <listitem><para>segment id (see PDB) - segID</para></listitem>
2753 <listitem><para>different charge - charge</para></listitem>
2754 <listitem><para>unknown - GrpTypeNo</para></listitem>
2755 <listitem><para>enumerating bonded atom ids for torsion potential - torsion</para></listitem>
2756 </itemizedlist>
2757 <para>One further specific action is required when loading certain
2758 <productname>TREMOLO</productname> configuration files. These
2759 contain element notations that refer to parameterized names used in
2760 empirical potentials and molecular dynamics simulations and not the
2761 usual chemical symbols, such as H or O. We may load an auxiliary
2762 file that gives the required conversion from OH1 to H, which is the
2763 so-called potentials file.</para>
2764 <programlisting>... --parse-tremolo-potentials water.potentials</programlisting>
2765 <para>This parses the lookup table from the file
2766 <filename>water.potentials</filename> and it can be used in
2767 following load actions.</para>
2768 <para>Note that this is the same format as written by the fitting actions. However, apart from this the Actions are not related, i.e. <emphasis role="bold">parse-potentials</emphasis> will not also load these element descriptions. If this is desired, the above Action has to be used.</para>
2769 </section>
2770 </section>
2771 </section>
2772 <section xml:id="textmenu-interface">
2773 <title xml:id="textmenu-interface.title">Text menu</title>
2774 <para>We now discuss how to use the text menu interface.</para>
2775 <para>The text menu is very much the interface counterpart to the
2776 command-line interface. However, both work in a terminal session.</para>
2777 <para>In the text menu, actions can be selected from hierarchical lists.
2778 Note that the menus for the graphical interface are organized in the
2779 exactly same way. After an action has been chosen, the option values
2780 have to be entered one after the other. After the last option value has
2781 been given, the action is executed and the result printed to the
2782 screen.</para>
2783 <para>With regards to the other functionality, it is very much the same
2784 as the command-line interface above. It differs by being interactive, i.e. when using an external viewer on the state file and saving it after an Action has been performed, output can be checked. However, you may work in this way also directly by using the graphical interface.</para>
2785 </section>
2786 <section xml:id="graphical-user-interface">
2787 <title xml:id="graphical-user-interface.title">Graphical user interface </title>
2788 <para>The main point of the GUI is that it renders the atoms and
2789 molecules visually. These are represented by the common
2790 stick-and-ball-model by default. For faster rendering, molecules can also be visualized by the a non-convex envelope, see Tesselations. Single or multiple atoms and molecules can easily
2791 be accessed, activated, and manipulated via tables. Changes made in the
2792 tables cause immediate update of the visual representation. Under the
2793 hood each of these manipulations is nothing but the call to an action,
2794 hence is fully undo- and redoable.</para>
2795 <para>This interface is most helpful in designing more advanced structures that are
2796 conceptually difficult to imagine without visual aid. Results can be inspected directly and, if unsuitable, can be undone and reperformed with tweaked parameters. At the end, a
2797file containing the session may be stored and this script can then be used to construct
2798 various derived or slightly modified structures.</para>
2799 <section xml:id="graphical-user-interface.basic-view">
2800 <title xml:id="graphical-user-interface.basic-view.title">Basic view </title>
2801 <para>Let us first give an impression of the basic view of the GUI after a molecule has been loaded.</para>
2802 <figure>
2803 <title>Screenshot of the basic view of the GUI after loading a file with eight water molecules.</title>
2804 <mediaobject>
2805 <imageobject>
2806 <imagedata width="100%" scalefit="1" entityref="example_basic_view"/>
2807 </imageobject>
2808 </mediaobject>
2809 </figure>
2810 <section xml:id="graphical-user-interface.3d-view">
2811 <title xml:id="graphical-user-interface.3d-view.title">3D view </title>
2812 <para>In the above figure, you see the stick-and-ball representation
2813 of the water molecules, the &quot;dreibein&quot; giving the positive axis
2814 directions and the slightly translucent cuboid of the domain on a black background.</para>
2815 </section>
2816 <section xml:id="graphical-user-interface.information-tabs">
2817 <title xml:id="graphical-user-interface.information-tabs.title"> Information Tabs</title>
2818 <para>Beneath this 3D view that you can rotate at will with your mouse
2819 and zoom in and out with your scroll wheel, you find to the right a
2820 part containing two tabs named Atom and Molecule. Look at where the
2821 mouse pointer is. It has colored the atom underneath in cyan
2822 (although it&apos;s also an oxygen atom and should be colored in rose
2823 as the rest). You can inspect its properties in the tab Atom: Name,
2824 element, mass, charge, position and number of bonds. If you switch
2825 to the Molecule tab, you would see the properties of the water
2826 molecule this specific atom belongs to.</para>
2827 </section>
2828 <section xml:id="graphical-user-interface.shape">
2829 <title xml:id="graphical-user-interface.shape.title">Shape section </title>
2830 <para>Beneath these information tabs you find the shape sections.
2831 There you find a list of all currently created shapes and you can
2832select them by clicking on them, which lets their surface appear in the 3D view, and manipulate them via the buttons beneath this list. Note that the calculation of the shape&apos;s surface may take up to a few seconds, so don&apos;t get itchy right away when nothing seems to happen for a moment.</para>
2833 </section>
2834 <section xml:id="graphical-user-interface.timeline">
2835 <title xml:id="graphical-user-interface.timeline.title">Timeline </title>
2836 <para>Directly below the 3D view there is a long slider. If a loaded
2837 file has multiple time step entries, this slider allows you to
2838 smoothly select one time frame after another. Sliding it with the
2839 mouse from left to right will reveal the animation that is hidden
2840 behind the distinct snapshots stored in the configuration
2841 file.</para>
2842 </section>
2843 <section xml:id="graphical-user-interface.tables">
2844 <title xml:id="graphical-user-interface.tables.title">Selection tables</title>
2845 <para>Underneath the time line there is another place for
2846 tabs.</para>
2847 <itemizedlist>
2848 <listitem>Molecules</listitem>
2849 <listitem>All Elements</listitem>
2850 <listitem>All Fragments</listitem>
2851 <listitem>All Homologies</listitem>
2852 <listitem>All Geometries</listitem>
2853 <listitem>Logs</listitem>
2854 <listitem>Errors</listitem>
2855 </itemizedlist>
2856 <para>The first is on molecules, listing all present molecules of
2857 the molecular system in a tree view. If you click on a specific
2858 molecule, the one will get selected or unselected depending on its
2859 current selection state (see below for details on this with respect
2860 to the GUI). Also, if you tick the box the visibility of the specific molecules is changed: it switches between being displayed as either ball-and-stick, for manipulating its individual atoms, or as a molecular surface for (un)selecting it as a whole.</para>
2861 <para>The next tab enumerates all elements known to MoleCuilder
2862 where the ones are grayed out that are not present in the molecular
2863 system. Clicking on a present element will select all atoms of this
2864 specific element. A subsequent click unselects again.</para>
2865 <para>Subsequently follow two tabs on enumerating the fragments and their
2866 fragment energies if calculated and the homologies along with
2867 graphical depiction (via QWT), again if present.</para>
2868 <para>After that, we have a tab listing all geometry objects. These
2869 are vectors you may store via one of the Actions. If you hover over
2870 a vector, its length is shown. If you have selected one vector and
2871 hover over another one, then the angle between the two is shown.
2872 </para>
2873 <para>Finally, there are two tabs showing log messages of actions
2874 in the first tab and general information on what is currently done. Errors and
2875 warnings are listed in the second tab.</para>
2876 </section>
2877 </section>
2878 <section xml:id="graphical-user-interface.selections">
2879 <title xml:id="graphical-user-interface.selections.title">Selections </title>
2880 <para>Selections work generally always by calling a selection action from the pull-down menu and filling it with required parameters.</para>
2881 <para>With the GUI it may also be accessed directly: The row of icons
2882 above the 3D view has two icons depicting the selection of individual
2883 atoms or molecules. If either of them is selected, clicking with the
2884 left mouse button on an atom will either (un)select the atom or its
2885 associated molecule. Multiple atoms can be selected in this
2886 manner.</para>
2887 <para>Also, the selection tabs may be used by clicking on the name of a
2888 molecule as stated above or at an element.</para>
2889 <para>Similarly, if shapes are present in the shape section, clicking
2890 them will select them and also cause a translucent visualization to
2891 appear in the 3D view. Note that this visualization is quite costly
2892 right now and not suited to complex shapes. (This is in contrast to the molecular surfaces which are actually cheaper than the ball-and-stick presentation).</para>
2893 </section>
2894 <section xml:id="graphical-user-interface.dialogs">
2895 <title xml:id="graphical-user-interface.dialogs.title">Dialogs</title>
2896 <para>Most essential to the GUI are dialogs. Many action
2897 calls forth such a dialog. A dialog consists of a list of queries for a particular option value, one below the other. As each option
2898 value has a specific type, we briefly go into the details of how these
2899 queries look like.</para>
2900 <note>
2901 <para>Each dialog&apos;s okay button is grayed out until all entered option values
2902 are valid.</para>
2903 </note>
2904 <section xml:id="graphical-user-interface.dialogs.domain">
2905 <title xml:id="graphical-user-interface.dialogs.domain.title">Domain query</title>
2906 <figure>
2907 <title>Screenshot of a dialog showing a domain query</title>
2908 <mediaobject>
2909 <imageobject>
2910 <imagedata width="100%" scalefit="1" entityref="dialog_box"/>
2911 </imageobject>
2912 </mediaobject>
2913 <para>In the domain query a 3x3 symmetric matrix has to be
2914 entered. In the above screenshots you notice that the only
2915 non-zero entries are on the main diagonal. Here, we have simply
2916 specified a cube of edge length 8. The okay button will be grayed
2917 out if the matrix is either singular or not symmetric.</para>
2918 </figure>
2919 </section>
2920 <section xml:id="graphical-user-interface.dialogs.element">
2921 <title xml:id="graphical-user-interface.dialogs.element.title"> Element query</title>
2922 <figure>
2923 <title>Screenshot the add atom action containing an element query</title>
2924 <mediaobject>
2925 <imageobject>
2926 <imagedata width="100%" scalefit="1" entityref="dialog_add-atom_tooltip"/>
2927 </imageobject>
2928 </mediaobject>
2929 <para>Elements are picked from a pull-down box where all known
2930 elements are listed.</para>
2931 <para>In this dialog you also notice that a tooltip is given,
2932 briefly explaining what the action does.</para>
2933 </figure>
2934 </section>
2935 <section xml:id="graphical-user-interface.dialogs.action">
2936 <title xml:id="graphical-user-interface.dialogs.action.title"> Complex query</title>
2937 <figure>
2938 <title>Screenshot of a complex dialog consisting of multiple queries</title>
2939 <mediaobject>
2940 <imageobject>
2941 <imagedata width="100%" scalefit="1" entityref="dialog_complex"/>
2942 </imageobject>
2943 </mediaobject>
2944 <para>Here we show a more complex dialog. It queries for strings,
2945 for integer values (see the increase/decrease arrows), for
2946 booleans and for files (the &quot;choose&quot; buttons opens a file
2947 dialog).</para>
2948 </figure>
2949 </section>
2950 <section xml:id="graphical-user-interface.dialogs.exit">
2951 <title xml:id="graphical-user-interface.dialogs.exit.title">Exit query</title>
2952 <figure>
2953 <title>Screenshort showing the exit dialog</title>
2954 <mediaobject>
2955 <imageobject>
2956 <imagedata width="100%" scalefit="1" entityref="dialog_exit"/>
2957 </imageobject>
2958 </mediaobject>
2959 <para>Finally, we show the dialog that will pop up when exiting
2960 the graphical interface. It will ask whether it should store the
2961 current state of the system in the input file or not. You may
2962 cancel the exit, close without saving or save the current
2963 state.</para>
2964 </figure>
2965 </section>
2966 </section>
2967 </section>
2968 <section xml:id="python-interface">
2969 <title xml:id="python-interface.title">Python interface</title>
2970 <para>Last but not least we elaborate on the python interface. We have
2971 already discusses this interface to some extent. The current session,
2972 i.e. the queue of actions you have executed, can be stored as a python
2973 script and subsequently executed independently of the user interface it
2974 was created with. More generally, MoleCuilder&apos;s Actions can be executed within arbitrary python
2975 scripts where prior to its execution a specific module has to be loaded, enabling access to MoleCuilder&apos;s actions from inside the
2976 script.</para>
2977 <para>MoleCuilder&apos;s python module is called <emphasis role="italic">pyMoleCuilder</emphasis>. It is
2978 essentially a library that can be imported into python just as any other
2979 module. Let us assume you have started the python interpreter and you
2980 have added the containing folder of the <filename>pyMoleCuilder</filename>
2981 library to the <varname>PYTHONPATH</varname> variable.</para>
2982 <programlisting>import pyMoleCuilder as mol</programlisting>
2983 <para>Subsequently, you can access the help via</para>
2984 <programlisting>help(mol)</programlisting>
2985 <para>This will list all of MoleCuilder&apos;s actions with their function
2986 signatures within python as contained in the module <emphasis role="italic">pyMoleCuilder</emphasis> named
2987 as <emphasis role="bold">mol</emphasis> in the scope of the currently running interpreter. Note that the
2988 function names are not the names you know from the command-line
2989 interface, they might be called
2990 <computeroutput>WorldChangeBox(...)</computeroutput> or alike. However, they are related by a certain naming system. The first word is identical to the menu name it resides in the text or graphical interface. Then its followed by the actual name of the action that is similar to the command-line token.</para>
2991 <para>Let&apos;s try it out.</para>
2992 <programlisting>print mol.CommandVersion()</programlisting>
2993 <para>This will state the current version of the library.</para>
2994 <para>Go ahead and try out other commands. Refer to the documentation
2995 under the command-line interface and look up the function name via
2996 help.</para>
2997 <para>You can freely mix calls to the pymolecuilder module and other python commands.</para>
2998 <note>However, be aware that all Actions are executed in another thread,
2999 i.e. run in parallel. That means that a pymolecuilder command is not
3000 necessarily finished when python steps on to the next line!</note>
3001 <para>In order to make python wait for the Actions to finish before
3002 stepping, there is the special wait() command.</para>
3003 <programlisting>
3004 mol.MoleculeLoad("...")
3005 mol.wait()
3006 </programlisting>
3007 <para>This will continue first after the molecule has been fully loaded.
3008 </para>
3009 <warning>These wait()s will have no effect if the python script is loaded
3010 via the "load-session" command inside a User Interface (command-line,
3011 GUI, ...) as this would cause the queue to wait indefinitely, namely till
3012 the load-session itself would have finished.</warning>
3013 <para>Therefore, more complex python scripts need to be called with
3014 python and a set PYTHONPATH as described above.</para>
3015 <note>It is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts
3016 when employing MoleCuilder commands. As commands tend to have many arguments, it is very easy to mix
3017 them up as python is not a strongly typed language.</note>
3018 </section>
3019 </chapter>
3020 <chapter>
3021 <title>Conclusions</title>
3022 <para>This ends this user guide.</para>
3023 <para>We have given you a brief introduction to the aim of the program and
3024 how each of the four interfaces are to be used. The rest is up to
3025 you.</para>
3026 <para>Tutorials and more information is available online, see <link xlink:href="http://www.molecuilder.com/">MoleCuilder&apos;s website</link>.
3027 </para>
3028 <para>Be aware that in general knowing how the code works allows you to
3029 understand what&apos;s going wrong if something&apos;s going wrong.</para>
3030 <section>
3031 <title>Thanks</title>
3032 <para>Huge thanks go out to Saskia Metzler who was patient enough to let
3033 me sit next to her while riding ten hours in a bus to Berlin as I was writing the very first version of this guide.</para>
3034 </section>
3035 </chapter>
3036</book>
Note: See TracBrowser for help on using the repository browser.