(Version: 04 Mar 2021)
|
|
Playmol is a molecular model builder which intends to facilitate the construction of initial setups for Molecular Dynamics simulations of dense systems. It was initially designed as a bridge between the molecular packing generator Packmol and the popular Molecular Dynamics simulator LAMMPS.
The principle of Playmol consists in the bottom-up assembly of molecules and molecular systems by a series of steps like:
Practical examples of the use of Playmol can be found in the section describing all Playmol commands and in a special section with sample scripts.
Playmol interprets scripts composed of specific commands. Each command is a sequence of keywords and parameter values separated by spaces and/or tabs. A script can include comments, identified by the comment mark "#", which instructs Playmol to ignore all trailing characters in the same line. A single command can span several lines by means of continuation marks "&", as in the example below for the bond command:
Except when a for/next construct or an if/then/else construct is found, the execution flow of a Playmol script is sequential. Interpretation of every command line will always follow the three steps below:
Variable assignment is done via the define command. For instance:
The following rules must be observed for choosing a variable name:
A variable can be referenced later on by either preceding its name with a symbol "$" or enclosing it between symbols "${" and "}", with no spaces. For example:
In this example, Playmol would save an xyz file named H2O.xyz
and a LAMMPS data file named H2O_config.lmp
. Note that the use of curly brackets is required in the second line because Playmol would otherwise look for a variable named compound_config
.
Playmol parses and evaluates mathematical or logical expressions placed inside curly brackets. This is done once all variable references have been properly substituted. After evaluating, Playmol will substitute the brackets and the expression by the obtained numerical result. For instance:
Mathematical expressions might result in an integer number or a real number. If it is a logical expression, the result might be either an integer 1
(meaning true
) or an integer 0
(meaning false
). Real numbers might be expressed using a decimal point (e.g. 2.0
) and/or scientific notation (e.g. 1.38E-23
). The order of precedence of mathematical/logical operators is given in Table 1 and the supported mathematical functions are listed in Table 2. Note that there is no specific operator for the logical NOT
in Table 1. It is in fact implemented as the function not()
present in Table 2.
Table 1: Precedence order of mathematical operators
Operator | Description | Precedence |
---|---|---|
| | Logical OR | 1 (lowest) |
& | Logical AND | 2 |
< <= > >= == != | Relational operators | 3 |
+ - | Addition Subtraction | 4 |
* / % | Multiplication Division Remainder | 5 |
Exponentiation | 6 | |
function( ) | Functions (see Table 2) | 7 |
( ) | Parentheses | 8 (highest) |
Table 2: Available mathematical functions
Function | Result type | Description |
---|---|---|
abs | Same as argument | Absolute value |
acos | Real | Inverse cosine |
asin | Real | Inverse sine |
atan | Real | Inverse tangent |
ceil | Integer | Smallest following integer |
cos | Real | Cosine |
cosh | Real | Hyperbolic cosine |
exp | Real | Exponential |
floor | Integer | Largest preceding integer |
int | Integer | Integer part |
ln | Real | Natural logarithm |
log | Real | Decimal logarithm |
nint | Integer | Nearest integer |
not | 0 or 1 | Logical NOT |
sin | Real | Sine |
sinh | Real | Hyperbolic sine |
sqrt | Real | Square root |
tan | Real | Tangent |
tanh | Real | Hyperbolic tangent |