mstk.ommhelper.force.restrain_particle_number

mstk.ommhelper.force.restrain_particle_number(system, particles, direction, bound, sigma, target, k, weights=None)

Restrain the number of selected particles in a region.

The region is defined by direction (x, y or z) and bound (lower and upper). Each particle is consider as a Gaussian distribution with standard deviation equal to sigma. The number of particles is restrained to the target value using a harmonic function with force constant k.

Parameters:
  • system (mm.System) –

  • particles (list of int) –

  • direction (['x', 'y', 'z']) –

  • bound (list of float) –

  • sigma (float) – Variance of the particle Gaussian in unit of nm

  • target (float) –

  • k (float) – Strength of the harmonic restraint in unit of kJ/mol

  • weights (list of float, optional) –

Returns:

force

Return type:

mm.CustomCVForce