source: doc/userguide/userguide.xml@ 9a4772

Action_Thermostats Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_oldresults ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps
Last change on this file since 9a4772 was f1cacb, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

Fixed several small issues with the userguide.

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