Add forbidden Z region#

Repelling atoms from entering a specific Z-coordinate slab in OpenMM simulations.

The function molsysmt.third_party.openmm.forces.add_forbidden_z_region() introduces repulsive potentials that prevent target atoms from crossing into a defined Z-slab.

Added in version 1.0.0.

Basic usage#

Let’s add a forbidden Z-slab restraint:

import molsysmt as msm

molsys = msm.convert(msm.systems['Trp-Cage']['1l2y.h5msm'], to_form='molsysmt.MolSys')
force = msm.third_party.openmm.forces.add_forbidden_z_region(molsys, z0='0.0 nm', width='0.5 nm', selection=[0], force_constant='5000 kJ/(mol*nm**2)', return_force=True)
print('Forbidden Z region created:', type(force))
Forbidden Z region created: <class 'openmm.openmm.CustomExternalForce'>