"""Binds the appropriate degrees of freedom to the thermostat.
This takes an object with degrees of freedom, and makes their momentum
and mass vectors members of the thermostat. It also then creates the
objects that will hold the data needed in the thermostat algorithms
and the dependency network. Actually, this specific thermostat requires
being called on a beads object.
Args:
nm: An optional normal modes object to take the mass and momentum
vectors from.
prng: An optional pseudo random number generator object. Defaults to
Random().
fixdof: An optional integer which can specify the number of constraints
applied to the system. Defaults to zero.
Raises:
TypeError: Raised if no beads object is specified for
the thermostat to couple to.
"""
ifnmisNoneornottype(nm)isNormalModes:
raiseTypeError("ThermoNMGLE.bind expects a NormalModes argument to bind to")
ifprngisNone:
self.prng=Random()
else:
self.prng=prng
if(nm.nbeads!=self.nb):
raiseIndexError("The parameters in nm_gle options correspond to a bead number "+str(self.nb)+" which does not match the number of beads in the path"+str(nm.nbeads))
# allocates, initializes or restarts an array of s's
ifself.s.shape!=(self.nb,self.ns+1,nm.natoms*3):
iflen(self.s)>0:
warning("Mismatch in GLE s array size on restart, will reinitialise to free particle.",verbosity.low)
self.s=np.zeros((self.nb,self.ns+1,nm.natoms*3))
# Initializes the s vector in the free-particle limit
info(" GLE additional DOFs initialised to the free-particle limit.",verbosity.low)