You can mark groups of atoms as belonging to a rigid body. They will be moved together during optimization, such that their relative orientations do not change. These are created by making a RigidBody object and adding it to the Restraints.rigid_bodies list.
Note that all intra-body atom pairs are removed from the nonbonded list, since those distances cannot change. Thus these atom pairs will no longer contribute to any nonbonded interactions, such as Coulomb or Lennard-Jones interactions. See also Selection.assess_dope().
RigidBody(*atom_ids)
Creates a new rigid body which contains all of the specified atoms. You can
also tune the scale_factor member of the resulting object, which is used
to scale the system state vector (used by ConjugateGradients() and
QuasiNewton() optimizations) to rigid body orientation Euler angles
(in radians). (Note that no scaling is done for the position of the rigid
body; thus the units of this factor are effectively radians/Å.) This can
improve optimization convergence in some cases. By default the scaling factor
is 1.0; values larger than 1 increase the rotational sampling, while values less
than 1 will decrease it.
from modeller import * env = Environ() env.io.atom_files_directory = ['../atom_files'] mdl = Model(env, file='1fas') # Keep residues 1-10 in chain A rigid: r = RigidBody(mdl.residue_range('1:A', '10:A')) mdl.restraints.rigid_bodies.append(r) # Randomize the coordinates of the whole model; the rigid body remains rigid sel = Selection(mdl) sel.randomize_xyz(deviation=4.0) mdl.write(file='1fas.ini')