Set up the simulated system.
March 9, 2023 ยท View on GitHub
Tile now, simulated systems in SOMD are represented by the
somd.core.systems.MDSYSTEM class. You could initialize a system containing
ten atoms by:
>>> system = somd.core.systems.MDSYSTEM(10)
You may also assign a label for your system during the initialization:
>>> system = somd.core.systems.MDSYSTEM(10, label='SYSTEM')
The generated system object contains information about a typical atomic
system, e.g., the atomic positions (system.positions), the atomic velocities
(system.velocities) and the cell vectors (system.box). You could execute
the import somd; help(somd.core.systems.MDSYSTEM) command in a python REPL
to view a full list of valid attributes.
Specifically, the somd.core.systems module provides two useful methods to
initialize the simulated systems from files:
- The
create_system_from_poscarmethod could perform system initialization using the POSCAR files. For example:>>> system = somd.core.systems.create_system_from_poscar('H2O.POSCAR') - The
create_system_from_pdbmethod could perform system initialization using the PDB files. For example:>>> system = somd.core.systems.create_system_from_pdb('H2O.pdb')
Both method reads atomic types, atomic positions and simulation box data from
corresponding files, then initializes a MDSYSTEM instance based on the read
data.