mstk.simsys.System¶
- class mstk.simsys.System(topology, ff, positions=None, cell=None, ignore_missing_improper=False, transfer_bonded_terms=False, suppress_pbc_warning=False)¶
System is a combination of topology and forcefield, ready for simulation.
When a system is being initiated, the topology is deep copied. A compressed set of force field is generated, which only contains the terms required by the topology. Any modification to the topology and force field after that will have no effect on the system.
During the initialization, all information in the topology will be kept untouched, which means:
The atom type of all atoms in the topology must have been correctly assigned, so that the force field terms can be matched.
The charges and masses of all atoms in the topology must have been assigned. You may need to call
mstk.forcefield.ForceField.assign_charge()andmstk.forcefield.ForceField.assign_mass()before constructing the system to update the charges and masses of atoms in the topology.If this is a Drude polarizable model, the Drude particles must be available in the topology, and the polarizability, thole screening and charges on Drude particles must have been correctly assigned. You may need to call
mstk.topology.Topology.generate_drude_particles()to generate Drude particles.If this is a virtual site model, the virtual site particles must be available in the topology,
The provided force field must be able to fully describe the energy of the topology. If any term required by topology is not found in the force field, an Exception will be raised.
Positions and unit cell are usually included in the topology. If not so, they can be provided by arguments positions and cell. The explicitly provided positions and cell will override the ones in topology. If positions are not included in the topology and not provided explicitly, an Exception will be raised. Unit cell is optional. If unit cell is not provided, cutoff will not be used for non-bonded interactions.
If some bonded (bond, angle, dihedral, improper) parameters required by the topology are not found in the force field, mstk can try to transfer parameters from more general terms in the force field. e.g. if bond term between ‘c_4o2’ and ‘n_3’ is not found, the bond term between ‘c_4’ and ‘n_3’ will be used. This mechanism is initially designed for TEAM force field. It is disabled by default, and can be enabled by setting argument transfer_bonded_terms to True.
- Parameters:
topology (Topology) –
ff (ForceField) –
positions (array_like, optional) –
cell (UnitCell, optional) –
ignore_missing_improper (bool) – If set to True, a zero-energy OplsImproperTerm will be created for missing improper terms in the FF
transfer_bonded_terms (bool) –
supress_pbc_warning (bool) – Set to True if you intend to build a vacuum system and don’t want to hear warning about it.
- charged¶
True if any atom in this system carries charge
- Type:
bool
- use_pbc¶
True if unit cell information provided and volume is not zero
- Type:
bool
- dihedral_terms¶
- Type:
dict, [Dihedral, subclass of DihedralTerm]
- improper_terms¶
- Type:
dict, [Improper, subclass of ImproperTerm]
- polarizable_terms¶
- Type:
dict, [Atom, subclass of PolarizableTerm]
- dihedral_classes¶
- Type:
set of subclass of DihedralTerm
- improper_classes¶
- Type:
set of subclass of ImproperTerm
- polarizable_classes¶
- Type:
set of subclass of PolarizableTerm
- vsite_types¶
- Type:
set of subclass of VirtualSite
Methods
__init__(topology, ff[, positions, cell, ...])decompose_energy([verbose])Calculate the contribution of each energy term in this system
export_gromacs([gro_out, top_out, mdp_out])Generate input files for GROMACS
export_lammps([data_out, in_out])Generate input files for Lammps.
export_namd([pdb_out, psf_out, prm_out])Generate input files for NAMD
get_TIP4P_linear_coeffs(atom)Get the three linear coefficients to calculate the position of TIP4P virtual site from O, H and H positions
minimize_energy([tolerance, verbose])Perform energy minimization on this system
to_omm_system([disable_inter_mol])Export this system to OpenMM system
Attributes
The compressed force field associated with the system
The topology associated with the system
- property ff¶
The compressed force field associated with the system
- Returns:
ff
- Return type:
- export_lammps(data_out='data.lmp', in_out='in.lmp', **kwargs)¶
Generate input files for Lammps.
- Parameters:
data_out (str) –
in_out (str) –
- export_gromacs(gro_out='conf.gro', top_out='topol.top', mdp_out='grompp.mdp', **kwargs)¶
Generate input files for GROMACS
- Parameters:
gro_out (str or None) –
top_out (str or None) –
mdp_out (str or None) –
- export_namd(pdb_out='conf.pdb', psf_out='top.psf', prm_out='ff.prm', **kwargs)¶
Generate input files for NAMD
- Parameters:
pdb_out (str or None) –
psf_out (str or None) –
prm_out (str or None) –
- to_omm_system(disable_inter_mol=False, **kwargs)¶
Export this system to OpenMM system
- Parameters:
disable_inter_mol (bool) –
- Returns:
omm_system
- Return type:
openmm.openmm.System
- decompose_energy(verbose=True)¶
Calculate the contribution of each energy term in this system
- Returns:
energies – The potential energies of different contributions
- Return type:
Dict[str, float]
- minimize_energy(tolerance=100, verbose=True)¶
Perform energy minimization on this system
The position of each atom in the topology will be updated