source: doc/userguide/userguide.xml@ 38bcbe

Candidate_v1.7.0 stable
Last change on this file since 38bcbe was 38bcbe, checked in by Frederik Heber <frederik.heber@…>, 5 years ago

StretchBondAction will used tabled distances when given distance is less or equal zero.

  • Property mode set to 100644
File size: 189.4 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 Bond Neighbors (all bond neighbors of all currently
564 selected atoms are additionally selected)</para>
565 <programlisting>
566 ... --select-atom-bond-neighbors
567 </programlisting>
568 </listitem>
569 <listitem>
570 <para>By name (atom with molecule internal name "H1", e.g.
571 this will select all "H1" atoms in every present water molecule)</para>
572 <programlisting>
573 ... --select-atom-by-name "H1"
574 </programlisting>
575 <programlisting>
576 ... --unselect-atom-by-name "H1"
577 </programlisting>
578 </listitem>
579 <listitem>
580 <para>By Id (atom with id 76)</para>
581 <programlisting>
582 ... --select-atom-by-id 76
583 </programlisting>
584 <programlisting>
585 ... --unselect-atom-by-id 76
586 </programlisting>
587 </listitem>
588 <listitem>
589 <para>By Order (the first (1), the second, ... the last
590 created(-1), the last but one)</para>
591 <programlisting>
592 ... --select-atom-by-order 1
593 </programlisting>
594 <programlisting>
595 ... --unselect-atom-by-order -2
596 </programlisting>
597 </listitem>
598 <listitem>
599 <para>By Random Number of Atoms (e.g., 5 random atoms) </para>
600 <programlisting>
601 ... --select-atom-by-random 5
602 </programlisting>
603 </listitem>
604 <listitem>
605 <para id="selections.select-atom-inside-volume">By Shape (all
606 atoms inside the volume specified by the currently selected
607 shape)</para>
608 <programlisting>
609 ... --select-atom-inside-volume
610 </programlisting>
611 <programlisting>
612 ... --unselect-atoms-inside-volume
613 </programlisting>
614 </listitem>
615 <listitem>
616 <para>By Molecule (all atoms belonging to currently selected
617 molecules)</para>
618 <programlisting>
619 ... --select-molecules-atoms
620 </programlisting>
621 <programlisting>
622 ... --unselect-molecules-atoms
623 </programlisting>
624 </listitem>
625 <listitem>
626 <para>Push/Pop the current selection to/from a stack to store
627 it momentarily and allow modifications in MakroActions (this is
628 very specific and used mostly internally).</para>
629 <programlisting>
630 ... --push-atom-selection
631 </programlisting>
632 <programlisting>
633 ... --pop-atom-selection
634 </programlisting>
635 </listitem>
636 <listitem>
637 <para>Select bond neighbors of all currently selected atoms.
638 </para>
639 <programlisting>
640 ... --select-atoms-neighbors
641 </programlisting>
642 </listitem>
643 </itemizedlist>
644 </listitem>
645 <listitem>
646 <para>Molecules</para>
647 <itemizedlist>
648 <listitem>
649 <para>All</para>
650 <programlisting>
651 ... --select-all-molecules
652 </programlisting>
653 </listitem>
654 <listitem>
655 <para>None</para>
656 <programlisting>
657 ... --unselect-all-molecules
658 </programlisting>
659 <programlisting>
660 ... --clear-molecule-selection
661 </programlisting>
662 </listitem>
663 <listitem>
664 <para>Invert selection</para>
665 <programlisting>
666 ... --invert-molecules
667 </programlisting>
668 </listitem>
669 <listitem>
670 <para>By Id (molecule with id 4)</para>
671 <programlisting>
672 ... --select-molecule-by-id 2
673 </programlisting>
674 <programlisting>
675 ... --unselect-molecule-by-id 2
676 </programlisting>
677 </listitem>
678 <listitem>
679 <para>By Order (first created molecule, second created
680 molecule, ...)</para>
681 <programlisting>
682 ... --select-molecule-by-order 2
683 </programlisting>
684 <programlisting>
685 ... --unselect-molecule-by-order -2
686 </programlisting>
687 </listitem>
688 <listitem>
689 <para>By Formula (molecule with H2O as formula)</para>
690 <programlisting>
691 ... --select-molecules-by-formula &quot;H2O&quot;
692 </programlisting>
693 <programlisting>
694 ... --unselect-molecules-by-formula &quot;H2O&quot;
695 </programlisting>
696 </listitem>
697 <listitem>
698 <para>By Name (all molecules named &quot;water4&quot;)</para>
699 <programlisting>
700 ... --select-molecules-by-name &quot;water4&quot;
701 </programlisting>
702 <programlisting>
703 ... --unselect-molecules-by-name &quot;water4&quot;
704 </programlisting>
705 </listitem>
706 <listitem>
707 <para>By Atom (all molecules for which at least one atom is
708 currently selected)</para>
709 <programlisting>
710 ... --select-atoms-molecules
711 </programlisting>
712 <programlisting>
713 ... --unselect-atoms-molecules
714 </programlisting>
715 </listitem>
716 <listitem>
717 <para>Push/Pop the current selection to/from a stack to store
718 it momentarily and allow modifications in MakroActions.</para>
719 <programlisting>
720 ... --push-molecule-selection
721 </programlisting>
722 <programlisting>
723 ... --pop-molecule-selection
724 </programlisting>
725 </listitem>
726 </itemizedlist>
727 </listitem>
728 <listitem>
729 <para>Shapes</para>
730 <itemizedlist>
731 <listitem>
732 <para>All</para>
733 <programlisting>
734 ... --select-all-shapes
735 </programlisting>
736 </listitem>
737 <listitem>
738 <para>None</para>
739 <programlisting>
740 ... --unselect-all-shapes
741 </programlisting>
742 </listitem>
743 <listitem>
744 <para>By Name (all shapes named &quot;sphere1&quot;)</para>
745 <programlisting>
746 ... --select-shape-by-name &quot;sphere1&quot;
747 </programlisting>
748 <programlisting>
749 ... --unselect-shape-by-name &quot;sphere1&quot;
750 </programlisting>
751 </listitem>
752 </itemizedlist>
753 </listitem>
754 </itemizedlist>
755 <remark>Note that an unselected instance (e.g. an atom) remains unselected upon further unselection and vice versa with selection.</remark>
756 <para>These above selections work then in conjunction with other
757 actions and make them very powerful, e.g. you can remove all atoms
758 inside a sphere by a selecting the spherical shape and subsequently
759 selecting all atoms inside the shape and then removing them.</para>
760 </section>
761 <section xml:id="shapes">
762 <title xml:id="shapes.title">Shapes</title>
763 <para>Shapes are specific regions of the domain. There are just a few
764 so-called <emphasis>primitive</emphasis> shapes such as cuboid,
765 sphere, cylinder, the whole domain, or none of it. However, these can be
766 combined via boolean operations such as and, or, and not. This
767 approach is called <emphasis>constructive geometry</emphasis>. E.g. by
768 combining a sphere with the negated (<emphasis role="italic">not</emphasis> operation) of a smaller sphere, we
769 obtain a spherical surface of specific thickness.</para>
770 <note>Shapes are especially useful in the QtGui where all selected
771 shapes are visualized by their translucent boundary. This makes it
772 especially easy to e.g. recognize all atoms that would be removed
773 after <link linkend="selections.select-atom-inside-volume">selecting
774 all atoms inside the volume</link> of a selected shape.</note>
775 <section xml:id="shapes.create-shape">
776 <title xml:id="shapes.create-shape.title">Creating shapes</title>
777 <para>Primitive shapes can be created as follows,</para>
778 <programlisting>
779 ... --create-shape \
780 --shape-type sphere \
781 --shape-name &quot;sphere1&quot; \
782 --stretch &quot;2,2,2&quot; \
783 --translation &quot;5,5,5&quot;
784 </programlisting>
785 <para>This will create a sphere of radius 2 (initial radius is 1)
786 with name &quot;sphere1&quot; that is centered at (5,5,5). Other primitives are
787 cuboid and cylinder, where a rotation can be specified as
788 follows.</para>
789 <programlisting><programlisting>
790 ... --create-shape \
791 --shape-type cuboid \
792 --shape-name &quot;box&quot; \
793 --stretch &quot;1,2,2&quot; \
794 --translation &quot;5,5,5&quot; \
795 --angle-x &quot;90&quot;
796 </programlisting>
797 ... --create-shape \
798 --shape-type cylinder \
799 --shape-name &quot;cylinder&quot; \
800 --stretch &quot;1,2,2&quot; \
801 --translation &quot;5,5,5&quot; \
802 --angle-y &quot;90&quot;
803 </programlisting>
804 </section>
805 <section xml:id="shapes.combine-shapes">
806 <title xml:id="shapes.combine-shapes.title">Combining shapes</title>
807 <para>Any two shapes can be combined by boolean operations as follows</para>
808 <programlisting>
809 ... --combine-shapes \
810 --shape-name &quot;combinedshape&quot; \
811 --shape-op &quot;AND&quot;
812 </programlisting>
813 <para>This will combine two currently selected shapes vis the &quot;AND&quot; operation
814 and create a new shape called &quot;combinedshape&quot;. Note that the two old shapes
815 are still present after this operation. We briefly explain each operation:
816 </para>
817 <itemizedlist>
818 <listitem>
819 <para><emphasis>AND</emphasis> combines two currently selected shapes
820 into a new shape that consists of only the volume where shapes overlap.</para>
821 </listitem>
822 <listitem>
823 <para><emphasis>OR</emphasis> combines two currently selected shapes
824 into a new shape that consists of all the volume that either shape
825 occupies.</para>
826 </listitem>
827 <listitem>
828 <para><emphasis>NOT</emphasis> creates the inverse to a currently selected
829 single shape that contains the volume with respect to the simulation domain
830 that the present one does not.</para>
831 </listitem>
832 </itemizedlist>
833 </section>
834 <section xml:id="shapes.remove-shape">
835 <title xml:id="shapes.remove-shape.title">Removing shapes</title>
836 <para>Removing a shape is as simple as removing an atom.</para>
837 <programlisting>... --remove-shape </programlisting>
838 <para>This removes all currently selected shapes.</para>
839 </section>
840 <section xml:id="shapes.manipulation">
841 <title xml:id="shapes.manipulation.title">Manipulating shapes</title>
842 <para>Shapes can be stretched, scaled, rotated, and translated to
843 modify primitives or combined primitive shapes. As you have seen
844 this manipulation could have occurred already at creation but we may also
845do it later on. As usual, we just list examples of the various manipulations
846 below, each of them works on the currently selected shapes.</para>
847 <programlisting>
848 ... --stretch-shapes &quot;1,1,2&quot; \
849 --stretch-center &quot;5,5,5&quot;
850 </programlisting>
851 <para>This stretches the shapes relative to the center at (5,5,5)
852 (default is origin) by a factor of 2 in the z direction.</para>
853 <programlisting>
854 ... --rotate-shapes \
855 --center &quot;10,2,2&quot; \
856 --angle-x 90 \
857 --angle-y 0 \
858 --angle-z 0
859 </programlisting>
860 <para>This way all selected shapes are rotated by 90 degrees around
861 the x axis with respect to the center at (10,2,2).</para>
862 <programlisting>... --translate-shapes &quot;5,0,0&quot; </programlisting>
863 <para>This translates all selected shapes by 5 along the x
864 axis.</para>
865 </section>
866 </section>
867 <section xml:id="geometry">
868 <title xml:id="geometry.title">Geometry Objects</title>
869 <para>Although we use the term geometry objects in the title, we
870 actually mean vectors, i.e. a position or direction in the
871 three-dimensional space. But maybe we have need for the more
872 general term in the future.</para>
873 <para>Vectors are required as input to many of the Actions further
874 below: translating atoms, rotating atoms around a specific axis,
875 aligning a molecule with a vector, ...</para>
876 <para>Therefore, vectors can be stored and referenced using a given
877 name. This allows for a very powerful and handy manipulation of the
878 molecular system afterwards. And to give a concrete example, let's have
879 a look at translating a set of selected atoms, see subsection on
880 <link linkend='atoms.translate-atom'>Translating atoms</link>. </para>
881 <programlisting>
882... --translate-atoms &quot;unitVectorX&quot;
883 </programlisting>
884 <para>This would use the automatically created reference
885 &quot;unitVectorX&quot;, i.e. the vector with components (1,0,0) as
886 the translation vector for the given set of atoms. In other words, all
887 selected atoms get shifted by 1 unit (e.g. Angstr&ouml;m) in +X
888 direction.</para>
889 <para>We have the following automatically created geometry objects
890 whose names are self-explanatory:</para>
891 <itemizedlist>
892 <listitem>zeroVector</listitem>
893 <listitem>unitVectorX</listitem>
894 <listitem>unitVectorY</listitem>
895 <listitem>unitVectorZ</listitem>
896 </itemizedlist>
897 <para>However, more vectors can be simply constructed from atomic
898 positions, such as the position of an atom directly, the distance between
899 two atoms (in case they are bonded, then this would be the bond vector)
900 or from three atoms, defining a plane and giving its normal vector.
901 </para>
902 <remark>We have refrained from giving automated names to vectors and even
903 keeping them up-to-date automatically, i.e. the distance between two atoms
904 O1 and O2 could be named &quot;distance_O1_O2&quot; or similar. However, we want
905 the user to have full control and maybe come up with more suitable names
906 such as &quot;rotation_axis&quot; in this case.</remark>
907 <warning>Note that names have to be unique and the Action will fail if
908 the name is already used.</warning>
909 <section xml:id="geometry.distance-to.vector">
910 <title xml:id="geometry.distance-to-vector.title">Atomic distance to stored vector</title>
911 <para>The distance between two selected atoms is stored as a vector as follows,</para>
912 <programlisting>
913 ... --distance-to-vector &quot;distance_vec&quot; \
914 --reverse 0
915 </programlisting>
916 <para>where the distance vector can be referenced by &quot;distance_vec&quot;
917 from then on in other Actions requiring a vector as input.</para>
918 <note>Since selected atoms are used in the fixed order of their ids
919 (and not in the order they were clicked at in
920 <link linkend="graphical-user-interface">QtGui</link>), the
921 direction can be inverted by giving the "reverse" option. It is
922 off (or 0) by default.</note>
923 </section>
924 <section xml:id="geometry.input-to.vector">
925 <title xml:id="geometry.input-to-vector.title">Coordinates to stored vector</title>
926 <para>We may also create a geometry vector simply by supplying the
927 three coordinates of a vector.</para>
928 <programlisting>
929 ... --input-to-vector &quot;vector&quot; \
930 --position &quot;1,2,3&quot;
931 </programlisting>
932 <para>where the vector with components (1,2,3) can be referenced
933 by &quot;vector&quot; .</para>
934 </section>
935 <section xml:id="geometry.plane-to.vector">
936 <title xml:id="geometry.plane-to-vector.title">Normal of plane to stored vector</title>
937 <para>Three positions in space (if they are not linear dependent)
938 define a plane in three-dimensional space.</para>
939 <para>Therefore, when exactly three atoms are selected, this Action
940 will construct the resulting plane and store its normal vector as a
941 geometry object for later reference.</para>
942 <programlisting>
943 ... --plane-to-vector &quot;planenormal&quot; \
944 --reverse 1
945 </programlisting>
946 <para>where the plane's normal vector can be referenced by
947 &quot;planenormal&quot;. The additional "reverse" option will invert
948 the plane's normal vector as this is ambiguous about the direction.</para>
949 </section>
950 <section xml:id="geometry.position-to.vector">
951 <title xml:id="geometry.position-to-vector.title">Atomic position to stored vector</title>
952 <para>Storing the position of a singly selected atom as a vector is simply done as follows,</para>
953 <programlisting>
954 ... --position-to-vector &quot;vector_O1&quot; \
955 </programlisting>
956 <para>where the vector can be referenced by &quot;vector_O1&quot;
957 from then on.</para>
958 </section>
959 <section xml:id="geometry.remove-geometry">
960 <title xml:id="geometry.remove-geometry.title">Remove a stored vector</title>
961 <para>Finally, a stored vector can also be removed.</para>
962 <programlisting>
963 ... --remove-geometry &quot;vector_O1&quot; \
964 </programlisting>
965 <para>this removes the stored &quot;vector_O1&quot;.</para>
966 </section>
967 </section>
968 <section xml:id="randomization">
969 <title xml:id="randomization.title">Randomization</title>
970 <para>Some operations require randomness as input, e.g. when filling a
971 domain with molecules these may be randomly translated and rotated.
972 Random values are obtained by a random number generator that consists
973 of two parts: engine and distribution. The engine yields a <emphasis role="italic">uniform</emphasis> set
974 of random numbers in a specific interval, the distribution modifies
975 them, e.g. to become gaussian.</para>
976 <para>There are several Actions to modify the specific engine and
977 distribution and their parameters. One example usage is that with the
978 aforementioned filling of the domain (see below) molecules are rotated randomly.
979 If you specify a random number generator that randomly just spills out
980 values 0,1,2,3, then the randomness is just the orientation of the
981 molecule with respect to a specific axis: x,y,z. (rotation is at most
982 360 degrees and 0,1,2,3 act as divisor, hence rotation angle will then be always
983 a multiple of 90 degrees).</para>
984 <programlisting>
985 ... --set-random-number-distribution &quot;uniform_int&quot; \
986 --random-number-distribution-parameters &quot;p=1&quot;
987 </programlisting>
988 <para>This changes the distribution to &quot;uniform_int&quot;, i.e. integer
989 numbers that are distributed uniformly.</para>
990 <programlisting>
991 ... --set-random-number-engine &quot;mt19937&quot; \
992 --random-numner-engine-parameters &quot;seed=10&quot;
993 </programlisting>
994 <para>Specifying the seed allows you to obtain the same sequence of
995 random numbers for testing purposes.</para>
996 <para>Moreover, actions such as
997 <link linkend="atoms.random-perturbation">random perturbation</link>
998 of atoms and <link linkend="filling">filling</link> of molecules into the
999 domain use the random number generator.</para>
1000 </section>
1001 <section xml:id="atoms">
1002 <title xml:id="atoms.title">Manipulate atoms</title>
1003 <para>Here, we explain in detail how to add, remove atoms, change its
1004 element type, scale the bond in between or measure the bond length or
1005 angle.</para>
1006 <section xml:id="atoms.add-atom">
1007 <title xml:id="atoms.add-atom.title">Adding atoms</title>
1008 <para>Adding an atom to the domain requires the element of the atom
1009 and its coordinates as follows,</para>
1010 <programlisting>
1011 ... --add-atom O \
1012 --domain-position &quot;2.,3.,2.35&quot;
1013 </programlisting>
1014 <para>where the element is given via its chemical symbol and the
1015 vector gives the position within the domain</para>
1016 <para>Note that instead of giving an explicit vector you may also use
1017 a vector stored as a geometry object, see section
1018 <link linkend='geometry'>Geometry</link>.</para>
1019 </section>
1020 <section xml:id="atoms.random-perturbation">
1021 <title xml:id="atoms.random-perturbation.title">Randomly perturb atoms</title>
1022 <para>The positions of a set of selected atom(s) can be randomly
1023 perturbed by giving a maximum noise level..</para>
1024 <programlisting>... --random-number-distribution "uniform_01" \
1025 --random-perturbation 0.1</programlisting>
1026 <para>This will perturb all atomic positions by adding a vector
1027 with components chosen randomly from the interval [-level, level].</para>
1028 <para>Note that the manner these random numbers are picked depends
1029 on the current random number distribution (and also on the engine),
1030 see <link linkend='randomization'>Randomization</link>. The default
1031 one will not give good results, therefore the example uses the
1032 uniform_01 distribution</para>
1033 </section>
1034 <section xml:id="atoms.remove-atom">
1035 <title xml:id="atoms.remove-atom.title">Removing atoms</title>
1036 <para>Removing atom(s) does not need any option and operates on the
1037 currently selected ones.</para>
1038 <programlisting>... --remove-atom</programlisting>
1039 </section>
1040 <section xml:id="atoms.saturate-atom">
1041 <title xml:id="atoms.saturate-atom.title">Saturating atoms</title>
1042 <para>Newly instantiated atoms have no bonds to any other atom. If
1043 you want to fill up their valence by a slew of hydrogen atoms
1044 residing on a sphere around this atom, use this action.</para>
1045 <programlisting>
1046 ... --saturate-atoms
1047 </programlisting>
1048 <para>A number of hydrogen atoms is added around each selected atom
1049 corresponding to the valence of the chemical element. The hydrogen
1050 atoms are placed at the same distance to the selected atom which is
1051 taken from an internal database for the typical hydrogen bond length
1052 and approximately with same distance to their nearest neighbor
1053 hydrogens. Already present bonds (i.e. the position of neighboring
1054 atoms) are taken into account and left intact.</para>
1055 </section>
1056 <section xml:id="atoms.translate-atom">
1057 <title xml:id="atoms.translate-atom.title">Translating atoms</title>
1058 <para>In order to translate the current selected subset of atoms you
1059have to specify a translation vector.</para>
1060 <programlisting>
1061 ... --translate-atoms &quot;-1,0,0&quot; \
1062 --periodic 0
1063 </programlisting>
1064 <para>This translates all atoms by &quot;-1&quot; along the x axis and does not
1065 mind the boundary conditions, i.e. it might shift atoms outside of the
1066 domain.</para>
1067 <para>Again, note that instead of giving an explicit vector you may
1068 also use a vector stored as a geometry object, see section
1069 <link linkend='geometry'>Geometry</link>.</para>
1070 </section>
1071 <section xml:id="atoms.mirror-atoms">
1072 <title xml:id="atoms.mirror-atoms.title">Mirroring atoms</title>
1073 <para>Present (and selected) atoms can be mirrored with respect to
1074 a certain plane. You have to specify the normal vector of the plane
1075 and the offset with respect to the origin as follows</para>
1076 <programlisting>
1077 ... --mirror-atoms &quot;1,0,0&quot; \
1078 --plane-offset 10.1 \
1079 --periodic 0
1080 </programlisting>
1081 <para>And of course instead of giving an explicit vector you may also
1082 use a vector stored as a geometry object, see section
1083 <link linkend='geometry'>Geometry</link>.</para>
1084 </section>
1085 <section xml:id="atoms.translate-to-origin">
1086 <title xml:id="atoms.translate-to-origin.title">Translating atoms to origin</title>
1087 <para>The following Action is convenient to place a subset of atoms
1088 at a known position, the origin, and then translate them to some other
1089 absolute coordinate. It calculates the average position of the set
1090 of selected atoms and then translates all atoms by the negative of
1091 this center, i.e. the center over all selected atoms is afterwards at the origin.</para>
1092 <programlisting>... --translate-to-origin</programlisting>
1093 <para>Note that this naturally does not heed the boundary conditions of the simulation domain.</para>
1094 </section>
1095 <section xml:id="atoms.change-element">
1096 <title xml:id="atoms.change-element.title">Changing an atoms element </title>
1097 <para>You can easily turn lead or silver into gold, by selecting the
1098 silver atom and calling the change element action.</para>
1099 <programlisting>... --change-element Au</programlisting>
1100 </section>
1101 </section>
1102 <section xml:id="bond">
1103 <title xml:id="bond.title">Bond-related manipulation</title>
1104 <para>Atoms can also be manipulated with respect to the bonds.
1105 <remark>Note that with bonds we always mean covalent bonds.</remark> First, we explain how to modify the bond structure itself, then we go
1106 in the details of using the bond information to change bond distance
1107 and angles.</para>
1108 <section xml:id="bond.create-adjacency">
1109 <title xml:id="bond.create-adjacency.title">Creating a bond graph </title>
1110 <para>In case you have loaded a configuration file with no bond
1111 information, e.g. XYZ, it is necessary to create the bond graph.
1112 This is done by either of two options, based on a heuristic criterion.</para>
1113 <para>By default it is based on van-der-Waals radii,
1114 i.e. if we look at two atoms indexed by &quot;a&quot; and &quot;b&quot;</para>
1115 <equation>
1116 <title></title>
1117 <mml:math display="block">
1118 <mml:mrow>
1119 <mml:mi>V(a) + V(b) - &tau; &lt;</mml:mi>
1120 <mml:msub>
1121 <mml:mi>R</mml:mi>
1122 <mml:mn>ab</mml:mn>
1123 </mml:msub>
1124 <mml:mi>&lt; V(a) + V(b) + &tau;</mml:mi>
1125 </mml:mrow>
1126 </mml:math>
1127 </equation>
1128 where
1129 <inlineequation>
1130 <mml:math display="inline">
1131 <mml:mrow>
1132 <mml:mi>V(.)</mml:mi>
1133 </mml:mrow>
1134 </mml:math>
1135 </inlineequation>
1136 is the lookup table for the radii for a given element and \tau is a threshold value, set to 0.4.
1137 <para>As a alternative option, you may load a file containing bond table
1138 information.</para>
1139 <programlisting>... --bond-table table.dat</programlisting>
1140 <para>which would parse a file <filename>table.dat</filename> for a
1141 table giving typical bond distances between elements a and b. These
1142 are used in the above criterion as
1143 <inlineequation>
1144 <mml:math display="inline">
1145 <mml:mrow>
1146 <mml:mi>V(a,b)</mml:mi>
1147 </mml:mrow>
1148 </mml:math>
1149 </inlineequation>
1150 in place of
1151 <inlineequation>
1152 <mml:math display="inline">
1153 <mml:mrow>
1154 <mml:mi>V(a) + V(b)</mml:mi>
1155 </mml:mrow>
1156 </mml:math>
1157 </inlineequation>
1158 .</para>
1159 <para>In either case,</para>
1160 <programlisting>... --create-adjacency</programlisting>
1161 <para> will then create the bond graph based on above criterion.</para>
1162 </section>
1163 <section xml:id="bond.destroy-adjacency">
1164 <title xml:id="bond.destroy-adjacency.title">Destroying the bond graph</title>
1165 <para>The bond graph can be removed completely (and all bonds along
1166 with it).</para>
1167 <programlisting>... --destroy-adjacency</programlisting>
1168 </section>
1169 <section xml:id="bond.correct-bonddegree">
1170 <title xml:id="bond.correct-bonddegree.title">Correcting bond degrees</title>
1171 <para>Typically, after loading an input file with bond information, e.g.
1172 a PDB file, the bond graph is complete but we lack the weights. That
1173 is we do not know whether a bond is single, double, triple, ...
1174 This action corrects the bond degree by enforcing charge neutrality
1175 among the connected atoms.
1176 </para>
1177 <para>This action is in fact quadratically scaling in the number of
1178 atoms. Hence, for large systems this may take longer than expected.
1179 </para>
1180 <programlisting>... --correct-bonddegree</programlisting>
1181 <para>However, in normal use scenarios the action is fast and linear scaling.</para>
1182 </section>
1183 <section xml:id="bond.depth-first-search">
1184 <title xml:id="bond.depth-first-search.title">Analysing a bond graph</title>
1185 <para>You can perform a depth-first search analysis that reveals
1186 cycles and other graph-related information.</para>
1187 <programlisting>... --depth-first-search</programlisting>
1188 <para>Note that this will only print some information and has no other impact on the state.</para>
1189 </section>
1190 <section xml:id="bond.subgraph-dissection">
1191 <title xml:id="bond.subgraph-dissection.title">Dissecting the molecular system into molecules</title>
1192 <para>The bond graph information can be used to recognize the
1193 molecules within the system. It removes the current bond graph (if
1194 any bonds are presents) and recreates it. Afterwards it walks it along
1195 and finds any disconnected subgraphs, associating a molecule with
1196 each. Note that this is just structural information and does not
1197 change the state of the system.</para>
1198 <programlisting>... --subgraph-dissection</programlisting>
1199 </section>
1200 <section xml:id="bond.update-molecules">
1201 <title xml:id="bond.update-molecules.title">Updating molecule structure</title>
1202 <para>When the bond information has changed, new molecules might
1203 have formed, this action updates all the molecules by scanning
1204 the connectedness of the bond graph of the molecular system. </para>
1205 <para>Moreover, Imagine you have just loaded a PDB file
1206 containing bond information. However, initially all atoms are dumped
1207 into the same molecule. Before you can start manipulating, you need
1208 to dissect the system into individual molecules.
1209 </para>
1210 <programlisting>... --update-molecules</programlisting>
1211 </section>
1212 <section xml:id="bond.adds-bond">
1213 <title xml:id="bond.adds-bond.title">Adding a bond manually</title>
1214 <para>When the automatically created adjacency or bond graph
1215 contains faulty bonds or lacks some, you can add them manually.
1216 </para>
1217 <programlisting>... --add-bonds</programlisting>
1218 <para>If two atoms are selected, the single bond in between is added, if not
1219already present. If more than two atoms are selected, than the
1220 bond between any pair of these is added.</para>
1221 <note>
1222 <para>This is especially useful in conjunction with the
1223 fragmentation scheme (explained later on). If you want to know the contribution from
1224 certain fragments whose subgraph is not connected, you can simply
1225 make the associated subset of atoms connected by selecting all
1226 bonds and adding the bonds.</para>
1227 </note>
1228 </section>
1229 <section xml:id="bond.remove-bonds">
1230 <title xml:id="bond.remove-bonds.title">Removing a bond manually </title>
1231 <para>In much the same way as adding a bond, you can also remove a
1232 bond.</para>
1233 <programlisting>... --remove-bonds</programlisting>
1234 <para>Similarly, if more than two atoms are selected, then all bonds
1235 found between any pair of these is removed.</para>
1236 </section>
1237 <section xml:id="bond.set-bond-degree">
1238 <title xml:id="bond.set-bond-degree.title">Setting the bond degree manually </title>
1239 <para>The bond degrees are usually automatically set to fulfill the
1240 valency constraints of each bond partner. However, degrees can also be
1241 set manually for a set of selected atoms. Note that the degree is set
1242 to the given value for all bonds in between any pair of atoms within
1243 the set.</para>
1244 <programlisting>... --set-bond-degree 2</programlisting>
1245 <para>Similarly, if more than two atoms are selected, then all bonds
1246 found between any pair of these are modified.</para>
1247 </section>
1248 <section xml:id="bond.save-bonds">
1249 <title xml:id="bond.save-bonds.title">Saving bond information </title>
1250 <para>Bond information can be saved to a file in
1251 <productname>TREMOLO </productname>&apos;s dbond style.</para>
1252 <programlisting>... --save-bonds system.dbonds</programlisting>
1253 <para>Similarly is the following Action which saves the bond
1254 information as a simple list of one atomic id per line and in
1255 the same line, separated by spaces, the ids of all atoms connected
1256 to it.</para>
1257 <programlisting>... --save-adjacency system.adj</programlisting>
1258 <para>This corresponds to the <emphasis role="bold">bond-file</emphasis> Action.</para>
1259 </section>
1260 <section xml:id="fileparsers.bond-file">
1261 <title xml:id="fileparsers.bond-file.title">Load extra bond information</title>
1262 <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>
1263 <programlisting>... --bond-file water.dbond</programlisting>
1264 <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>
1265 </section>
1266 <section xml:id="bond.stretch-bond">
1267 <title xml:id="bond.stretch-bond.title">Stretching a bond</title>
1268 <para>Stretching a bond actually refers to translation of the
1269 associated pair of atoms. However, this action will keep the rest of
1270 the molecule to which both atoms belong to invariant as well.</para>
1271 <programlisting>... --stretch-bond 1.2</programlisting>
1272 <para>This scales the original bond distance to the new bond
1273 distance 1.2, shifting the right hand side and the left hand side of
1274 the molecule accordingly.</para>
1275 <warning>
1276 <para>this fails with aromatic rings (but you can always
1277 undo).</para>
1278 </warning>
1279 <note>The action will uses typical bond distances, taken from
1280 <link linkend='bond.create-adjacency'>bond-table</link> to scale
1281 the bond length if the desired bond length is non-positive.</note>
1282 </section>
1283 <section xml:id="bond.change-bond-angle">
1284 <title xml:id="bond.change-bond-angle.title">Changing a bond angle </title>
1285 <para>In the same way as stretching a bond, you can change the angle
1286 in between two bonds. This works if exactly three atoms are selected
1287 and two pairs are bonded.</para>
1288 <programlisting>... --change-bond-angle 90</programlisting>
1289 <para>This will change the angle from its value to 90 degrees by
1290 translating the two outer atoms of this triangle (the atom connected
1291 to both other atoms serves as rotation joint).</para>
1292 </section>
1293 <section xml:id="bond.evaluate-chemical-space">
1294 <title xml:id="bond.evaluate-chemical-space.title">Evaluate the Chemical Space</title>
1295 <para>Imagine that we are given a graph consisting of nodes and edges.
1296 As we have been speaking extensively of the adjacency graph before, then
1297 any graph where nodes are assigned a chemical element and edges are given
1298 a degree, effectively represent a molecule of covalently bonded atoms.</para>
1299 <para>This is the notion behind constructing parts of the chemical space that
1300 encompasses all molecules that either already exist or could be devised,
1301 i.e. that are stable.</para>
1302 <para>One method of creating points in this chemical space, i.e. stable
1303 molecules, is presented in the article by Hamaekers et al. 2017, where
1304 they follow the well-known <emphasis>octet rule</emphasis>.</para>
1305 <para>In this action essentially the same method is implemented. Given
1306 an arbitrary graph, encoded as Graph6 string, such as produced by
1307 the <link xlink:href="http://users.cecs.anu.edu.au/~bdm/nauty/">nauty</link>
1308 toolset (Brendan McKay and Adolfo Piperno), and a set of chemical
1309 elements, the action creates every possible molecule using the graph
1310 and the given elements for each of its nodes, changing bond degrees
1311 as long as to fulfil the octet rule.</para>
1312 <programlisting>--evaluate-chemical-space \
1313 --graph6 "B`" --elements C C</programlisting>
1314 <para>The graph6 string "B`" represents the simplest graph consisting
1315 of just two nodes, connected by a single edge. Designating each node
1316 to be a carbon atom, this action will then produce the carbonhydrates
1317 C2H6, C2H4, and C2H2.</para>
1318 <para>At the moment, the molecules are not created but their signatures
1319 are used in looking up the fragments in the internal homology container,
1320 see <link linkend="fragmentation">Fragmentation </link> and
1321 <link linkend="homology">Homologies</link>. Instead of creating atomic
1322 coordinates, approximate energies are given that allow to estimate
1323 whether the molecule candidate is stable or not. Note that this requires
1324 that a suitable homology container file has been loaded first that contains
1325 all necessary fragments.</para>
1326 <note>The graph is automatically saturated with hydrogens in obeying
1327 the octet rule, i.e. hydrogen should not be given in the list of elements.</note>
1328 <para>Using nauty that produces all possible graphs with a fixed number
1329 of nodes, these can be simply fed into <productname>MoleCuilder </productname>
1330 to produce all associated molecules.</para>
1331 </section>
1332 </section>
1333 <section xml:id="molecule">
1334 <title xml:id="molecule.title">Manipulate molecules</title>
1335 <para>Molecules are agglomerations of atoms that are (covalently) bonded. Hence,
1336 the Actions working on molecules differ from those working on atoms.
1337 Joining two molecules can only be accomplished by adding a bond in
1338 between, and in the reverse fashion splitting a molecule by removing
1339some or even all bonds in between. The Actions below mostly deal with copying
1340 molecules. Removing of molecules is done via selecting the molecule&apos;s
1341 atoms and removing them, which removes the atoms as well.</para>
1342 <note>
1343 <para>Initially when you load a file via the input action all atoms
1344 are placed in a single molecule despite any present bond
1345 information, see <link linkend="fragmentation">Dissecting the molecular system into molecules</link></para>
1346 </note>
1347 <section xml:id="molecule.copy">
1348 <title xml:id="molecule.copy.title">Copy molecules</title>
1349 <para>A basic operation is to duplicate a molecule. This works on a
1350 single, currently selected molecule. Afterwards, we elaborate on a
1351 more complex manner of copying, filling a specific shape with
1352 molecules.</para>
1353 <programlisting>
1354 ... --copy-molecule \
1355 --position &quot;10,10,10&quot;
1356 </programlisting>
1357 <para>This action copies the selected molecule and inserts it at the
1358 position (10,10,10) in the domain with respect to the molecule&apos;s
1359 center. In effect, it copies all the atoms of the original molecule
1360 and adds new bonds in between these copied atoms such that their
1361 bond subgraphs are identical.</para>
1362 <para>Here, instead of giving an explicit vector you may also use
1363 a vector stored as a geometry object, see section
1364 <link linkend='geometry'>Geometry</link>.</para>
1365 </section>
1366 <section xml:id="molecule.change-molname">
1367 <title xml:id="molecule.change-molname.title">Change a molecules name</title>
1368 <para>You can change the name of a molecule which is important for
1369 selection.</para>
1370 <programlisting>... -change-molname &quot;test</programlisting>
1371 <para>This will change the name of the (only) selected molecule to
1372 &quot;test&quot;.</para>
1373 <para>Connected with this is the default name an unknown molecule
1374 gets.</para>
1375 <programlisting>... --default-molname test</programlisting>
1376 <para>This will change the default name of new molecules to
1377 &quot;test&quot;.</para>
1378 <note>
1379 <para>Note that a molecule loaded from file gets the filename
1380 (without suffix) as its name.</para>
1381 </note>
1382 </section>
1383 <section xml:id="molecule.remove-molecule">
1384 <title xml:id="molecule.remove-molecule.title">Remove molecules </title>
1385 <para>This removes one or multiple selected molecules.</para>
1386 <programlisting>... -remove-molecule</programlisting>
1387 <para>This essentially just removes all of the molecules&apos; atoms
1388 which in turn also causes the removal of the molecule.</para>
1389 </section>
1390 <section xml:id="molecule.translate-molecules">
1391 <title xml:id="molecule.translate-molecules.title">Translate molecules </title>
1392 <para>This translates one or multiple selected molecules by a
1393 specific offset..</para>
1394 <programlisting>... -translate-molecules</programlisting>
1395 <para>As before, this is actually just an operation on all of the
1396 molecule&apos;s atoms, namely translating them.</para>
1397 <para>Same as with <link linkend='atoms.translate-atom'>translate-atoms</link>
1398 instead of giving an explicit vector you may also use a vector stored
1399 as a geometry object, see section
1400 <link linkend='geometry'>Geometry</link>.</para>
1401 </section>
1402 <section xml:id="molecule.rotate-around-bond">
1403 <title xml:id="molecule.rotate-around-bond.title">Rotate around bond </title>
1404 <para>This rotates parts of a molecule around a given bond, i.e. the
1405 bond vector becomes the rotation axis but only atoms on the side of
1406 second atom get rotated. This naturally does not work for bonds in a
1407 cycle.</para>
1408 <programlisting>
1409 ... --rotate-around-bond &quot;90&quot; \
1410 --bond-side 0
1411 </programlisting>
1412 </section>
1413 <section xml:id="molecule.rotate-around-self">
1414 <title xml:id="molecule.rotate-around-self.title">Rotate around self </title>
1415 <para>You can rotate a molecule around its own axis.</para>
1416 <programlisting>
1417 ... --rotate-around-self &quot;90&quot; \
1418 --axis &quot;0,0,1&quot;
1419 </programlisting>
1420 <para>This rotates the molecule around the z axis by 90 degrees as
1421 if the origin were at its wn center of origin.</para>
1422 </section>
1423 <section xml:id="molecule.rotate-around-origin">
1424 <title xml:id="molecule.rotate-around-origin.title">Rotate around origin</title>
1425 <para>In the same manner the molecule can be rotated around an
1426 external origin.</para>
1427 <programlisting>
1428 ... --rotate-around-origin 90 \
1429 --position &quot;0,0,1&quot;\
1430 </programlisting>
1431 <para>This rotates the molecule around an axis from the origin to
1432 the position (0,0,1), i.e. around the z axis, by 90 degrees, where
1433 for the position you may also use a stored vector, see section
1434 <link linkend='geometry'>Geometry</link>.</para>
1435 </section>
1436 <section xml:id="molecule.rotate-to-principal-axis-system">
1437 <title xml:id="molecule.rotate-to-principal-axis-system.title"> Rotate to principal axis system</title>
1438 <para>The principal axis system is given by an ellipsoid that mostly
1439 matches the molecules shape. The principal axis system can be
1440 simply determined by</para>
1441 <programlisting>... --principal-axis-system</programlisting>
1442 <para>To rotate the molecule around itself to align with this system
1443 do as follows</para>
1444 <programlisting>... --rotate-to-principal-axis-system &quot;0,0,1&quot;
1445 </programlisting>
1446 <para>This rotates the molecule in such a manner that the ellipsoids
1447 largest axis is aligned with the z axis. <remark>Note that
1448 &quot;0,0,-1&quot; would align anti-parallel.</remark></para>
1449 <para>Again instead of giving the coordinates explicitly you may also
1450 use a vector stored as a geometry object, see section
1451 <link linkend='geometry'>Geometry</link>.</para>
1452 </section>
1453 <section xml:id="molecule.verlet-integration">
1454 <title xml:id="molecule.verlet-integration.title">Perform verlet integration</title>
1455 <para>Atoms not only have a position, but each instance also stores
1456 velocity and a force vector. These can be used in a velocity verlet
1457 integration step. Velocity verlet is an often employed time
1458 integration algorithm in molecular dynamics simulations.</para>
1459 <programlisting>
1460 ... --verlet-integration \
1461 --deltat 0.1 \
1462 --keep-fixed-CenterOfMass 0
1463 </programlisting>
1464 <para>This will integrate with a timestep of
1465 <inlineequation>
1466 <mml:math display="inline">
1467 <mml:mrow>
1468 <mml:mi>
1469 <mml:msub>
1470 <mml:mi>&Delta;</mml:mi>
1471 <mml:mn>t</mml:mn>
1472 </mml:msub>
1473 <mml:mi>= V(a) + V(b)</mml:mi>
1474 </mml:mi>
1475 </mml:mrow>
1476 </mml:math>
1477 </inlineequation>
1478 and correcting forces and velocities such that
1479 the sum over all atoms is zero.</para>
1480 <note>Although it may be useful in rare cases to use this Action
1481 directly, most of the time it is far more convenient to use the
1482 MakroAction <link linkend="dynamics.molecular-dynamics">molecular-dynamics</link>
1483 which incorporates also the force calculation and allows for time
1484 integration over more than just a single time step.</note>
1485 </section>
1486 <section xml:id="molecule.force-annealing">
1487 <title xml:id="molecule.force-annealing.title">Anneal the atomic forces</title>
1488 <para>This will shift the atoms in a such a way as to decrease (or
1489 anneal) the forces acting upon them.</para>
1490 <para>Forces may either be already present for the set of atoms by
1491 some other way (e.g. from a prior fragmentation calculation) or,
1492 as shown here, loaded from an external file. We anneal the forces for
1493 one step with a certain initial step width of 0.5 atomic time
1494 units and do not create a new timestep for each optimization
1495 step.</para>
1496 <programlisting>... --force-annealing \
1497 --forces-file test.forces \
1498 --deltat 0.5 \
1499 --steps 1 \
1500 --output-every-step 0
1501 </programlisting>
1502 <note>Same as before, although in rare useful, we refer to the
1503 MakroAction <link linkend="dynamics.optimize-structure">optimize-structure</link>
1504 which incorporates also the force calculation and allows for
1505 structure optimization over more than just a single step.</note>
1506 </section>
1507 <section xml:id="molecule.linear-interpolation-of-trajectories">
1508 <title xml:id="molecule.linear-interpolation-of-trajectories.title"> Linear interpolation between configurations</title>
1509 <para>This is similar to verlet integration, only that it performs
1510 a linear integration irrespective of the acting atomic forces.
1511 </para>
1512 <para>The following call will produce an interpolation between the
1513 configurations in time step 0 and time step 1 with 98 intermediate
1514 steps, i.e. current step 1 will end up in time step 99. In this
1515 case an identity mapping is used to associated atoms in start and
1516 end configuration.</para>
1517 <programlisting>... --linear-interpolation-of-trajectories \
1518 --start-step 0 \
1519 --end-step 1 \
1520 --interpolation-steps 100 \
1521 --id-mapping 1
1522 </programlisting>
1523 </section>
1524 </section>
1525 <section xml:id="domain">
1526 <title xml:id="domain.title">Manipulate domain</title>
1527 <para>Here, we elaborate on how to duplicate all the atoms inside the
1528 domain, how to scale the coordinate system, how to center the atoms
1529 with respect to certain points, how to realign them by given
1530 constraints, how to mirror and most importantly how to specify the
1531 domain.</para>
1532 <section xml:id="domain.change-box">
1533 <title xml:id="domain.change-box.title">Changing the domain</title>
1534 <para>The domain is specified by a symmetric 3x3 matrix. The
1535 eigenvalues (diagonal entries in case of a diagonal matrix) give the
1536 length of the edges, additional entries specify transformations of
1537 the box such that it becomes a more general parallelepiped.</para>
1538 <programlisting>... change-box &quot;20,0,20,0,0,20&quot;</programlisting>
1539 <para>As the domain matrix is symmetric, six values suffice to fully
1540 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
1541 20.<warning>
1542 <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>
1543 </warning></para>
1544 </section>
1545 <section xml:id="domain.bound-in-box">
1546 <title xml:id="domain.bound-in-box.title">Bound atoms inside box </title>
1547 <para>The following applies the current boundary conditions to the
1548 atoms. In case of periodic or wrapped boundary conditions the atoms
1549 will be periodically translated to be inside the domain
1550 again.</para>
1551 <programlisting>... --bound-in-box</programlisting>
1552 </section>
1553 <section xml:id="domain.center-in-box">
1554 <title xml:id="domain.center-in-box.title">Center atoms inside the domain</title>
1555 <para>This is a combination of changing the box and bounding the
1556 atoms inside it.</para>
1557 <programlisting>... --center-in-box &quot;20,0,20,0,0,20&quot;</programlisting>
1558 </section>
1559 <section xml:id="domain.center-edge">
1560 <title xml:id="domain.center-edge.title">Center the atoms at an edge</title>
1561 <para>MoleCuilder can calculate the minimum box (parallel to the
1562 cardinal axis) all atoms would fit in and translate all atoms in
1563 such a way that the lower, left, front edge of this minimum is at
1564 the origin (0,0,0).</para>
1565 <programlisting>... --center-edge</programlisting>
1566 </section>
1567 <section xml:id="domain.add-empty-boundary">
1568 <title xml:id="domain.add-empty-boundary.title">Extending the boundary by adding an empty boundary</title>
1569 <para>In the same manner as above a minimum box is determined that
1570 is subsequently expanded by a boundary of the given additional
1571 thickness. This applies to either side, i.e. left and right, top and bottom, front and back.</para>
1572 <programlisting>... --add-empty-boundary &quot;5,5,5&quot;</programlisting>
1573 <para>This will enlarge the box in such a way that every atom is at
1574 least by a distance of 5 away from the boundary of the domain (in
1575 the infinity norm).</para>
1576 </section>
1577 <section xml:id="domain.scale-box">
1578 <title xml:id="domain.scale-box.title">Scaling the box</title>
1579 <para>You can enlarge the domain by simple scaling factors.</para>
1580 <programlisting>... --scale-box &quot;1,1,2.5&quot;</programlisting>
1581 <para>Here, the domain is stretched in the z direction by a factor
1582 of 2.5. Also, all positions are scaled by the same factor.</para>
1583 </section>
1584 <section xml:id="domain.repeat-box">
1585 <title xml:id="domain.repeat-box.title">Repeating the box</title>
1586 <para>Under periodic boundary conditions often only the minimal
1587 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
1588 added to the current state of the system by repeating the box, i.e.
1589 the box along with all contained atoms is copied and placed
1590 adjacently.</para>
1591 <programlisting>... --repeat-box &quot;1,2,2&quot;</programlisting>
1592 <para>This will create a 2x2 grid of the current domain, replicating
1593 it along the y and z direction along with all atoms. If the domain
1594 contained before a single water molecule, we will now have four of
1595 them.</para>
1596 </section>
1597 <section xml:id="domain.set-boundary-conditions">
1598 <title xml:id="domain.set-boundary-conditions.title">Change the boundary conditions</title>
1599 <para>Various boundary conditions can be applied that affect how
1600 certain Actions work, e.g. translate-atoms. We briefly give a list
1601 of all possible conditions:</para>
1602 <itemizedlist>
1603 <listitem>
1604 <para>Wrap</para>
1605 <para>Coordinates are wrapped to the other side of the domain,
1606 i.e. periodic boundary conditions.</para>
1607 </listitem>
1608 <listitem>
1609 <para>Bounce</para>
1610 <para>Coordinates are bounced back into the domain, i.e. they
1611 are reflected from the domain walls.</para>
1612 </listitem>
1613 <listitem>
1614 <para>Ignore</para>
1615 <para>No boundary conditions apply.</para>
1616 </listitem>
1617 </itemizedlist>
1618 <para>The following will set the boundary conditions to periodic.
1619 </para>
1620 <programlisting>... --set-boundary-conditions &quot;Wrap Wrap Wrap&quot;</programlisting>
1621 <para>Note that boundary conditions are not enforced unless explicitly requested, e.g. by the <emphasis role="bold">bound-in-box</emphasis> action</para>
1622 </section>
1623 </section>
1624 <section xml:id="filling">
1625 <title xml:id="filling.title">Filling</title>
1626 <para>Filling a specific part of the domain with one type of
1627 molecule, e.g. a water molecule, is the more advanced type of
1628 copying of a molecule (see <emphasis role="bold">copy-molecule</emphasis>) and for this we need several
1629 ingredients.</para>
1630 <para>First, we need to specify the part of the domain. This is done
1631 via a shape. We have already learned how to create and select
1632 shapes. The currently selected shape will serve as the fill-in
1633 region.</para>
1634 <para>Then, there are three types of filling: domain, volume, and
1635 surface. The domain is filled with a regular grid of fill-in points.
1636 A volume and a surface are filled by a set of equidistant points
1637 distributed within the volume or on the surface of a selected
1638 shape. The latter is closed connected to the respective shape selected. Molecules will then be copied and translated points when they
1639 &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>
1640 <remark>Note however that not all combinations may already be fully working.</remark>
1641 <para>The filler procedure checks each fill-in point whether there
1642 is enough space for the set of atoms. To this end, we require a cluster
1643 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
1644 combined with a bounding box that contains all of them and serves as
1645 its minimal volume. I.e. we need such a cluster. For this a number of
1646 atoms have to be specified, the minimum bounding box is generated
1647 automatically by which it is checked whether sufficient space is available at the fill-in point.</para>
1648 <para>On top of that, molecules can be selected whose volume is
1649 additionally excluded from the filling region.</para>
1650 <section xml:id="filling.fill-regular-grid">
1651 <title xml:id="filling.fill-regular-grid.title">Fill the domain with molecules</title>
1652 <para>The call to fill the volume of the selected shape with the
1653 selected atoms is then as follows,</para>
1654 <programlisting>
1655 ... --fill-regular-grid \
1656 --mesh-size &quot;5,5,5&quot; \
1657 --mesh-offset &quot;.5,.5,.5&quot; \
1658 --DoRotate 1 \
1659 --min-distance 1. \
1660 --random-atom-displacement 0.05 \
1661 --random-molecule-displacement 0.4 \
1662 --tesselation-radius 2.5
1663 </programlisting>
1664 <para>This generates a cardinal grid of 5x5x5 fill-in points within the
1665 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
1666 by a random rotation matrix, each atom is translated randomly by at
1667 most 0.05, each molecule&apos;s center similarly but at most by 0.4. The selected
1668 molecules&apos; volume is obtained by tesselating their surface and
1669 excluding every fill-in point whose distance to this surface does
1670 not exceed 1. We refer to our comments in
1671 <link linkend="randomization">Randomization</link>for details on
1672 changing the randomness and obtaining some extra flexibility thereby.</para>
1673 </section>
1674 <section xml:id="filling.fill-volume">
1675 <title xml:id="filling.fill-volume.title">Fill a shape&apos;s volume with molecules</title>
1676 <para>More specifically than filling the whole domain with molecules,
1677 maybe except areas where other molecules already are, we also can
1678 fill only specific parts by selecting a shape and calling upon
1679 the following action:</para>
1680 <programlisting>
1681 ... --fill-volume \
1682 --counts 12 \
1683 --min-distance 1. \
1684 --DoRotate 1 \
1685 --random-atom-displacement 0.05 \
1686 --random-molecule-displacement 0.4 \
1687 --tesselation-radius 2.5
1688 </programlisting>
1689 <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>
1690 </section>
1691 <section xml:id="filling.fill-surface">
1692 <title xml:id="filling.fill-surface.title">Fill a shape&apos;s surface with molecules</title>
1693 <para>Filling a surface is very similar to filling its volume.
1694 Again the number of equidistant points has to be specified.
1695 However, randomness is constrained as the molecule has to be aligned
1696 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
1697 to the largest principal axis of the filler molecule and will
1698 be aligned parallel to the surface normal at the fill-in point.
1699This is the same syntax as with <emphasis role="bold">rotate-around-self</emphasis>. </para>
1700 <para>The call below will fill in 12 points with a minimum distance
1701 between the instances of 1 angstroem. We allow for certain random
1702 displacements and use the z-axis for aligning the molecules on
1703 the surface.</para>
1704 <programlisting>
1705 ... --fill-surface \
1706 --counts 12 \
1707 --min-distance 1. \
1708 --DoRotate 1 \
1709 --random-atom-displacement 0.05 \
1710 --random-molecule-displacement 0.4 \
1711 --Alignment-Axis &quot;0,0,1&quot;
1712 </programlisting>
1713 <para>Note that instead of giving an explicit axis you may also use
1714 a vector stored as a geometry object, see section
1715 <link linkend='geometry'>Geometry</link>.</para>
1716 </section>
1717 <section xml:id="filling.suspend-in-molecule">
1718 <title xml:id="filling.suspend-in-molecule.title">Suspend in molecule </title>
1719 <para>Add a given molecule in the simulation domain in such a way
1720 that the total density is as desired.</para>
1721 <programlisting>
1722 ... --suspend-in-molecule 1.
1723 </programlisting>
1724 </section>
1725 <section xml:id="filling.fill-molecule">
1726 <title xml:id="filling.fill-molecule.title">Fill in molecule</title>
1727 <para>This action will be soon be removed.</para>
1728 <programlisting>
1729 ... --fill-molecule
1730 </programlisting>
1731 </section>
1732 <section xml:id="filling.fill-void">
1733 <title xml:id="filling.fill-void.title">Fill void with molecule </title>
1734 <para>This action will be soon be removed.</para>
1735 <programlisting>
1736 ... --fill-void
1737 </programlisting>
1738 </section>
1739 </section>
1740 <section xml:id="analysis">
1741 <title xml:id="analysis.title">Analysis</title>
1742 <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>
1743 <section xml:id="analysis.pair-correlation">
1744 <title xml:id="analysis.pair-correlation.title">Pair Correlation </title>
1745 <para>For two given elements Pair correlation checks on the typical
1746 distance in which they can be found with respect to one another. E.g. for
1747 water one might be interested what is the typical distance for
1748 hydrogen and oxygen atoms.</para>
1749 <programlisting>... --pair-correlation \
1750 --elements 1 8 \
1751 --bin-start 0 \
1752 --bin-width 0.7 \
1753 --bin-end 10 \
1754 --output-file histogram.dat \
1755 --bin-output-file bins.dat \
1756 --periodic 0
1757 </programlisting>
1758 <para>This will compile a histogram for the interval [0,10] in steps
1759 of 0.7 and increment a specific bin if the distance of one such pair
1760 of a hydrogen and an oxygen atom can be found within its distance
1761 interval. These data files can be used for plotting the distribution right away in order to check on the correlation between the elements.</para>
1762 <para>The action may also be called with just a single element in the
1763 option <emphasis>elements</emphasis>. This will then trigger a pair
1764 correlation between all atoms of this element and the set of
1765 currently selected atoms.</para>
1766 </section>
1767 <section xml:id="analysis.dipole-correlation">
1768 <title xml:id="analysis.dipole-correlation.title">Dipole Correlation </title>
1769 <para>The dipole correlation is similar to the pair correlation, only
1770 that it correlates the orientation of dipoles in the molecular
1771 system with one another.</para>
1772 <para>Note that the dipole correlation works on the currently
1773 selected molecules, e.g. all water molecules if so selected.</para>
1774 <programlisting>... --dipole-correlation \
1775 --bin-start 0 \
1776 --bin-width 0.7 \
1777 --bin-end 10 \
1778 --output-file histogram.dat \
1779 --bin-output-file bins.dat \
1780 --periodic 0
1781 </programlisting>
1782 <para>Hence, instead of calculating a function of the distance in [0,infinity), it calculates the angular histogram in [0,2pi).</para>
1783 </section>
1784 <section xml:id="analysis.dipole-angular-correlation">
1785 <title xml:id="analysis.dipole-angular-correlation.title">Dipole Angular Correlation</title>
1786 <para>The dipole angular correlation looks at the angles of a
1787 dipole over time. It takes the orientation of a certain time step
1788 as the zero angle and bins all other orientations found in later
1789 time steps relative to it.
1790 </para>
1791 <para>Note that in contrast to the dipole correlation the dipole
1792 angular correlation works on the molecules determined by a formula.
1793 This is because selections do not work over time steps as molecules
1794 might change.
1795 </para>
1796 <programlisting>... --dipole-angular-correlation H2O \
1797 --bin-start 0 \
1798 --bin-width 5 \
1799 --bin-end 360 \
1800 --output-file histogram.dat \
1801 --bin-output-file bins.dat \
1802 --periodic 0 \
1803 --time-step-zero 0
1804 </programlisting>
1805 </section>
1806 <section xml:id="analysis.point-correlation">
1807 <title xml:id="analysis.point-correlation.title">Point Correlation </title>
1808 <para>Point correlation is very similar to pair correlation, only
1809 that it correlates not positions of atoms among one another but
1810 against a fixed, given point.</para>
1811 <programlisting>... --point-correlation \
1812 --elements 1 8 \
1813 --position &quot;0,0,0&quot; \
1814 --bin-start 0 \
1815 --bin-width 0.7 \
1816 --bin-end 10 \
1817 --output-file histogram.dat \
1818 --bin-output-file bins.dat \
1819 --periodic 0
1820 </programlisting>
1821 <para>This would calculate the correlation of all hydrogen and
1822 oxygen atoms with respect to the origin.</para>
1823 <para>Naturally, instead of giving explicit coordinates you may also
1824 use a vector stored as a geometry object for position, see section
1825 <link linkend='geometry'>Geometry</link>.</para>
1826 </section>
1827 <section xml:id="analysis.surface-correlation">
1828 <title xml:id="analysis.surface-correlation.title">Surface Correlation</title>
1829 <para>The surface correlation calculates the distance of a set
1830 of atoms with respect to a tesselated surface.</para>
1831 <programlisting>... --surface-correlation \
1832 --elements 1 8 \
1833 --bin-start 0 \
1834 --bin-width 0.7 \
1835 --bin-end 10 \
1836 --output-file histogram.dat \
1837 --bin-output-file bins.dat \
1838 --periodic 0
1839 </programlisting>
1840 </section>
1841 <section xml:id="analysis.molecular-volume">
1842 <title xml:id="analysis.molecular-volume.title">Molecular Volume </title>
1843 <para>This simply calculates the volume that a selected molecule
1844 occupies. For this the molecular surface is determined via a
1845 tesselation of its surface. Note that this surface is minimal in
1846 that respect that each node of the tesselation consists of an atom
1847 of the molecule.</para>
1848 <programlisting>... --molecular-volume</programlisting>
1849 <note>The rolling sphere used in the tesselation algorithm has a
1850 default diameter of 10 angström.</note>
1851 </section>
1852 <section xml:id="analysis.average-molecule-force">
1853 <title xml:id="analysis.average-molecule-forcetitle">Average force acting on a molecule</title>
1854 <para>This sums up all the forces of each atom of a currently
1855 selected molecule and returns the average force vector. This should
1856 give you the general direction of acceleration of the molecule.
1857 </para>
1858 <programlisting>... --molecular-volume</programlisting>
1859 </section>
1860 </section>
1861 <section xml:id="fragmentation">
1862 <title xml:id="fragmentation.title">Fragmentation</title>
1863 <para>Fragmentation refers to a so-called linear-scaling method called
1864 &quot;Bond-Order diSSection in an ANOVA-like fashion&quot; (BOSSANOVA),
1865 developed by <personname>Frederik Heber</personname>. In this section
1866 we briefly explain what the method does and how the associated actions
1867 work.</para>
1868 <para>The central idea behind the BOSSANOVA scheme is to fragment the
1869 graph of the molecular system into connected subgraphs of a certain
1870 number of vertices, namely a fixed number of atoms. To give an example, loading a ethane atom
1871 with the chemical formula C2H6, fragmenting the molecule up to order 1
1872 means creating two fragments, both methane-like from either carbon
1873 atom including surrounding hydrogen atoms. Fragmenting up to order 2
1874 would return both the methane fragments and additionally the full
1875 ethane molecule as it resembles a fragment of order 2, namely
1876 containing two (non-hydrogen) atoms.</para>
1877 <para>The reason for doing this is that usual ab-initio calculations
1878 of molecular systems via methods such as Density Functional Theory or
1879 Hartree-Fock scale at least as
1880 <inlineequation>
1881 <mml:math display="inline">
1882 <mml:mrow>
1883 <mml:mi>O(</mml:mi>
1884 <mml:msup>
1885 <mml:mi>M</mml:mi>
1886 <mml:mn>3</mml:mn>
1887 </mml:msup>
1888 <mml:mi>)</mml:mi>
1889 </mml:mrow>
1890 </mml:math>
1891 </inlineequation>
1892 with the number of atoms
1893 <inlineequation>
1894 <mml:math display="inline">
1895 <mml:mrow>
1896 <mml:mi>M</mml:mi>
1897 </mml:mrow>
1898 </mml:math>
1899 </inlineequation>
1900 . 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
1901 number of fragment molecules becomes a linear scaling operation with the number of atoms. In the doctoral thesis of Frederik
1902 Heber, it is explained why this is a sensible ansatz mathematically
1903 and shown that it delivers a very good accuracy if electrons (and
1904 hence interactions) are in general localized.</para>
1905 <para>Long-range interactions (e.g. Coulomb or van-der-Waals interactions) are artificially truncated, however,
1906 with this fragmentation ansatz. It can be obtained in a perturbation manner
1907 by sampling the resulting electronic and nuclei charge density on a
1908 grid, summing over all fragments, and solving the associated Poisson
1909 equation. Such a calculation is implemented via the solver
1910 <productname>vmg</productname> by Julian Iseringhausen that is
1911 contained in the <link xlink:href="http://www.scafacos.org/">
1912 <productname>ScaFaCoS</productname>
1913 </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>
1914 <para>Note that we treat hydrogen special (but can be switched off) as
1915 fragments are calculated as closed shell (total spin equals zero).
1916 Also, we use hydrogen to saturate any dangling bonds that occur as
1917 bonds are cut when fragmenting a molecule (this, too, can be switched
1918 off).</para>
1919 <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>
1920 <para>Note that the molecular system itself is not touched in any way by this fragmentation. </para>
1921 <section xml:id="fragmentation.fragment-molecule">
1922 <title xml:id="fragmentation.fragment-molecule.title">Fragmenting a molecular system</title>
1923 <para>For the current selection of atoms, all fragments consisting
1924 of these (sub)set of atoms are created in the following
1925 manner.</para>
1926 <programlisting>
1927 ... --fragment-molecule &quot;BondFragment&quot; \
1928 --DoCyclesFull 1 \
1929 --distance 3. \
1930 --order 3 \
1931 --grid-level 5 \
1932 --output-types xyz mpqc
1933 </programlisting>
1934 <para>We go through each of the options one after the other. During
1935 fragmentation some files are created storing state information, i.e.
1936 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
1937 a common prefix, here &quot;BondFragment&quot;. Then, we specify that cycles
1938 should be treated fully. This compensates for electrons in aromatic
1939 rings being delocalized over the ring. If cycles in the graph,
1940 originating from aromatic rings, are always calculated fully, i.e.
1941 the whole ring becomes a fragment, we partially overcome these
1942 issues. This does however not work indefinitely and accuracy of the
1943 approximation is limited (
1944 <inlineequation>
1945 <mml:math display="inline">
1946 <mml:mrow>
1947 <mml:mi>&gt;</mml:mi>
1948 <mml:msup>
1949 <mml:mi>10</mml:mi>
1950 <mml:mn>-4</mml:mn>
1951 </mml:msup>
1952 </mml:mrow>
1953 </mml:math>
1954 </inlineequation>) in systems with many interconnected aromatic
1955 rings, such as graphene. Next, we give a distance cutoff of 3 angstroem used
1956 in bond graph creation. Then, we specify the maximum order, i.e. the
1957 maximum number of (non-hydrogen) atoms per fragment, here 3. The
1958 higher this number the more expensive the calculation becomes
1959 (because substantially more fragments are created) but also the more
1960 accurate. The grid level refers to the part where long-range Coulomb
1961 interactions are calculated. This is done via solving the associated
1962 Poisson equation with a multigrid solver -- however, this requires the <productname>JobMarket</productname> package. As input the solver
1963 requires the density which is sampled on a cartesian grid whose
1964 resolution these parameter defines (<inlineequation>
1965 <mml:math display="inline">
1966 <mml:mrow>
1967 <mml:msup>
1968 <mml:mi>2</mml:mi>
1969 <mml:mn>level</mml:mn>
1970 </mml:msup>
1971 </mml:mrow>
1972 </mml:math>
1973 </inlineequation>). And finally, we give the output file formats,
1974 i.e. which file formats are used for writing each fragment
1975 configuration (prefix is &quot;BondFragment&quot;, remember?). Here, we use
1976 XYZ (mainly for checking the configurations visually) and MPQC,
1977 which is a very robust Hartree-Fock solver. We refer to the
1978 discussion of the <link linkend="fileparsers">Parsers</link>
1979 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>
1980 <para>After having written all fragment configuration files, you
1981 need to calculate each fragment, grab the resulting energy (and
1982 force vectors) and place them into a result file manually. This at
1983 least is necessary if you have specified output-types above. If not,
1984 the fragments are not written to file but stored internally. Read
1985 on.</para>
1986 <para>All created fragments, i.e. their id sets, are stored in an
1987 internal structure that associates each atom with all fragments it
1988 is contained in. This AtomFragments container structure can be parsed
1989 and stored, see <link linkend="atomfragments">AtomFragments</link>.
1990 They are used e.g. for fitting partial charges. There, a selection of
1991 atoms is used to fit partial charges to all fragments (and the charge
1992 grids obtained from long-range calculations, see <link linkend="fragmentation.fragment-automation">FragmentAutomation</link>,
1993 and the container is needed to know all fragments.
1994 <note>This structure is cleared by this action and created fragment
1995 information is inserted afterwards, i.e. it contains only the
1996 associations from the current fragmentation.</note>
1997 </para>
1998 </section>
1999 <section xml:id="fragmentation.fragment-automation">
2000 <title xml:id="fragmentation.fragment-automation.title">Calculating fragment energies automatically</title>
2001 <para>Another way of doing this is enabled if you have
2002the <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
2003 client/server ansatz, i.e. two (or more) independent programs are
2004 running (even on another computer but connected via an IP network),
2005 namely a server and at least one client. The server receives
2006 fragment configurations from MoleCuilder and assigns these to a
2007 client who is not busy. The client launches an executable that is
2008 specified in the work package he is assigned and gathers after
2009 calculation a number of values, likewise specified in the package.
2010 The results are gathered together by the server and can be requested
2011 from MoleCuilder once they are done. This essentially describes what
2012 is happening during the execution of this action.</para>
2013 <para>Stored fragment jobs can also be parsed again, i.e. reversing
2014 the effect of having output-types specified in <link linkend="fragmentation.fragment-molecule">Fragmenting a molecule </link>.</para>
2015 <programlisting>
2016 ... --parse-fragment-jobs \
2017 --fragment-jobs &quot;BondFragment00.in&quot; &quot;BondFragment01.in&quot; \
2018 --fragment-path &quot;./&quot; \
2019 --grid-level 5
2020 </programlisting>
2021 <para>Here, we have specified two files, namely
2022 <filename>BondFragment00.in</filename> and
2023 <filename>BondFragment01.in</filename>, to be parsed from the path
2024 &quot;./&quot;, i.e. the current directory. Also, we have specified to sample
2025 the electronic charge density obtained from the calculated ground
2026 state energy solution with a resolution of 5 (see fragment molecule
2027 and also below).</para>
2028 <para>This allows for automated and parallel calculation of all
2029 fragment energies and forces directly within MoleCuilder. The
2030 FragmentationAutomation action takes the fragment configurations
2031 from an internal storage wherein they are placed if in
2032 FragmentMolecule no output-types have been specified.</para>
2033 <programlisting>
2034 ... --fragment-automation \
2035 --fragment-executable mpqc \
2036 --DoLongrange 1 \
2037 --DoValenceOnly 1 \
2038 --grid-level 5 \
2039 --interpolation-degree 3 \
2040 --near-field-cells 4 \
2041 --server-address 127.0.0.1 \
2042 --server-port 1025
2043 </programlisting>
2044 <para>Again, we go through each of the action&apos;s options step by
2045 step.</para>
2046 <para>The executable is required if you do not have a patched
2047 version of <productname>MPQC</productname> that may directly act as
2048 a client to JobMarket&apos;s server.</para>
2049 <note>
2050 <para>Long-calculations are only possible with a client that knows
2051 how to handle VMG jobs. If you encounter failures, then it is most
2052 likely that you do not have a suitable client.</para>
2053 </note>
2054 <para>In the next line, we have all options related to calculation
2055 of long-range interactions. We only sample valence charges on the
2056 grid, i.e. not core electrons and the nuclei charges are reduced
2057 suitably. This avoids problems with sampling highly localized
2058 charges on the grid and is in general recommended. Next, there
2059 follow parameters for the multi grid solver, namely the resolution
2060 of the grid, see under fragmenting the molecule, the interpolation
2061 degree and the number of near field cells. A grid level of 6 is
2062 recommended but costly in terms of memory, the other values are at
2063 their recommend values.</para>
2064 <para>In the last line, parameters are given on how to access the
2065 JobMarket server, namely it address and its port. If the JobMarket
2066 package is not available, then these option values cannot be given.
2067 Instead the solver is called internally on the same machine and one
2068 fragment energy is calculated after the other.</para>
2069 <note>The structure storing the fragment results internally is
2070 cleared prior to this action and calculated fragment results
2071 is inserted afterwards, i.e. it contains only the
2072 calculations from the current run.</note>
2073 <note>All calculated results may be placed in a result file for
2074 later parsing, see
2075 <link linkend="fragmentation.save-fragment-results">save fragment results</link>
2076 .</note>
2077 </section>
2078 <section xml:id="fragmentation.clear-fragment-state">
2079 <title xml:id="fragmentation.clear-fragment-state.title"> Clear fragmentation state</title>
2080 <para>MoleCuilder keeps an internal state about the fragmentation
2081 process in order to make calculations more efficient.</para>
2082 <para>This state contains for example the current bond order used
2083 at a "site", namely an atom. When the same molecule is fragmented
2084 again, then certain results can be reused or simply improved upon.</para>
2085 <para>However, if the molecule has changed, e.g., because the element
2086 of an atom was modified which changes saturation and invalidates this
2087 caching of results, then this state needs to be reset manually.</para>
2088 <para>This is done by calling the action by</para>
2089 <programlisting>
2090 ... --clear-fragment-state \
2091 </programlisting>
2092 <note>This action is at the moment irreversible, i.e. it cannot be
2093 undone.</note>
2094 </section>
2095 <section xml:id="fragmentation.analyse-fragment-results">
2096 <title xml:id="fragmentation.analyse-fragment-results.title"> Analyse fragment results</title>
2097 <para>After the energies and force vectors of each fragment have
2098 been calculated, they need to be summed up to an approximation for
2099 the energy and force vectors of the whole molecular system. This is
2100 done by calling this action.</para>
2101 <programlisting>
2102 ... --analyse-fragment-results \
2103 --fragment-prefix &quot;BondFragment&quot; \
2104 --store-grids 1
2105 </programlisting>
2106 <para>The purpose of the prefix should already be known to you. The
2107 last option states that the sampled charge densities and the
2108 calculated potential from the long-range calculations should be
2109 stored with the summed up energies and forces. Note that this makes
2110 the resulting files substantially larger (Hundreds of megabyte or
2111 even gigabytes as currently the densities are stored on the full cartesian grid). Fragment energies and forces are stored in
2112 so-called internal homology containers. These are explained in the
2113 next section.</para>
2114 <para>Note that this action sets the force vector if these have been
2115 calculated for the fragment. Hence, a
2116 <link linkend="molecule.verlet-integration">verlet integration</link>
2117 is possible afterwards.</para>
2118 <note>If not obtained by
2119 <link linkend="fragmentation.fragment-automation">fragment automation</link>
2120 then fragment results need to be parsed from file, see
2121 <link linkend="fragmentation.parse-fragment-results">parse fragment results</link>
2122 .</note>
2123 </section>
2124 <section xml:id="fragmentation.store-saturated-fragment">
2125 <title xml:id="fragmentation.store-saturated-fragment.title">Store a saturated fragment</title>
2126 <para>This will store the currently selected atoms as a fragment
2127 where all dangling bonds (by atoms that are connected in the bond
2128 graph but have not been selected as well) are saturated with
2129 additional hydrogen atoms.</para>
2130 <para>This can work two ways: Either the saturated fragment is
2131 written to file. If not "output-types" is given, then the fragment
2132 will instead be written to the FragmentQueue. In other words, its
2133 energy is calculated when <link linkend="fragmentation.fragment-automation">fragment automation</link> is used.</para>
2134 <programlisting>
2135 ... --store-saturated-fragment \
2136 --DoSaturate 1 \
2137 --output-types xyz
2138 </programlisting>
2139 <para>Alternatively, use the following to store in fragment job
2140 queue.</para>
2141 <programlisting>
2142 ... --store-saturated-fragment \
2143 --DoSaturate 1 \
2144 --grid-level 6
2145 --max_meshwidth 0.3
2146 </programlisting>
2147 </section>
2148 <section xml:id="fragmentation.parse-fragment-jobs">
2149 <title xml:id="fragmentation.parse-fragment-jobs.title">Parse fragment jobs from files</title>
2150 <para>The fragment jobs that are created by
2151 <link linkend="fragmentation.fragment-molecule">fragment molecule</link>
2152 may also be placed in a file for later retrieval. See the details of
2153 this action on how to create one file per job.</para>
2154 <para>Later, for parsing these job files, we need to use the parse
2155 fragment jobs action as follows:</para>
2156 <programlisting>
2157 ... --parse-fragment-jobs \
2158 --fragment-jobs &quot;BondFragment00.in&quot; &quot;BondFragment01.in&quot; \
2159 --fragment-path &quot;./&quot;
2160 </programlisting>
2161 <para>Here, we give a list of files by the first option and the second
2162 option gives an optional path where all these files are stored.</para>
2163 </section>
2164 <section xml:id="fragmentation.parse-fragment-results">
2165 <title xml:id="fragmentation.parse-fragment-results.title">Parse calculated fragment results from file</title>
2166 <para>Fragment results can either be obtained directly from
2167 solving the associated electronic structure problem for each
2168 of the fragment jobs. Or if that has been done at some earlier
2169 stage and results have been written to a file, see
2170 <link linkend="fragmentation.save-fragment-results">save fragment results</link>
2171 , then we may also parse these results.</para>
2172 <programlisting>
2173 ... --parse-fragment-results &quot;results.dat&quot;
2174 </programlisting>
2175 </section>
2176 <section xml:id="fragmentation.save-fragment-results">
2177 <title xml:id="fragmentation.save-fragment-results.title">Save calculated fragment results to file</title>
2178 <para>Calculated fragment results may be stored to a single file
2179 for later analysis as follows:</para>
2180 <programlisting>
2181 ... --save-fragment-results &quot;results.dat&quot;
2182 </programlisting>
2183 <note>Beware though that files from long-range calculations may be
2184 very large and are stored quite inefficiently at the moment.</note>
2185 </section>
2186 </section>
2187 <section xml:id="homology">
2188 <title xml:id="homology.title">Homologies</title>
2189 <para>After a fragmentation procedure has been performed fully, what
2190 to do with the results? The forces can be used for time integration and structure optimization but what about
2191 the energies? The energy value is basically the function evaluation of
2192 the Born-Oppenheimer surface of the molecular system. For molecular dynamics simulations
2193 continuous ab-initio calculations to evaluate the Born-Oppenheimer
2194 surface, especially the gradient at the current position of the molecular system&apos;s configuration, is not feasible. Instead usually empirical potential functions
2195 are fitted as to resemble the Born-Oppenheimer surface to a sufficient
2196 degree.</para>
2197 <para>One frequently employed method is the many-body expansion of said surface
2198 which is basically nothing else than the fragmentation ansatz described
2199 above. Potential functions resemble a specific term in this many-body
2200 expansion. These are discussed in the next section.</para>
2201 <para>For each of these terms all homologous fragments (i.e. having
2202 the same atoms with respect to the present elements and bonded in the
2203 same way), differing only in the coordinate of each atom, are just a
2204 sampling or a function evaluation of this term of the many-body
2205 expansion with respect to varying nuclei coordinates. Hence, it is
2206 appropriate to use these function evaluations in a non-linear
2207 regression procedure. That is, we want to tune the parameters of the
2208 empirical potential function in such a way as to most closely obtain
2209 the same function evaluation as the ab-initio calculation did using the
2210 same nuclear coordinates. Usually, this is done in a least-square
2211 sense, minimising the euclidean norm.</para>
2212 <para>Homologies -- in the sense used here -- are then nothing else but containers for a specific
2213 type of fragment of all the different, calculated configurations (i.e.
2214 varying nuclear coordinates of the same fragment, i.e. same atoms with identical bonding).</para>
2215 <para>Now, we explain the actions that parse and store
2216 homologies.</para>
2217 <programlisting>... --parse-homologies homologies.dat</programlisting>
2218 <para>This parses the all homologies contained in the file
2219 <filename>homologies.dat</filename> and <emphasis role="italic">appends</emphasis> them to the homology
2220 container.</para>
2221 <programlisting>... --save-homologies homologies.dat</programlisting>
2222 <para>Complementary, this stores the current contents of the homology
2223 container, <emphasis role="italic">overwriting</emphasis> the file
2224 <filename>homologies.dat</filename>.</para>
2225 </section>
2226 <section xml:id="atomfragments">
2227 <title xml:id="atomfragments.title">AtomFragments</title>
2228 <para>Similarly, to <link linkend="homology">Homologies</link> also
2229 the associations between atoms and the respective fragments they take
2230 part in can be stored to a file and parse again at a later time.</para>
2231 <programlisting>... --parse-atom-fragments atomfragments.dat</programlisting>
2232 <para>This parses the all atom fragment associattions contained in the file
2233 <filename>atomfragments.dat</filename> and <emphasis role="italic">appends</emphasis>
2234 them to the atom fragments associations container.</para>
2235 <programlisting>... --save-atom-fragments atomfragments.dat</programlisting>
2236 <para>Complementary, this stores the current contents of the atom fragments
2237 associations container, <emphasis role="italic">overwriting</emphasis> the file
2238 <filename>atomfragments.dat</filename>.</para>
2239 </section>
2240 <section xml:id="potentials">
2241 <title xml:id="potentials.title">Potentials</title>
2242 <para>In much the same manner as we asked before: what are homology
2243 files or containers good for? However, taking into account what we have just explained, it
2244 should be clear: We fit potential function to these function
2245 evaluations of terms of the many-body expansion of the Born-Oppenheimer
2246 surface of the full system.</para>
2247 <section xml:id="potentials.fit-potential">
2248 <title xml:id="potentials.fit-potential.title">Fitting empirical potentials</title>
2249 <para>Empirical potentials are function that represent a certain aspect
2250 of binding forces in molecular dynamics, e.g. a bond potential represents
2251 the force between two atoms arising because of a binding orbital in
2252 between that may be (in some approximartion) represented by a Hooke's
2253 spring law.
2254 In a more abstract view, an empirical potential consists of the
2255 following: a binding model representable as a graph consisting of nodes
2256 and edges, a function that takes the distance between nodes and the
2257 set of edges (representing bonds in the binding model) and last but
2258 not least a set of parameters that represent the respective strength
2259 of the bonds. For example, a torsion potential has a binding model
2260 containing four nodes and three edges connecting node 1 and 2, 2 and
2261 3, and 3 and 4. The function requires the six interatomic distances. And
2262 the parameters are coefficients in the functions that need to be
2263 evaluated to obtain the resulting force vector.
2264 </para>
2265 <para>In this manner, empirical potentials are implemented in
2266 MoleCuilder. They are not just a function but always an additional
2267 binding model that allows to associate atoms with a specific node
2268 in the model and thereby to assicate it with a particular interatomic
2269 distance. And said model determines in what order the elements have
2270 to be given.
2271 </para>
2272 <para>Let&apos;s take a look at an exemplary call to the fit potential
2273 action.</para>
2274 <programlisting>
2275 ... --fit-potential \
2276 --fragment-charges 8 1 1 \
2277 --potential-charges 8 1 \
2278 --potential-type morse \
2279 --take-best-of 5
2280 </programlisting>
2281 <para>Again, we look at each option in turn. The first is the
2282 charges or elements specifying the set of homologous fragments that
2283 we want to look at. Here, obviously we are interested in water
2284 molecules, consisting of a single oxygen (8) and two hydrogen atoms (1).
2285 Next, we specify the chemical element type of the potential, here a
2286 potential between oxygen (8) and hydrogen (1). We give the type of
2287 the potential as morse, which requires a single distance or two
2288 nuclear coordinates and the distance taken between the two. Finally,
2289 we state that the non-linear regression should be done with five
2290 random starting positions, i.e. five individual minimizations, and
2291 the set of parameters with the smallest L2 norm wins.</para>
2292 <note>
2293 <para>Due to translational and rotational degrees of freedom for
2294 fragments smaller than 7 atoms, it is appropriate to look at the
2295 pair-wise distances and not at the absolute coordinates. In the
2296 case of the water molecule as a the fragment whose energy we
2297 want to represent by a empirical potential, there are 3 atoms
2298 and therefore 3 unique distances between any pair of atoms.
2299 From this set of distances MoleCuilder needs to pick any subset
2300 that matches with the ones required by the binding model.
2301 In our case of the Morse potential, we need two atoms, oxygen
2302 and hydrogen, i.e. a single distance. If we had given a harmonic
2303 angular potential and the then required three charges/elements,
2304 &quot;1 8 1&quot;, i.e. oxygen and two hydrogens, we would have
2305 obtained three distances. The order of the elements, i.e.
2306 &quot;8 1 1&quot; would match a different angular interaction
2307 in the same fragment, depends on the binding model of the
2308 potential. In the case of the harmonic angle, the second element
2309 in the list is the central atom in the angle, while the first and
2310 third atom define either arm of the angle.Naturally, for the Morse
2311 potential the order does not matter as each distance is symmetric.
2312 </para>
2313 <para>MoleCuilder always adds a so-called constant potential to
2314 the fit containing only a single parameter, the energy offset.
2315 This offset compensates for the interaction energy associated with
2316 a fragment of order 1, e.g. a single hydrogen atom. Essentially,
2317 this captures the atomic energy that is not associated to any
2318 binding interactions.</para>
2319 <para>Note that by choosing "set-max-iterations" and "take-best-of"
2320 one can force the optimization to try either a single set of random
2321 initial parameters very thoroughly or many different sets just for
2322 a few iterations. Or any in between.</para>
2323 </note>
2324 </section>
2325 <section xml:id="potentials.fit-compound-potential">
2326 <title xml:id="potentials.fit-compound-potential.title">Fitting many empirical potentials simultaneously</title>
2327 <para>Another way is using a file containing a specific set of
2328 potential functions, possibly even with initial values.</para>
2329 <programlisting>
2330 ... --fit-compound-potential \
2331 --fragment-charges 8 1 1 \
2332 --potential-file water.potentials \
2333 --set-threshold 1e-3 \
2334 --training-file test.dat
2335 </programlisting>
2336 <para>Now, all empirical potential functions are summed up into a
2337 so-called compound potential over the combined set of parameters.
2338 These are now fitted simultaneously. For example, let&apos;s say the potential
2339 file <filename>water.potentials</filename> contains a harmonic bond
2340 potential between oxygen and hydrogen and another angular potential
2341 for the angle between hydrogen, oxygen, and hydrogen atom. Then, we would
2342 fit a function consisting of the sum of the two potentials functions in order to approximate the energy of a single
2343 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
2344<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
2345 for training, i.e. the tuples consisting of the fragments nuclei
2346 coordinates and the associated energy value are written to the file
2347 <filename>test.dat</filename>. This allows for graphical representation or other
2348way 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
2349 <filename>test.dat</filename>.</para>
2350 <para>Note that you can combine the two ways, i.e. start with a
2351 fit-potential call but give an empty potential file. The resulting
2352 parameters are stored in it. Fit other potentials and give different
2353 file names for each in turn. Eventually, you have to combine the file
2354 in a text editor at the moment. And perform a fit-compound-potential
2355 with this file.</para>
2356 <para>Here, also "set-max-iterations" and "take-best-of" can be used
2357 to mix thorough or shallow search from random initial parameter sets.
2358 </para>
2359 </section>
2360 <section xml:id="potentials.parse-potential">
2361 <title xml:id="potentials.parse-potential.title">Parsing an empirical potentials file</title>
2362 <para>Taking part in the compound potential is every potential
2363 function whose signature matches with the designated fragment-charges
2364 and who is currently known to MoleCuilder.</para>
2365 <para>More potentials can be registered (<emphasis role="bold">fit-potential</emphasis> will also
2366 register the potential it fits) by parsing them from a file.</para>
2367 <programlisting>
2368 ... --parse-potentials water.potentials
2369 </programlisting>
2370 <note>Currently, only <productname>TREMOLO</productname>potential files are understood and can be parsed.</note>
2371 </section>
2372 <section xml:id="potentials.save-potential">
2373 <title xml:id="potentials.save-potential.title">Saving an empirical potentials file</title>
2374 <para>The opposite to <emphasis role="bold">parse-potentials</emphasis> is to save all currently registered potential functions to the given
2375 file along with the currently fitted parameters</para>
2376 <programlisting>
2377 ... --save-potentials water.potentials
2378 </programlisting>
2379 <note>Again, only the <productname>TREMOLO</productname>potential format is understood currently and is written.</note>
2380 </section>
2381 <section xml:id="potentials.fit-partial-charges">
2382 <title xml:id="potentials.fit-partial-charges.title">Fitting partial particle charges</title>
2383 <para>The above empirical potential just model the short-range
2384 behavior in the molecular fragment, namely the (covalently) bonded interaction.
2385 In order to model the Coulomb long-range interaction as well without solving
2386 for the electronic ground state in each time step, partial charges
2387 are used that capture to some degree the created dipoles due to
2388 charge transfer from one atom to another when bonded. These are called
2389 partial charges because they combine both nuclei and electronic
2390 charges to yield an in general fractional charge.</para>
2391 <para>Note that so far the placement of partial charges is restricted
2392 to the position of nuclei in the molecular system. There are more
2393 complex ways of placing partial charges, e.g. as employed in higher
2394 TIP water molecules, that also use anti-bonding potentials. This is
2395 so far not implemented.</para>
2396 <para>To allow least-squares regression of these partial charges, we
2397 need the results of long-range calculations and the <emphasis role="bold">store-grids</emphasis>
2398 option (see above under <link linkend="fragmentation">Fragmentation </link>)
2399 must have been given.</para>
2400 <para>Furthermore, we require associations between selected atoms and
2401 the fragments, residing in the <link linkend="homology">Homology container</link>.
2402 These are contained in the <link linkend="atomfragments">AtomFragments association</link>
2403 container, that can also be parsed and stored.</para>
2404 <para>With these sampled charge density and Coulomb potential stored
2405 in the homology containers, we call this action as follows.</para>
2406 <programlisting>
2407 ... --fit-partial-charges \
2408 --potential-file water.particles \
2409 --radius 1.5
2410 </programlisting>
2411 <para>Assume that a water molecule has been selected previously. Then
2412 all homologous fragments that contain any of the water molecules are
2413 used as &quot;key&quot; to request all configurations of this type
2414 from the homologies container. For each of the atoms then an average
2415 partial charge is computed by fitting their respective Coulomb
2416 potential to the obtained from the fragment calculations. Resulting
2417 values are stored in <filename>water.particles</filename>. The
2418 radius is used to mask a certain region directly around the nuclei
2419 from the fit procedure. As here the charges of the core electrons and
2420 the nuclei itself dominate, we however are only interested in a good
2421 approximation to the long-range potential, this mask radius allows
2422 to give the range of the excluded zone.</para>
2423 </section>
2424 <section xml:id="potentials.parse-particle-parameters">
2425 <title xml:id="potentials.parse-particle-parameters.title">Parsing a particles file</title>
2426 <para>Empirical Potential contain parameters for function that model
2427 interactions between two or more specific particles. However,
2428 interactions can also be more general, such as a Coulomb
2429 potential, that interacts with any other particle with non-zero
2430 charge, or Lennard-Jones potential that interacts with any other
2431 particle close enough.
2432 Parameters for these particles are encoded in the internal Particle
2433 class and are parsed from and stored to a special particles file.
2434 This parse particle parameters function loads the parameters from
2435 a file, instantiates them in a new particle, and registers them
2436 such that they are known within molecuilder.</para>
2437 <para>More particles can be registered (<emphasis role="bold">fit-partial-charges</emphasis> will also
2438 register the particles it fits) by parsing them from a file.</para>
2439 <programlisting>
2440 ... --parse-particle-parameters water.particles
2441 </programlisting>
2442 <note>Currently, only <productname>TREMOLO</productname>particles files are understood and can be parsed.</note>
2443 </section>
2444 <section xml:id="potentials.save-particle-parameters">
2445 <title xml:id="potentials.save-particle-parameters.title">Saving a particles file</title>
2446 <para>The opposite to <emphasis role="bold">parse-particle-parameters</emphasis>
2447 is to save all currently registered particle and their parameters to
2448 the given file.</para>
2449 <programlisting>
2450 ... --save-particle-parameters water.particles
2451 </programlisting>
2452 <note>Again, only the <productname>TREMOLO</productname>particles format is understood currently and is written.</note>
2453 </section>
2454 </section>
2455 <section xml:id="dynamics">
2456 <title xml:id="dynamics.title">Dynamics</title>
2457 <para>For fitting potentials or charges we need many homologous but
2458 different fragments, i.e. atoms with slightly different positions.
2459 How can we generate these?</para>
2460 <para>One possibility is to use molecular dynamics. With the
2461 aforementioned fragmentation scheme we can quickly calculate not only
2462 energies but also forces if the chosen solver, such as
2463 <link xlink:href="http://www.mpqc.org/">
2464 <productname>MPQC </productname>
2465 </link>, supports it. Integrating these forces
2466 discretely over time gives insight into vibrational features of a
2467 molecular system close to the equilibrium and allows to generate those positions for fitting
2468 potentials that describe these vibrations.</para>
2469 <section xml:id="dynamics.molecular-dynamics">
2470 <title xml:id="dynamics.molecular-dynamics.title">Molecular dynamics </title>
2471 <para>The molecular dynamics action is a so-called macro Action,
2472 i.e. it combines several other Actions into one, namely:</para>
2473 <itemizedlist>
2474 <listitem>
2475 <para>--<emphasis role="bold">verlet-integration</emphasis></para>
2476 </listitem>
2477 <listitem>
2478 <para>--<emphasis role="bold">output</emphasis></para>
2479 </listitem>
2480 <listitem>
2481 <para>--<emphasis role="bold">clear-fragment-results</emphasis></para>
2482 </listitem>
2483 <listitem>
2484 <para>--<emphasis role="bold">destroy-adjacency</emphasis></para>
2485 </listitem>
2486 <listitem>
2487 <para>--<emphasis role="bold">create-adjacency</emphasis></para>
2488 </listitem>
2489 <listitem>
2490 <para>--<emphasis role="bold">update-molecules</emphasis></para>
2491 </listitem>
2492 <listitem>
2493 <para>--<emphasis role="bold">fragment-molecule</emphasis></para>
2494 </listitem>
2495 <listitem>
2496 <para>--<emphasis role="bold">fragment-automation</emphasis></para>
2497 </listitem>
2498 <listitem>
2499 <para>--<emphasis role="bold">analyse-fragment-results</emphasis></para>
2500 </listitem>
2501 </itemizedlist>
2502 <para>The following command will perform a molecular dynamics simulation
2503 for 100 time steps, each time step continuing over <emphasis role="bold">deltat</emphasis> equal to 0.5 atomic time units,
2504 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
2505 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
2506 we will not keep the bond graph, i.e bonds and molecules may change
2507 over the simulation and hence also the created fragments per time
2508 step.
2509Furthermore, the forces are corrected such that the force add up to zero. </para>
2510 <programlisting>... --molecular-dynamics \
2511 --steps 100 \
2512 --keep-bondgraph 0 \
2513 --order 3 \
2514 --distance 3. \
2515 --deltat 0.5 \
2516 --keep-fixed-CenterOfMass 1 \
2517 --fragment-executable mpqc \
2518 </programlisting>
2519 <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>
2520 <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>
2521 </section>
2522 <section xml:id="dynamics.optimize-structure">
2523 <title xml:id="dynamics.optimize-structure.title">Structure optimization</title>
2524 <para>Structure optimization is also a macro Action, it basically
2525 combines the same Actions as <emphasis role="bold">molecular-dynamics</emphasis> does. However, it
2526 uses the <emphasis role="bold">force-annealing</emphasis> action instead of <emphasis role="bold">verlet-integration</emphasis>.</para>
2527 <remark>Because it is a MacroAction we cannot use any more elaborate
2528 line search method during the optimization. In essence, we minimize the
2529 energy function that depends on the nuclei coordinates. The function is
2530 non-linear and non-convex. The best choice, given that we have gradient
2531 information, would be the Conjugate Gradient method (such as Fletcher-
2532 Reeves which work well also for non-linear functions). However, these
2533 methods perform a line search along the gradient direction which we
2534 cannot as our Actions do not contain any internal information (apart
2535 from the state for Undo/Redo). Therefore, we are restricted to the
2536 method of Barzilai-Borwein where no line-search is needed but that also
2537 works well for high-dimensional minimization problems.</remark>
2538 <para>The command below performs a structure optimization of the
2539 currently selected atoms (may also be a subset) for up to 100 time
2540 steps, where each time step is again 0.5 atomic time units. The time
2541 step here serves as the initial step width for annealing.
2542 </para>
2543 <programlisting>... --optimize-structure \
2544 --keep-bondgraph 1 \
2545 --output-every-step 1 \
2546 --steps 100 \
2547 --order 3 \
2548 --distance 3. \
2549 --deltat 0.5 \
2550 --keep-fixed-CenterOfMass 1 \
2551 --fragment-executable mpqc
2552 </programlisting>
2553 <para>Note that <emphasis role="bold">output-every-step</emphasis> will allow you to watch the
2554 optimization as each step is placed into a distinct time step.
2555 Otherwise only two time steps would be created: the initial and
2556 the final one containing the optimized structure.</para>
2557 <para>Because of the use of Barzilai-Borwein for computing the
2558 stepwidth we do not need any 'deltat' parameters. If the computed
2559 step width is zero, we use a default step width of 1.</para>
2560
2561 <section xml:id="dynamics.optimize-structure.bondgraph">
2562 <title xml:id="dynamics.optimize-structure.bondgraph.title">... using the bond graph</title>
2563 <para>A more efficient optimization, especially for larger molecules
2564 is obtained, if the bond graph is taken into account. To this end,
2565 the structure optimization can be called as follows:</para>
2566 <programlisting>... --optimize-structure \
2567 --keep-bondgraph 1 \
2568 --output-every-step 1 \
2569 --steps 100 \
2570 --order 3 \
2571 --distance 3. \
2572 --deltat 0.5 \
2573 --keep-fixed-CenterOfMass 1 \
2574 --fragment-executable mpqc \
2575 --use-bondgraph 1 \
2576 --damping-factor 0.5 \
2577 --max-distance 8
2578 </programlisting>
2579 <para>Note that two additional arguments <emphasis role="bold">use-bondgraph</emphasis>,
2580 <emphasis role="bold">damping-factor</emphasis>and
2581 <emphasis role="bold">max-distance</emphasis>. The first will
2582 switch on using the bond graph while the latter two are parameters
2583 controlling its behavior.</para>
2584 <para>Let us briefly sketch the central idea of using the bond graph:
2585 If a specific atom has a non-zero gradient, then this gradient will
2586 cause the atom to be shifted into its negative direction. The
2587 gradient however is a sum of forces acting on this atom from all
2588 other atoms. The gradient therefore states the net effect on the
2589 toal energy if the atom (and only the atom) would be moved according
2590 to its negative direction. In other words, the force on one side of
2591 the atom are stronger than those on the other side, where the
2592 sides are defined by the plane with the gradient as its normal
2593 vector.</para>
2594 <para>The idea now is to not only move the atom itself but also
2595 all atoms in the direction of the negative gradient by a fraction
2596 as well. The underlying notion is that if there is a misplacement
2597 of the said atom under consideration, then this misplacement
2598 will faster spread out to the edges of the molecule and dissipate
2599 there. If we move only the atom, this will cause a lot of
2600 oscillations that will take a while to settle. One might think of
2601 it like the smoothing step of a multigrid solver.
2602 Essentially, we consider the gradient as a local error that is
2603 smoothed out by powers of <emphasis role="bold">damping-factor</emphasis>
2604 the further out we go in the bond graph from the respective
2605 atom till <emphasis role="bold">max-distance</emphasis>. Note that
2606 the distance is here to be understood in the sense of a graph, i.e.
2607 stepping from one atom to a bond neighbor in the bond graph
2608 is a distance of 1.</para>
2609 <note>The truncated power series of the <emphasis role="bold">max-distance</emphasis>
2610 should sum to 1, i.e. values between 0.5 and 1 work well.</note>
2611 <note>Hydrogens due to their typically much ligher mass compared
2612 to other nuclei are excluded from this procedure. They feel the
2613 dampened gradients of others but their gradient acts only on
2614 themselves</note>
2615 <note>Barzilai-Borwein step width sometimes tends to overshoot
2616 as it is a approximation to the secant and assumes linearity. To
2617 counter this, we cap the step width at 0.2 angstroem.</note>
2618 </section>
2619 </section>
2620 <section xml:id="dynamics.step-world-time">
2621 <title xml:id="dynamics.step-world-time.title">Step forward and backward through world time</title>
2622 <para>Some MacroActions are applied for a number of steps and need to
2623 increment the current world time, e.g. molecule dynamics or structure
2624 optimization. To this end, we may call upon
2625 </para>
2626 <programlisting>... --step-world-time 1</programlisting>
2627 <para>Note that the argument gives the number of steps to step forward
2628 and may be any integer. Hence, we may also step backwards.</para>
2629 </section>
2630 <section xml:id="dynamics.set-world-time">
2631 <title xml:id="dynamics.set-world-time.title">Set the world&apos;s time step</title>
2632 <para>In order to inspect or manipulate atoms and molecules at a
2633 certain time step, the World&apos;s time has to be set with the following
2634 Action.
2635 </para>
2636 <para>This will set the World&apos;s time to the fifth step (counting
2637 starts at zero).</para>
2638 <programlisting>... --set-world-time 4</programlisting>
2639 <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>
2640 </section>
2641 <section xml:id="dynamics.save-energies">
2642 <title xml:id="dynamics.save-energies.title">Save the temperature information</title>
2643 <para>For each present time step the temperature (i.e. the average velocity
2644 per atom multiplied with its mass), momentum and force will be stored to a file.</para>
2645 <programlisting> ... --save-energies temperature.dat</programlisting>
2646 <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>
2647 </section>
2648 </section>
2649 <section xml:id="dynamics.tesselation">
2650 <title xml:id="dynamics.tesselation.title">Tesselations</title>
2651 <para>A tesselation is a set of triangles that form a closed surface. They are used to obtain molecular surfaces (and volumes) by rolling
2652 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
2653 surface of connected triangles is created.</para>
2654 <note>Tesselations are used internally by the graphical interface in
2655 order to show molecules by their surface. This is in general faster
2656 than displaying them as a ball-stick model consisting of spheres and
2657 cylinders.</note>
2658 <section xml:id="dynamics.tesselation.nonconvex-envelope">
2659 <title xml:id="dynamics.tesselation.nonconvex-envelope.title"> Non-convex envelope</title>
2660 <para>This will create a non-convex envelope for a molecule and store
2661 it to a file for viewing with external programs.</para>
2662 <programlisting>... --nonconvex-envelope 6. \
2663 --nonconvex-file nonconvex.dat
2664 </programlisting>
2665 <para>This tesselation file can be conveniently viewed with
2666 <productname>TecPlot</productname> or with one of the Tcl script
2667 in the <emphasis role="italic">util</emphasis> folder with <productname>VMD</productname>. Also,
2668 still pictures can be produced with <productname>Raster3D </productname>.
2669 <note>The required file header.r3d can be found in a subfolder of the util folder.</note>
2670 </para>
2671 </section>
2672 <section xml:id="dynamics.tesselation.convex-envelope">
2673 <title xml:id="dynamics.tesselation.convex-envelope.title">Convex envelope</title>
2674 <para>This will create a convex envelope for a molecule and give the
2675 volumes of both the non-convex and the convex envelope. This is good
2676 for measuring the space a molecule takes up, e.g. when filling a
2677 domain and taking care of correct densities.</para>
2678 <programlisting>... --convex-envelope 6. \
2679 --convex-file convex.dat
2680 </programlisting>
2681 <para>This tesselation file can be likewise viewed with
2682 <productname>TecPlot</productname> or with one of the Tcl script
2683 in the util folder with <productname>VMD</productname>.</para>
2684 </section>
2685 </section>
2686 <section xml:id="various">
2687 <title xml:id="various.title">Various commands</title>
2688 <para>Here, we gather all commands that do not fit into one of above
2689 categories for completeness.</para>
2690 <section xml:id="various.verbose">
2691 <title xml:id="various.verbose.title">Changing verbosity</title>
2692 <para>The verbosity level is the amount of stuff printed to screen.
2693 This information will in general help you to understand when
2694 something does not work. Mind the <emphasis>ERROR</emphasis> and
2695 <emphasis>WARNING</emphasis> messages in any case.</para>
2696 <para>This command below sets the verbosity from default of 2 to 4,</para>
2697 <programlisting>... --verbose 4</programlisting>
2698 <para>or shorter,</para>
2699 <programlisting>... -v 4</programlisting>
2700 </section>
2701 <section xml:id="various.dry-run">
2702 <title xml:id="various.dry-run.title">Dry runs</title>
2703 <para>A &quot;dry run&quot; refers to a test run where commands are not
2704 actually executed. You may bracket a certain set of actions by
2705 putting --<emphasis role="bold">dry-run</emphasis> before and --<emphasis role="bold">no-dry-run</emphasis> afterwards. Then, all
2706 actions in between will be looked at but not executed, i.e. they
2707 make it to the history but nothing is changed in the World.</para>
2708 <para>As an example, the following listing contains the adding of a
2709 hydrogen atom at position (5,5,5) inside the aforementioned dry run
2710 statements. Hence, no hydrogen atom is added but the <emphasis role="bold">add-atom</emphasis> action is
2711 stored in the history and will make it to a stored session.</para>
2712 <programlisting>... --dry-run \
2713 --add-atom 1 --domain-position &quot;5,5,5&quot;
2714 --no-dry-run</programlisting>
2715 <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>
2716 </section>
2717 <section xml:id="various.element-db">
2718 <title xml:id="various.element-db.title">Loading an element database</title>
2719 <para>Element databases contain information on valency, van der
2720 Waals-radii and other information for each element.</para>
2721 <para>This loads all element database from the current folder (in a
2722 unix environment):</para>
2723 <programlisting>... --element-db ./</programlisting>
2724 </section>
2725 <section xml:id="various.version">
2726 <title xml:id="various.version.title">Giving the version of the program</title>
2727 <para>This prints the version information of the code, especially
2728 important when you request the fixing of bugs or implementation of
2729 features.</para>
2730 <programlisting>... --version</programlisting>
2731 </section>
2732 <section xml:id="various.warranty">
2733 <title xml:id="various.warranty.title">Giving warranty information</title>
2734 <para>As follows warranty information is given,</para>
2735 <programlisting>... --warranty</programlisting>
2736 </section>
2737 <section xml:id="various.help-redistribute">
2738 <title xml:id="various.help-redistribute.title">Giving redistribution information</title>
2739 <para>This gives information on the license and how to redistribute
2740 the program and its source code</para>
2741 <programlisting>... --help-redistribute</programlisting>
2742 </section>
2743 </section>
2744 <section xml:id="sessions">
2745 <title xml:id="sessions.title">Sessions</title>
2746 <para>A session refers to the queue of actions you have executed.
2747 Together with the initial configuration (and all files required for
2748 actions in the queue) this may be seen as a clever way of storing
2749 the state and history of a molecular system manipulation session. When proceeding in a try&amp;error
2750 fashion to construct a certain system, it is a good idea, to store the
2751 session at the point where your attempts start to deviate from one
2752 another.</para>
2753 <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>
2754 <section xml:id="sessions.store-session">
2755 <title xml:id="sessions.store-session.title">Storing a session </title>
2756 <para>Storing sessions is simple,</para>
2757 <programlisting>... --store-session &quot;session.py&quot; \
2758 --session-type python
2759 </programlisting>
2760 <para>Here, the session type is given as python (the other option is
2761&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
2762 python script <filename>session.py</filename> can even be used with
2763 the python interface described below, i.e. it is a full python script
2764 (that however requires the so-called <emphasis role="italic">pyMoleCuilder</emphasis> module).</para>
2765 <note>The python session will store a file with python commands using named arguments. As some actions have quite
2766 a number of arguments, all of them end up in a single function call. This makes it very hazard-prone to mix them up.
2767 Therefore, it is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts
2768 when employing MoleCuilder commands.</note>
2769 <para>When using named arguments for MoleCuilder commands in Python scripts, remember that dashes ("-") in
2770 argument names have been converted to underscores ("_") as the former characters are illegal. Apart from that
2771 the argument names resemble exactly the token names as encountered on the command line, e.g.
2772 <programlisting>
2773 pyMoleCuilder.CommandVerbose(verbose="1")
2774 ...
2775 </programlisting>
2776 where the keyword argument "verbose" is for the Action that changes MoleCuilder's output verbosity. Also,
2777 you see that arguments are always given as string.
2778 </para>
2779 </section>
2780 <section xml:id="sessions.load-session">
2781 <title xml:id="sessions.load-session.title">Loading a session</title>
2782 <para>Loading a session only works for python scripts, i.e. only for session type python and not for type cli. This actually
2783 blurs the line between the command-line interface and the python
2784 interface a bit. Again, MoleCuilder automatically executes a
2785 script called <filename>molecuilder.py</filename> if such a file is
2786 contained in the current directory.</para>
2787 <programlisting>... --load-session &quot;session.py&quot;</programlisting>
2788 <para>This will execute every action with its options contained in the
2789 script <filename>session.py</filename>.</para>
2790 </section>
2791 </section>
2792 <section xml:id="various-specific">
2793 <title xml:id="various-specific.title">Various specific commands </title>
2794 <para>In this (final) section of the action description we list a number
2795 Actions that are very specific to some purposes (or other programs).
2796 </para>
2797 <section xml:id="various-specific.save-selected-atoms-as-exttypes">
2798 <title xml:id="various-specific.save-selected-atoms-as-exttypes.title"> Saving exttypes of a set of atoms</title>
2799 <para>This saves the atomic ids of all currently selected atoms in a
2800 <link xlink:href="http://www.tremolo-x.com/">
2801 <productname>TREMOLO </productname>
2802 </link> exttypes file with the given name.</para>
2803 <programlisting>... --save-selected-atoms-as-exttypes \
2804 --filename test.exttypes </programlisting>
2805 </section>
2806 <section xml:id="various-specific.set-parser-parameters">
2807 <title xml:id="various-specific.set-parser-parameters.title">Setting parser specific parameters</title>
2808 <para>You can tweak the parameters stored in files associated to specific ab initio programs to some extent.
2809 For example, <productname>MPQC</productname> stores various
2810 parameters modifying the specific ab-initio calculation performed, e.g. the basis set used, the level of theory, whether gradients are calculated.
2811 For <link xlink:href="http://www.mpqc.org/">
2812 <productname>MPQC </productname>
2813 </link> and
2814 <link xlink:href="http://www.psicode.org/">
2815 <productname>Psi4 </productname>
2816 </link> this can be modified as follows.</para>
2817 <programlisting>... --set-parser-parameters mpqc \
2818 --parser-parameters &quot;theory=CLHF;basis=6-31*G;&quot;
2819 </programlisting>
2820 <para>This sets the ab-initio theory to closed-shell Hartree-Fock
2821 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
2822 <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>
2823 <itemizedlist>
2824 <listitem>Hessian - yes/no
2825 </listitem>
2826 <listitem>savestate - yes/no
2827 </listitem>
2828 <listitem>do_gradient - yes/no
2829 </listitem>
2830 <listitem>maxiter - positive integer value
2831 </listitem>
2832 <listitem>memory - positive integer value
2833 </listitem>
2834 <listitem>stdapprox
2835 <itemizedlist>
2836 <listitem>A'</listitem>
2837 </itemizedlist>
2838 </listitem>
2839 <listitem>nfzc - positive integer value
2840 </listitem>
2841 <listitem>basis - any basis listed in data folder, e.g.
2842 <itemizedlist>
2843 <listitem>3-21G</listitem>
2844 <listitem>6-31+G*</listitem>
2845 <listitem>...</listitem>
2846 </itemizedlist>
2847 </listitem>
2848 <listitem>aux_basis - same as under basis
2849 </listitem>
2850 <listitem>integration
2851 <itemizedlist>
2852 <listitem>IntegralCints</listitem>
2853 </itemizedlist>
2854 </listitem>
2855 <listitem>theory
2856 <itemizedlist>
2857 <listitem>CLHF</listitem>
2858 <listitem>CLKS</listitem>
2859 <listitem>MBPT2</listitem>
2860 <listitem>MBPT2_R12</listitem>
2861 </itemizedlist>
2862 </listitem>
2863 <listitem>jobtype
2864 <itemizedlist>
2865 <listitem>Default</listitem>
2866 <listitem>Optimization</listitem>
2867 </itemizedlist>
2868 </listitem>
2869 </itemizedlist>
2870 </section>
2871 <section xml:id="various-specific.set-tremolo-atomdata">
2872 <title xml:id="various-specific.set-tremolo-atomdata.title">Tremolo specific options and potential files</title>
2873 <para><productname>TREMOLO</productname>&apos;s configuration files start
2874 with a specific line telling the amount of information that is contained in the
2875 file. This line can be modified, e.g. to enforce storing of
2876 velocities and forces as well as the atoms positions and
2877 element.</para>
2878 <programlisting>... --set-tremolo-atomdata &quot;id element u=3 v=3 F=3&quot; \
2879 --reset 1
2880 </programlisting>
2881 <para>This will not append but reset the old line and fill it with
2882 the given string. </para>
2883 <para>Find a list of all keys that are also used internally in MoleCuilder below:</para>
2884 <itemizedlist>
2885 <listitem><para>id number - Id</para></listitem>
2886 <listitem><para>chemical element - type</para></listitem>
2887 <listitem><para>position - x=3</para></listitem>
2888 <listitem><para>velocity - u=3</para></listitem>
2889 <listitem><para>force - F=3</para></listitem>
2890 <listitem><para>enumerating bonded atom ids - neighbors=4</para></listitem>
2891 <listitem><para>name of atom - name</para></listitem>
2892 <listitem><para>charge - Charge</para></listitem>
2893 </itemizedlist>
2894 <para>Furthermore, find the rest of all available keys:</para>
2895 <itemizedlist>
2896 <listitem><para>stress tensor - stress</para></listitem>
2897 <listitem><para>enumerating bonded atom ids for improper potential - imprData</para></listitem>
2898 <listitem><para>unknown - GroupMeasureTypeNo</para></listitem>
2899 <listitem><para>group association for external forces - exttype</para></listitem>
2900 <listitem><para>residual name of atom (see PDB) - resName</para></listitem>
2901 <listitem><para>chain Id (see PDB) - chainId</para></listitem>
2902 <listitem><para>residual sequence (see PDB) - resSeq</para></listitem>
2903 <listitem><para>occupancy of electron orbitals - occupancy</para></listitem>
2904 <listitem><para>temperature factor - tempFactor</para></listitem>
2905 <listitem><para>segment id (see PDB) - segID</para></listitem>
2906 <listitem><para>different charge - charge</para></listitem>
2907 <listitem><para>unknown - GrpTypeNo</para></listitem>
2908 <listitem><para>enumerating bonded atom ids for torsion potential - torsion</para></listitem>
2909 </itemizedlist>
2910 <para>One further specific action is required when loading certain
2911 <productname>TREMOLO</productname> configuration files. These
2912 contain element notations that refer to parameterized names used in
2913 empirical potentials and molecular dynamics simulations and not the
2914 usual chemical symbols, such as H or O. We may load an auxiliary
2915 file that gives the required conversion from OH1 to H, which is the
2916 so-called potentials file.</para>
2917 <programlisting>... --parse-tremolo-potentials water.potentials</programlisting>
2918 <para>This parses the lookup table from the file
2919 <filename>water.potentials</filename> and it can be used in
2920 following load actions.</para>
2921 <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>
2922 </section>
2923 </section>
2924 </section>
2925 <section xml:id="textmenu-interface">
2926 <title xml:id="textmenu-interface.title">Text menu</title>
2927 <para>We now discuss how to use the text menu interface.</para>
2928 <para>The text menu is very much the interface counterpart to the
2929 command-line interface. However, both work in a terminal session.</para>
2930 <para>In the text menu, actions can be selected from hierarchical lists.
2931 Note that the menus for the graphical interface are organized in the
2932 exactly same way. After an action has been chosen, the option values
2933 have to be entered one after the other. After the last option value has
2934 been given, the action is executed and the result printed to the
2935 screen.</para>
2936 <para>With regards to the other functionality, it is very much the same
2937 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>
2938 </section>
2939 <section xml:id="graphical-user-interface">
2940 <title xml:id="graphical-user-interface.title">Graphical user interface </title>
2941 <para>The main point of the GUI is that it renders the atoms and
2942 molecules visually. These are represented by the common
2943 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
2944 be accessed, activated, and manipulated via tables. Changes made in the
2945 tables cause immediate update of the visual representation. Under the
2946 hood each of these manipulations is nothing but the call to an action,
2947 hence is fully undo- and redoable.</para>
2948 <para>This interface is most helpful in designing more advanced structures that are
2949 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
2950file containing the session may be stored and this script can then be used to construct
2951 various derived or slightly modified structures.</para>
2952 <section xml:id="graphical-user-interface.basic-view">
2953 <title xml:id="graphical-user-interface.basic-view.title">Basic view </title>
2954 <para>Let us first give an impression of the basic view of the GUI after a molecule has been loaded.</para>
2955 <figure>
2956 <title>Screenshot of the basic view of the GUI after loading a file with eight water molecules.</title>
2957 <mediaobject>
2958 <imageobject>
2959 <imagedata width="100%" scalefit="1" entityref="example_basic_view"/>
2960 </imageobject>
2961 </mediaobject>
2962 </figure>
2963 <section xml:id="graphical-user-interface.3d-view">
2964 <title xml:id="graphical-user-interface.3d-view.title">3D view </title>
2965 <para>In the above figure, you see the stick-and-ball representation
2966 of the water molecules, the &quot;dreibein&quot; giving the positive axis
2967 directions and the slightly translucent cuboid of the domain on a black background.</para>
2968 </section>
2969 <section xml:id="graphical-user-interface.information-tabs">
2970 <title xml:id="graphical-user-interface.information-tabs.title"> Information Tabs</title>
2971 <para>Beneath this 3D view that you can rotate at will with your mouse
2972 and zoom in and out with your scroll wheel, you find to the right a
2973 part containing two tabs named Atom and Molecule. Look at where the
2974 mouse pointer is. It has colored the atom underneath in cyan
2975 (although it&apos;s also an oxygen atom and should be colored in rose
2976 as the rest). You can inspect its properties in the tab Atom: Name,
2977 element, mass, charge, position and number of bonds. If you switch
2978 to the Molecule tab, you would see the properties of the water
2979 molecule this specific atom belongs to.</para>
2980 </section>
2981 <section xml:id="graphical-user-interface.shape">
2982 <title xml:id="graphical-user-interface.shape.title">Shape section </title>
2983 <para>Beneath these information tabs you find the shape sections.
2984 There you find a list of all currently created shapes and you can
2985select 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>
2986 </section>
2987 <section xml:id="graphical-user-interface.timeline">
2988 <title xml:id="graphical-user-interface.timeline.title">Timeline </title>
2989 <para>Directly below the 3D view there is a long slider. If a loaded
2990 file has multiple time step entries, this slider allows you to
2991 smoothly select one time frame after another. Sliding it with the
2992 mouse from left to right will reveal the animation that is hidden
2993 behind the distinct snapshots stored in the configuration
2994 file.</para>
2995 </section>
2996 <section xml:id="graphical-user-interface.tables">
2997 <title xml:id="graphical-user-interface.tables.title">Selection tables</title>
2998 <para>Underneath the time line there is another place for
2999 tabs.</para>
3000 <itemizedlist>
3001 <listitem>Molecules</listitem>
3002 <listitem>All Elements</listitem>
3003 <listitem>All Fragments</listitem>
3004 <listitem>All Homologies</listitem>
3005 <listitem>All Geometries</listitem>
3006 <listitem>Logs</listitem>
3007 <listitem>Errors</listitem>
3008 </itemizedlist>
3009 <para>The first is on molecules, listing all present molecules of
3010 the molecular system in a tree view. If you click on a specific
3011 molecule, the one will get selected or unselected depending on its
3012 current selection state (see below for details on this with respect
3013 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>
3014 <para>The next tab enumerates all elements known to MoleCuilder
3015 where the ones are grayed out that are not present in the molecular
3016 system. Clicking on a present element will select all atoms of this
3017 specific element. A subsequent click unselects again.</para>
3018 <para>Subsequently follow two tabs on enumerating the fragments and their
3019 fragment energies if calculated and the homologies along with
3020 graphical depiction (via QWT), again if present.</para>
3021 <para>After that, we have a tab listing all geometry objects. These
3022 are vectors you may store via one of the Actions. If you hover over
3023 a vector, its length is shown. If you have selected one vector and
3024 hover over another one, then the angle between the two is shown.
3025 </para>
3026 <para>Finally, there are two tabs showing log messages of actions
3027 in the first tab and general information on what is currently done. Errors and
3028 warnings are listed in the second tab.</para>
3029 </section>
3030 </section>
3031 <section xml:id="graphical-user-interface.selections">
3032 <title xml:id="graphical-user-interface.selections.title">Selections </title>
3033 <para>Selections work generally always by calling a selection action from the pull-down menu and filling it with required parameters.</para>
3034 <para>With the GUI it may also be accessed directly: The row of icons
3035 above the 3D view has two icons depicting the selection of individual
3036 atoms or molecules. If either of them is selected, clicking with the
3037 left mouse button on an atom will either (un)select the atom or its
3038 associated molecule. Multiple atoms can be selected in this
3039 manner.</para>
3040 <para>Also, the selection tabs may be used by clicking on the name of a
3041 molecule as stated above or at an element.</para>
3042 <para>Similarly, if shapes are present in the shape section, clicking
3043 them will select them and also cause a translucent visualization to
3044 appear in the 3D view. Note that this visualization is quite costly
3045 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>
3046 </section>
3047 <section xml:id="graphical-user-interface.dialogs">
3048 <title xml:id="graphical-user-interface.dialogs.title">Dialogs</title>
3049 <para>Most essential to the GUI are dialogs. Many action
3050 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
3051 value has a specific type, we briefly go into the details of how these
3052 queries look like.</para>
3053 <note>
3054 <para>Each dialog&apos;s okay button is grayed out until all entered option values
3055 are valid.</para>
3056 </note>
3057 <section xml:id="graphical-user-interface.dialogs.domain">
3058 <title xml:id="graphical-user-interface.dialogs.domain.title">Domain query</title>
3059 <figure>
3060 <title>Screenshot of a dialog showing a domain query</title>
3061 <mediaobject>
3062 <imageobject>
3063 <imagedata width="100%" scalefit="1" entityref="dialog_box"/>
3064 </imageobject>
3065 </mediaobject>
3066 <para>In the domain query a 3x3 symmetric matrix has to be
3067 entered. In the above screenshots you notice that the only
3068 non-zero entries are on the main diagonal. Here, we have simply
3069 specified a cube of edge length 8. The okay button will be grayed
3070 out if the matrix is either singular or not symmetric.</para>
3071 </figure>
3072 </section>
3073 <section xml:id="graphical-user-interface.dialogs.element">
3074 <title xml:id="graphical-user-interface.dialogs.element.title"> Element query</title>
3075 <figure>
3076 <title>Screenshot the add atom action containing an element query</title>
3077 <mediaobject>
3078 <imageobject>
3079 <imagedata width="100%" scalefit="1" entityref="dialog_add-atom_tooltip"/>
3080 </imageobject>
3081 </mediaobject>
3082 <para>Elements are picked from a pull-down box where all known
3083 elements are listed.</para>
3084 <para>In this dialog you also notice that a tooltip is given,
3085 briefly explaining what the action does.</para>
3086 </figure>
3087 </section>
3088 <section xml:id="graphical-user-interface.dialogs.action">
3089 <title xml:id="graphical-user-interface.dialogs.action.title"> Complex query</title>
3090 <figure>
3091 <title>Screenshot of a complex dialog consisting of multiple queries</title>
3092 <mediaobject>
3093 <imageobject>
3094 <imagedata width="100%" scalefit="1" entityref="dialog_complex"/>
3095 </imageobject>
3096 </mediaobject>
3097 <para>Here we show a more complex dialog. It queries for strings,
3098 for integer values (see the increase/decrease arrows), for
3099 booleans and for files (the &quot;choose&quot; buttons opens a file
3100 dialog).</para>
3101 </figure>
3102 </section>
3103 <section xml:id="graphical-user-interface.dialogs.exit">
3104 <title xml:id="graphical-user-interface.dialogs.exit.title">Exit query</title>
3105 <figure>
3106 <title>Screenshort showing the exit dialog</title>
3107 <mediaobject>
3108 <imageobject>
3109 <imagedata width="100%" scalefit="1" entityref="dialog_exit"/>
3110 </imageobject>
3111 </mediaobject>
3112 <para>Finally, we show the dialog that will pop up when exiting
3113 the graphical interface. It will ask whether it should store the
3114 current state of the system in the input file or not. You may
3115 cancel the exit, close without saving or save the current
3116 state.</para>
3117 </figure>
3118 </section>
3119 </section>
3120 </section>
3121 <section xml:id="python-interface">
3122 <title xml:id="python-interface.title">Python interface</title>
3123 <para>Last but not least we elaborate on the python interface. We have
3124 already discusses this interface to some extent. The current session,
3125 i.e. the queue of actions you have executed, can be stored as a python
3126 script and subsequently executed independently of the user interface it
3127 was created with. More generally, MoleCuilder&apos;s Actions can be executed within arbitrary python
3128 scripts where prior to its execution a specific module has to be loaded, enabling access to MoleCuilder&apos;s actions from inside the
3129 script.</para>
3130 <para>MoleCuilder&apos;s python module is called <emphasis role="italic">pyMoleCuilder</emphasis>. It is
3131 essentially a library that can be imported into python just as any other
3132 module. Let us assume you have started the python interpreter and you
3133 have added the containing folder of the <filename>pyMoleCuilder</filename>
3134 library to the <varname>PYTHONPATH</varname> variable.</para>
3135 <programlisting>import pyMoleCuilder as mol</programlisting>
3136 <para>Subsequently, you can access the help via</para>
3137 <programlisting>help(mol)</programlisting>
3138 <para>This will list all of MoleCuilder&apos;s actions with their function
3139 signatures within python as contained in the module <emphasis role="italic">pyMoleCuilder</emphasis> named
3140 as <emphasis role="bold">mol</emphasis> in the scope of the currently running interpreter. Note that the
3141 function names are not the names you know from the command-line
3142 interface, they might be called
3143 <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>
3144 <para>Let&apos;s try it out.</para>
3145 <programlisting>print mol.CommandVersion()</programlisting>
3146 <para>This will state the current version of the library.</para>
3147 <para>Go ahead and try out other commands. Refer to the documentation
3148 under the command-line interface and look up the function name via
3149 help.</para>
3150 <para>You can freely mix calls to the pymolecuilder module and other python commands.</para>
3151 <note>However, be aware that all Actions are executed in another thread,
3152 i.e. run in parallel. That means that a pymolecuilder command is not
3153 necessarily finished when python steps on to the next line!</note>
3154 <para>In order to make python wait for the Actions to finish before
3155 stepping, there is the special wait() command.</para>
3156 <programlisting>
3157 mol.MoleculeLoad("...")
3158 mol.wait()
3159 </programlisting>
3160 <para>This will continue first after the molecule has been fully loaded.
3161 </para>
3162 <warning>These wait()s will have no effect if the python script is loaded
3163 via the "load-session" command inside a User Interface (command-line,
3164 GUI, ...) as this would cause the queue to wait indefinitely, namely till
3165 the load-session itself would have finished.</warning>
3166 <para>Therefore, more complex python scripts need to be called with
3167 python and a set PYTHONPATH as described above.</para>
3168 <note>It is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts
3169 when employing MoleCuilder commands. As commands tend to have many arguments, it is very easy to mix
3170 them up as python is not a strongly typed language.</note>
3171 </section>
3172 </chapter>
3173 <chapter>
3174 <title>Conclusions</title>
3175 <para>This ends this user guide.</para>
3176 <para>We have given you a brief introduction to the aim of the program and
3177 how each of the four interfaces are to be used. The rest is up to
3178 you.</para>
3179 <para>Tutorials and more information is available online, see <link xlink:href="http://www.molecuilder.com/">MoleCuilder&apos;s website</link>.
3180 </para>
3181 <para>Be aware that in general knowing how the code works allows you to
3182 understand what&apos;s going wrong if something&apos;s going wrong.</para>
3183 <section>
3184 <title>Thanks</title>
3185 <para>Huge thanks go out to Saskia Metzler who was patient enough to let
3186 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>
3187 </section>
3188 </chapter>
3189</book>
Note: See TracBrowser for help on using the repository browser.