TOML Input References.
November 10, 2025 · View on GitHub
This documentation briefly introduces SOMD's TOML format input file. If you are not familiar with TOML's grammar, you may want to read its documentation first. Similar to the TOML format itself, keys in SOMD's input files are case-sensitive (and are all in lower cases). But the option strings (excepting the keys that define file names) are case-insensitive.
Table of Contents
- The
[system]table. - The
[[group]]array. - The
[[potential]]array. - The
[constraints]table. - The
[integrator]table. - The
[barostat]table. - The
[[trajectory]]array. - The
[[logger]]array. - The
[run]table. - The
[evaluation]table. - The
[[script]]array.
The [system] table.
If Mandatory: yes
Default Value: None
Descriptions: This table defines the simulated system from a structure file.
Keys:
-
structureIf Mandatory: yes
Type:
strDefault Value: None
Descriptions: The initial structure file. This file could be in the POSCAR or the PDB format. SOMD will read the atomic types, atomic positions and the simulation box from this file. Format of this file is identified by its extension name. If the file does not contain a extension name, you could set the
formatkey in this table. -
formatIf Mandatory: no
Type:
strValid Values:
"pdb"or"poscar"Default Value: None
Descriptions: The format of the structure file. If the structure file does not contain an extension name, this option would be useful. Once this key is defined, the extension name of the structure file will be ignored.
Examples:
[system]
structure = "H2O.pdb"
format = "pdb"
[system]
structure = "../POSCAR"
The [[group]] array.
If Mandatory: no
Default Value: One atom group that corresponds to the whole simulated system.
Descriptions: Each table in this array defines an atom group. You could define multiple atom groups.
Keys:
-
atom_listIf Mandatory: yes
Type:
List[int]orstrDefault Value: None
Descriptions: Indices of atoms that belong to this group. The indices may be represented by a list of integers, or a formatted string, which could represent a range of atoms conveniently. For example, the following two values of this key select same atoms:
atom_list = [0, 1, 2, 5, 7, 8, 9]atom_list = "0:3,5,7:10"If you would like to define a group that contains all atoms in the system, you may invoke the following syntactic sugar:
atom_list = "all"SOMD also supports atom selection through the
MDTrajpackage. Such a selection, however, will require the input structure file to be in the PDB format (see the[system]table.). If a PDB file is given, theMDTraj-based selection could be triggered by the following syntex:atom_list = "mdt: selection"whereas string after the
mdt:prefix will be passed toMDTraj.Notes: In SOMD, atom indices start from ZERO.
-
has_translationsIf Mandatory: no
Type:
boolDefault Value:
trueDescriptions: If this group has three translational degrees of freedom (DOFs). As we know, for a homogeneous-phase 3D periodic atomic system, the three total translational DOFs do not exchange energy with all other DOFs. And for an adsorption model, the substrate does not have total translational DOFs at all. As a result, when calculating temperatures and performing thermostating, these DOFs should be excluded. To this end, you should tell SOMD that weather the specified atom group contains translational DOFs, and this is done by defining the "has_translations" key. By setting this key to
false, SOMD will subtract the number of DOFs of this group by three, and regularly remove its total translational momentums during the simulation (if your simulation undergoes a NVE ensemble, after removing the total translational momentums, velocities of atoms in this group will be scaled to conserve the total energy).Notes:
- If two atom groups contain same atoms, total translational DOFs of the
two groups must not absent at the same time. For example, define the
following two atom groups in the same input file will cause
AN ERROR:
[[group]] atom_list = [0, 1, 2, 3, 4, 5] has_translations = false [[group]] atom_list = [3, 4, 5, 6, 7, 8] has_translations = false - If one group fully contains another group, and the smaller group does
not have the total translational DOFs, the number of DOFs of the larger
atom group will be modified as well. For example, under the following
settings, number of DOFs of
GROUP0will be 27 and number of DOFs ofGROUP1will be 12.[[group]] label = "GROUP0" atom_list = "0:9" [[group]] label = "GROUP1" atom_list = [0, 1, 2, 3, 4] has_translations = false - If you have not specified which atom group does not contain the translational DOFs, SOMD will automatically remove the translational DOFs of the whole simulated system.
- If you failed to understand above descriptions, you could safely leave this key alone, and SOMD will handle it for you.
- If two atom groups contain same atoms, total translational DOFs of the
two groups must not absent at the same time. For example, define the
following two atom groups in the same input file will cause
AN ERROR:
-
initial_temperatureIf Mandatory: no
Type:
floatUnit: Kelvin
Default Value: None
Descriptions: Generate random initial velocities for atoms in this group according to the Boltzmann distribution under a given temperature.
Notes: If you have also set the
initial_velocitiesoption, the random velocities generated by this key will be added to the velocities defined by that key. -
initial_velocitiesIf Mandatory: no
Type:
List[List[float]]Dimension: (number of atoms in this group) * 3
Unit: nanometer/picosecond
Default Value: None
Descriptions: The initial Cartesian velocities of each atom in this group.
Notes: If you have also set the
initial_temperatureoption, the random velocities generated by that key will be added to the velocities defined by this key. -
labelIf Mandatory: no
Type:
strDefault Value:
GROUPN, whereNis the index of the group.Descriptions: A label of this group.
Examples:
[[group]]
atom_list = "all"
initial_temperature = 300.0
label = "the_whole_system"
[[group]]
atom_list = "0:100"
has_translations = false
label = "substrate"
[[group]]
atom_list = [101, 102, 103, 104]
initial_velocities = [
[0.0, 0.0, -1.0],
[0.0, 0.0, -1.0],
[0.0, 0.0, -1.0],
[0.0, 0.0, -1.0]]
label = "molecule"
The [[potential]] array.
If Mandatory: yes
Default Value: None
Descriptions: Each table in this array defines a potential calculator. You could define multiple calculators, but at least one potential calculator have to be present.
Keys:
-
typeIf Mandatory: yes
Type:
strValid Values:
"siesta","dftd3","dftd4","tblite","nep","mace"or"plumed"Default Value: None
Descriptions: Type of the potential calculator:
"siesta": The SIESTA ab-initio potential."dftd3": Grimme's DFTD3 dispersion corrections."dftd4": Grimme's DFTD4 dispersion corrections."tblite": The tight binding potential calculated with the TBLite code."nep": The neuroevolution potential."mace": The E(3)-equivariant potentials based on the Atomic Cluster Expansion."plumed": The PLUMED wrapper. Although a PLUMED calculation may be bias-free, you still need to define it here.
Required Keys: Different potential calculator will require different other keys:
"siesta":atom_list,siesta_options,siesta_command,pseudopotential_dir"dftd3":atom_list,functional,damping,atm"dftd4":atom_list,functional,total_charge,atm"tblite":atom_list,functional,total_charge,total_spin"nep":atom_list,file_name,use_tabulating"mace":atom_list,file_name,device,virial,energy_unit,length_unit,compile_mode,compile_full_graph,total_charge,total_spin"plumed":file_name
-
atom_listIf Mandatory: no
Type:
List[int]orstrDefault Value: All atoms in the simulated system.
Descriptions: Indices of atoms that are covered by the potential. The indices may be represented by a list of integers, or a formatted string, which could represent a range of atoms conveniently. For example, the following two values of this key select same atoms:
atom_list = [0, 1, 2, 5, 7, 8, 9]atom_list = "0:2,5,7:9"If you would like to define a group that contains all atoms in the system, you may invoke the following syntactic sugar:
atom_list = "all"Notes: The PLUMED "potential" could only act on the whole simulated system.
-
siesta_optionsIf Mandatory: yes
Type:
strDefault Value: None
Dependency:
type = "siesta"Descriptions: Options for a SIESTA calculation. This key contains the options you normally defined in an FDF format SIESTA input file, excepting the atomic positions, atomic types, cell vectors and the task type (these options are handled by SOMD).
-
siesta_commandIf Mandatory: yes
Type:
strDefault Value: None
Dependency:
type = "siesta"Descriptions: Path to the SIESTA binary. You may include the
mpiruncommand or other statements in this key as well. For example:siesta_command = "OMP_NUM_THREADS=32 MKL_NUM_THREADS=32 /path/to/siesta"siesta_command = "mpirun -np 32 /path/to/siesta" -
pseudopotential_dir:If Mandatory: no
Type:
strDefault Value: The current working directory.
Dependency:
type = "siesta"Descriptions: The directory of the pseudopotential files. These files should be in the PSML, PSF or VPS formats, and the prefixes of the files must be element symbols (case-sensitive). If more than one pseudopotential file of an element is present, SOMD will invoke the pseudopotential files in the priority of PSML > PSF > VPS.
-
functional:If Mandatory: yes
Type:
strDefault Value: None
Dependency:
type = "dftd3",type = "dftd4"ortype = "tblite"Descriptions: Name of the functional which is invoked in the DFT calculations. For the
"tblite"potential, this key is the calculation level, should be one of"GFN2-xTB","GFN1-xTB"and"IPEA1-xTB". -
atmIf Mandatory: no
Type:
boolDefault Value:
falseDependency:
type = "dftd3"ortype = "dftd4"Descriptions: If enable the three body correction.
-
damping:If Mandatory: no
Type:
strDefault Value:
"ZeroDamping"Dependency:
type = "dftd3"Descriptions: The damping type of the DFTD3 potential.
-
total_charge:If Mandatory: no
Type:
intUnit: a.u.
Default Value:
0Dependency:
type = "dftd4"ortype = "tblite"ortype = "mace"Descriptions: The net charge of the simulated system.
-
total_spin:If Mandatory: no
Type:
intUnit: a.u.
Default Value:
0Dependency:
type = "tblite"ortype = "mace"Descriptions: The net spin () of the simulated system.
-
file_name:If Mandatory: yes
Type:
strDefault Value: None
Dependency:
type = "nep",type = "mace"ortype = "plumed"Descriptions: Path to the NEP potential file (
nep.txt), path to the MACE model file or path to the PLUMED input file, depending on the value of thetypekey. -
use_tabulating:If Mandatory: no
Type:
boolDefault Value: False
Dependency:
type = "nep"Descriptions: If invoke the tabulated version of NEP. This could speed up the calculation, read this page for details.
-
device:If Mandatory: no
Type:
strDefault Value:
"cpu"Dependency:
type = "mace"Descriptions: Name of the device to use for evaluating the potential.
-
virial:If Mandatory: no
Type:
boolDefault Value:
trueDependency:
type = "mace"Descriptions: If calculate the virial tensor. Disabling this option will speed up NVT or NVE runs.
-
compile_mode:If Mandatory: no
Type:
strDefault Value: None
Dependency:
type = "mace"Descriptions: Mode of compiling the model (see torch.compile for details).
-
compile_full_graph:If Mandatory: no
Type:
boolDefault Value:
FalseDependency:
type = "mace"Descriptions: The
fullgraphparameter oftorch.compile. -
energy_unit:If Mandatory: no
Type:
floatDefault Value:
96.485Dependency:
type = "mace"Descriptions: The energy unit of the model outputs. In unit of (kJ/mol). E.g., if the your model trained with a dataset that invokes (eV) as energy units, this parameter should be set to 96.485. The default value is capable for most pretrained models provided by the MACE team.
-
length_unit:If Mandatory: no
Type:
floatDefault Value:
0.1Dependency:
type = "mace"Descriptions: The length unit of the model outputs. In unit of (nm). E.g., if the your model trained with a dataset that invokes (A) as length units, this parameter should be set to 0.1. The default value is capable for most pretrained models provided by the MACE team.
Examples:
[[potential]]
type = "SIESTA"
siesta_options = """
xc.functional GGA
xc.authors revPBE
PAO.BasisSize DZP
Mesh.Cutoff 300 Ry
Diag.Algorithm ELPA-1stage
SolutionMethod diagon
ElectronicTemperature 1 meV
"""
siesta_command = "mpirun -np 4 /path/to/siesta"
pseudopotential_dir = "./data"
[[potential]]
type = "dftd3"
functional = "revpbe"
[[potential]]
type = "plumed"
file_name = "./data/plumed.inp"
[[potential]]
type = "nep"
file_name = "./nep.txt"
The [constraints] table.
If Mandatory: no
Default Value: None
Descriptions: The holonomic constraints to be applied to the simulated system. Constraints are achieved by the RATTLE algorithm in SOMD.
Keys:
-
typesIf Mandatory: yes
Type:
List[int]Default Value: None
Descriptions: Types of the constraints. Each element in this list stands for the type of one constraint, thus, the length of this list is the number of the constraints to be applied. The valid types are:
0: The distance between two atoms.1: The angle between three atoms.2: The dihedral angle between four atoms.
-
indicesIf Mandatory: yes
Type:
List[List[int]]Dimension: (number of constraints) * (number of atoms per constraint)
Default Value: None
Descriptions: Indices of the atoms that take part in the constraints. Each element of this list is also a list, which includes the indices of the atoms that take part in the corresponding constraint. Thus, length of this list should be the same as the length of the
typeskey. When the i-th element of thetypekey is0,1and2, the length of the i-th element of this list should be 2, 3, and 4. -
targetsIf Mandatory: yes
Type:
List[float]Dimension: number of constraints
Default Value: None
Descriptions: Target values of the constraints. Length of this list should be the same as the length of the
typeskey. When the i-th element of thetypekey is0,1and2, the unit of the i-th element of this list should be nanometer, radian and radian. -
tolerancesIf Mandatory: no
Type:
List[float]Dimension: number of constraints
Default Value:
1E-14for every constraints.Descriptions: Convergence tolerances of the constraints. Length of this list should be the same as the length of the
typeskey.When the i-th element of thetypekey is0,1and2, the unit of the i-th element of this list should be nanometer, radian and radian. -
max_cyclesIf Mandatory: no
Type:
intDefault Value:
300Descriptions: Maximum number of the RATTLE iterations.
Examples:
[constraints]
types = [0, 1, 2]
indices = [[4, 7], [0, 4, 7], [2, 0, 4, 7]]
targets = [0.108, 1.92527, -0.9995]
tolerances = [1E-14, 1E-14, 1E-14]
max_cycles = 100
The [integrator] table.
If Mandatory: yes
Default Value: None
Descriptions: The integrator to propagate the simulated system.
Keys:
-
typeIf Mandatory: yes
Type:
strValid Values:
"vv","cs4","nhc","baoab","obabo","gbaoab"or"gobabo"Default Value: None
Descriptions: Type of the integrator:
"vv": The Velocity Verlet integrator."cs4": Calvo and Sanz-Serna's fourth-order integrator."nhc": The Nose-Hoover Chains integrator ()."baoab": The Langevin integrator with a BAOAB splitting (can not be used with constraints)."obabo": The Langevin integrator with a OBABO splitting (can not be used with constraints)."gbaoab": The Geodesic Langevin integrator with a BAOAB splitting (can be used with constraints, identical to the"baoab"integrator when not using constraints)."gobabo": The Geodesic Langevin integrator with a OBABO splitting. (can be used with constraints, identical to the"obabo"integrator when not using constraints).
Notes:
- The
"vv"and"cs4"integrators are NVE integrator and other integrators are thermalized. - The
"cs4"integrator is four times more expensive than the trivial"vv"integrator, but it could generate much more accurate trajectories. - General pros of the Langevin integrators: the equilibrium is faster to reach, and the partition of kinetic energies is more uniform.
- General cons of the Langevin integrators: every kind of Langevin
integrator violates the underlying dynamics of the simulated system. As a
result, when collecting dynamical observations (e.g., correlation
functions), you should avoid using them. If thermostating is required, use
the
"nhc"integrator. Otherwise, use any NVE integrator. - The
"baoab"integrator shows better performances in configuration space sampling tasks (e.g., distribution function or free energy calculations), although the kinetic energy temperature may be a little lower the given value (which is normal, since the definition of "temperature" is not unique). We strongly recommend you to use this integrator when performing such tasks. - DO NOT use the
"nhc"integrator in simulated annealing simulations. It will introduce serious oscillations.
-
timestepIf Mandatory: yes
Type:
floatDefault Value: None
Unit: picosecond
Descriptions: The timestep of the integrator.
Notes: Timesteps in SOMD could be negative, which means propagating the system backwardly.
-
thermo_groupsIf Mandatory: no
Type:
List[int]orintDefault Value: The atom group that corresponds to the whole simulated system.
Dependency: Thermalized integrators.
Descriptions: The indices of the atom groups to thermalize. Each group will be coupled to a different thermostat. When there is only one group to thermalize, you could define this key by the index of the group instead of a single-element list, e.g.,
thermo_groups = 0is equal to
thermo_groups = [0] -
temperaturesIf Mandatory: yes
Type:
List[float]orfloatDefault Value: None
Dependency: Thermalized integrators.
Descriptions: Temperatures of the thermostats. When there is only one group to thermalize, you could define this key by the temperature of that group instead of a single-element list. Otherwise, length of this list should be the same as the length of the
thermo_groupskey. -
relaxation_timesIf Mandatory: yes
Type:
List[float]orfloatDefault Value: None
Dependency: Thermalized integrators.
Descriptions: Relaxation timescales of the thermostats. When there is only one group to thermalize, you could define this key by the relaxation timescale of that group instead of a single-element list. Otherwise, length of this list should be the same as the length of the
thermo_groupskey. -
splittingIf Mandatory: no
Type:
List[dict]Default Value: None
Descriptions: The splitting of the integrator. Read the
somd/core/integrators.pysource file for details. When this key is defined, you should not define thetypekey.
Examples:
[integrator]
type = "baoab"
timestep = 0.001
temperatures = 300.0
relaxation_times = 0.05
[integrator]
type = "nhc"
timestep = 0.001
thermo_groups = [0, 1]
temperatures = [300.0, 400.0]
relaxation_times = [0.05, 0.05]
# The BAOAB Langevin integrator could also be defined by this way:
[integrator]
timestep = 0.001
temperatures = 300.0
relaxation_times = 0.05
[[integrator.splitting]]
operators = ["V", "R", "O", "R", "V"]
# The "middle point" NHC integrator:
[integrator]
timestep = 0.001
temperatures = 300.0
relaxation_times = 0.05
[[integrator.splitting]]
operators = ["V", "R", "N", "R", "V"]
# The Geodesic OBABO Langevin integrator could also be defined by this way:
[integrator]
timestep = 0.001
temperatures = 300.0
relaxation_times = 0.05
[[integrator.splitting]]
operators = ["O", "Cv"]
[[integrator.splitting]]
operators = ["V", "Cv"]
[[integrator.splitting]]
operators = ["CR", "R", "Cv"]
repeating = 5
[[integrator.splitting]]
operators = ["V", "Cv"]
[[integrator.splitting]]
operators = ["O", "Cv"]
The [barostat] table.
If Mandatory: no
Default Value: None
Descriptions: The Berendsen-type barostat.
Note: By now, SOMD only supports the original Berendsen barostat, which could not generate correct isothermal-isobaric distributions. Thus, do not rely on any distribution generated by this barostat (but equilibrium volumes are still reliable). Besides, the barostat can not be applied with constraints.
Keys:
-
pressuresIf Mandatory: yes
Type:
List[float]orfloatDimension: 1 or 6
Unit: megapascal
Default Value: None
Descriptions: The pressures of the barostat. If length of this list is six, an anisotropy pressure controlling will be applied. Otherwise, an isotropy pressure controlling will be applied. And when using isotropy pressure controlling, you could define this key by the one hydrostatic pressure instead of a single-element list, e.g.,
pressures = 0.1is equal to
pressures = [0.1]Notes: When using anisotropy pressure controlling, the Cartesian directions of the six target pressures are: xx yy zz xy xz yz.
-
betaIf Mandatory: yes
Type:
List[float]orfloatDimension: 1 or 6
Unit: 1/megapascal
Default Value: None
Descriptions: The isothermal compressibilities of the simulated system. Length of this list should be the same as the length of the
pressureskey. And when using isotropy pressure controlling, you could define this key by the one isotropy compressibility instead of a single-element list.Notes: When using anisotropy pressure controlling, the Cartesian directions of the six compressibilities are: xx yy zz xy xz yz.
-
relaxation_timeIf Mandatory: yes
Type:
floatUnit: picosecond
Default Value: None
Descriptions: The relaxation timescale of the barostat.
Examples:
[barostat]
pressures = 1.0
beta = 1.0E-5
relaxation_time = 0.1
[barostat]
pressures = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
beta = [1.0E-5, 1.0E-5, 1.0E-5, 1.0E-5, 1.0E-5, 1.0E-5]
relaxation_time = 0.1
The [[trajectory]] array.
If Mandatory: no
Default Value: None
Descriptions: Each table in this array defines a trajectory writer. You could define multiple trajectory writers.
Keys:
-
format:If Mandatory: no
Type:
strValid Values:
"h5"or"exyz"Default Value:
h5Descriptions: Format of the trajectory file. The
"h5"format obeys MDTraj's HDF5 convention, and the"exyz"format obeys GPUMD's EXYZ convention.Notes: To view the
h5format trajectories, you could use themdconvertscript provided themdtrajpackage to convert it to other formats, e.g., the extensively supported.ncformat:mdconvert prefix.trajectory.h5 -o traj.nc -
prefix:If Mandatory: no
Type:
strDefault Value: The system label.
Descriptions: The prefix of the trajectory file.
Notes: When the value of the
formatkey is"h5", the generated trajectory file will be namedprefix.trajectory.h5, and when the value of theformatkey is"exyz", the generated trajectory file will be namedprefix.trajectory.xyz. -
interval:If Mandatory: no
Type:
intDefault Value:
1Descriptions: The interval between two updates of the trajectory file.
-
write_forces:If Mandatory: no
Type:
boolDefault Value:
falseDescriptions: If record forces in the trajectory file.
-
write_velocities:If Mandatory: no
Type:
boolDefault Value:
trueforh5trajectories,falseforexyztrajectoriesDescriptions: If record velocities in the trajectory file.
-
wrap_positions:If Mandatory: no
Type:
boolDefault Value:
falseDescriptions: If wrap atoms to the box before writing the trajectory.
-
potential_list:If Mandatory: no
Type:
List[int]Default Value: Indices of all potential calculators.
Descriptions: Indices of the potential calculators that contribute to the recorded potential energies, virials, and forces. This is extremely useful when constructing training and testing set of neuroevolution potentials. For example, when you are performing a biased enhanced sampling with PLUMED, and want to invoke the generated trajectory to train NEPs. The following settings will ensure that only the ab-initio data will be written to the
"exyz"file:[[potential]] type = "SIESTA" siesta_options = """ xc.functional GGA xc.authors revPBE PAO.BasisSize DZP """ siesta_command = "mpirun -np 4 /path/to/siesta" [[potential]] type = "dftd3" functional = "revpbe" [[potential]] type = "plumed" file_name = "plumed.inp" [[trajectory]] format = "exyz" # We need force data to train a NEP. write_forces = true # Only write the forces, virials and energies generated by the # first two potential calculators to the trajectory. potential_list = [0, 1] -
use_float64:If Mandatory: no
Type:
boolDefault Value:
falseDependency:
format = "h5"Descriptions: If use 64-bit floating point data in the trajectory instead of the original 32-bit convention.
Notes: Enabling this option will lead to non-standard trajectories and may cause some readers to fail. Besides, sizes of the trajectories will largely be increased.
-
energy_shift:If Mandatory: no
Type:
floatDefault Value:
0.0Dependency:
format = "exyz"Descriptions: Shift the total energy by this value before recording the total energy to the trajectory (this value could be set to the potential energy of the initial conformation, which is usually negative). In unit of (kJ/mol). This is useful when generating training sets of NEP.
Examples:
[[trajectory]]
format = "h5"
interval = 10
wrap_positions = true
write_velocities = true
[[trajectory]]
format = "exyz"
prefix = "train"
write_forces = true
potential_list = [0, 1]
The [[logger]] array.
If Mandatory: no
Default Value: None
Descriptions: Each table in this array defines a system data writer. You could define multiple writers. These files will record system data, e.g., total potential energies, temperature and kinetic energies of each atom groups, pressure tensors, etc.
Keys:
-
format:If Mandatory: no
Type:
strValid Values:
"csv"or"txt"Default Value:
h5Descriptions: Format of the data file.
-
prefix:If Mandatory: no
Type:
strDefault Value: The system label.
Descriptions: The prefix of the data file.
Notes: When the value of the
formatkey is"csv", the generated data file will be namedprefix.data.h5, and when the value of theformatkey is"txt", the generated data file will be namedprefix.data.txt. -
interval:If Mandatory: no
Type:
intDefault Value:
1Descriptions: The interval between two updates of the data file.
-
potential_list:If Mandatory: no
Type:
List[int]Default Value: Indices of all potential calculators.
Descriptions: Indices of the potential calculators that contribute to the recorded potential energies.
Examples:
[[logger]]
format = "csv"
interval = 5
The [run] table.
If Mandatory: no
Default Value: None
Descriptions: This table defines the simulation information.
Notes: This table is not mandatory only when you have defined the
[evaluation] table. Otherwise, this table IS MANDATORY.
Keys:
-
n_steps:If Mandatory: no
Type:
intDefault Value: None
Descriptions: Number of the simulation steps to run.
Notes: Either this key or the
n_secondskey should be defined. -
n_seconds:If Mandatory: no
Type:
intUnit: Second
Default Value: None
Descriptions: Length of time to run. This is useful when you have a limited amount of computer time available, and want to run the longest simulation possible in that time. This method will continue taking time steps until the specified clock time has elapsed, then exit. It also automatically writes out a restart file (named
system_label.restart.h5) before exiting.Notes: Either this key or the
n_stepskey should be defined. -
seed:If Mandatory: no
Type:
intDefault Value: None
Descriptions: The seed value of the random number generator in SOMD.
-
label:If Mandatory: no
Type:
strDefault Value: The prefix of the input file name.
Descriptions: The default prefix of all output file generated by SOMD.
-
restart_from:If Mandatory: no
Type:
strDefault Value: None
Descriptions: Name of the restart file. If this key is defined, SOMD will continue the simulation from the state recorded by the restart file.
Notes: When restarting, SOMD will try to append new data to the old output files. Otherwise, SOMD will back up old output files.
Examples:
[run]
seed = 1
n_steps = 1000
label = "run"
[run]
n_steps = 1000
restart_from = "run.restart.h5"
The [evaluation] table.
If Mandatory: no
Default Value: None
Descriptions: This table defines a evaluation task, which calculates
various energies of conformations recorded in a hdf5 trajectory file.
The resulted energies, forces and other data will be written to the trajectory
and log files defined in the [[trajectory]] and [[logger]] array.
Notes: By default, you do not need to define an [integrator] for the
evaluation task. Besides, The [[script]] array works with the evaluation task.
Keys:
-
file_name:If Mandatory: yes
Type:
strDefault Value: None
Descriptions: Name of the input
hdf5trajectories. -
interval:If Mandatory: no
Type:
intDefault Value: 1
Descriptions: The interval of reading the input trajectory.
-
die_on_fail:If Mandatory: no
Type:
boolDefault Value:
trueDescriptions: If skip the conformations which cause the evaluation of the potentials to fail.
Examples:
[evaluation]
file_name = "./run.trajectory.h5"
interval = 1
The below example is a complete input file for calculating potential energies
of the conformations recorded in the file run.trajectory.h5, using the nep
potential file nep.txt.
[system]
structure = "topo.pdb"
[[potential]]
type = "nep"
file_name = "nep.txt"
[[trajectory]]
format = "h5"
write_forces = true
write_velocities = false
interval = 1
[evaluation]
file_name = "run.trajectory.h5"
interval = 1
The [[script]] array.
If Mandatory: no
Default Value: None
Descriptions: Each table in this array defines a python function to be executed in a given period.
Notes: The functions will be called at the end of the timestep.
Keys:
-
update:If Mandatory: yes
Type:
strDefault Value: None
Descriptions: The function to be called regularly. This function takes only one parameter, which is the integrator instance of the simulation. You could use the following commands to find out the valid properties:
import somd help(somd.core.integrators.INTEGRATOR)Notes: This function must be named
update. -
initialize:If Mandatory: no
Type:
strDefault Value: None
Descriptions: The initialization function. This function will be called only once at the starting of the simulation. This function takes no arguments.
Notes: This function must be named
initialize. -
interval:If Mandatory: no
Type:
intDefault Value:
1Descriptions: The interval of calling the
updatefunction.
Examples:
[[script]]
# Dump the memory information to the `mem.log` file every 50 steps.
interval = 50
update = """def update(integrator):
import os
os.system("free -h >> mem.log")
"""
[[script]]
# Rising the temperature to 500 K in 500 steps.
interval = 5
update = """def update(integrator):
s = integrator.step
if (s < 500):
integrator.temperatures[0] += 5
"""
[[script]]
# Back up the `DM` files generated by SIESTA calculations every 5 steps.
interval = 5
initialize = """def initialize():
import os
import shutil
try:
shutil.rmtree('./DM_files')
except:
pass
os.mkdir('./DM_files')
"""
update = """def update(integrator):
import shutil
s = integrator.step
for p in integrator.system.potentials:
if (p.__class__.__name__ == 'SIESTA'):
old_dm = p.working_directory + '/somd_tmp.DM'
new_dm = './DM_files/{:d}.DM'.format(s)
shutil.copy(old_dm, new_dm)
"""