next up previous contents index
Next: selection.superpose() superpose Up: The selection class: handling Previous: selection.mutate() mutate   Contents   Index

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. 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')



Automatic builds 2009-06-12