source: doc/userguide/userguide.xml@ 91c409

Candidate_v1.7.0 stable
Last change on this file since 91c409 was a4b917, checked in by Frederik Heber <frederik.heber@…>, 6 weeks ago

Adds add and remove potential actions.

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