Selection.randomize_xyz() — randomize selected coordinates

randomize_xyz(deviation)
This command randomizes the Cartesian coordinates of the selected atoms.

If deviation is positive, the coordinates are randomized by the addition of a random number uniformly distributed in the interval from $-{\sf deviation}\index{deviation@{\sf deviation}}$ to $+{\sf deviation}\index{deviation@{\sf deviation}}$ angstroms. Atoms in residues containing rings (TYR, PHE, TRP, HIS) are capped to move no more than 0.5 angstroms regardless of the setting of deviation, so that the ring structure is roughly maintained and the system does not later get stuck in local minima.

If deviation is negative, the coordinates are assigned a random value uniformly distributed in the interval from $-{\sf deviation}\index{deviation@{\sf deviation}}$ to $+{\sf deviation}\index{deviation@{\sf deviation}}$ angstroms.

Any defined rigid bodies (see Section 5.3.4) remain rigid; only their mass centers are modified by this command (no rotation is done).

Example: examples/commands/randomize_xyz.py

# Example for: Selection.randomize_xyz()

# This will randomize the X,Y,Z of the model:

from modeller import *

env = Environ()
env.io.atom_files_directory = ['../atom_files']

mdl = Model(env, file='1fas')

# Act on all atoms in the model
sel = Selection(mdl)

# Change all existing X,Y,Z for +- 4 angstroms:
sel.randomize_xyz(deviation=4.0)
mdl.write(file='1fas.ini1')

# Assign X,Y,Z in the range from -100 to 100 angstroms:
sel.randomize_xyz(deviation=-100.0)
mdl.write(file='1fas.ini2')