source: doc/userguide/userguide.xml@ 3f6aac

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 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 3f6aac was 3f6aac, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

Added (Un)selectAtomByName.

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