source: doc/userguide/userguide.xml@ 20fc6f

Candidate_v1.7.0 stable
Last change on this file since 20fc6f was 9b0dcd, checked in by Frederik Heber <frederik.heber@…>, 4 years ago

Added potential-list argument to GeneratePotentialsAction.

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