# hplattice.Monty¶

class hplattice.Monty.DistRestraint(contacts, kspring)[source]

A harmonic constraint based on squared distance $$D = d^2$$, where $$D = \sum_{i,j} d^2_{ij}$$ over all contacts.

Parameters: contacts (list) – list of tuples, example [(0, 4), (1, 6)] kspring (float) – spring constant for restraint
D(chain)[source]

Compute the sum of squared-distances of a given chain.

Parameters: chain (hplattice.Chain.Chain) – Compute the sum of squared-distances of this chain. the sum of squared-distances over the selected contacts. float
energy(chain)[source]

Compute the restraint energy of a given chain.

Parameters: chain (hplattice.Chain.Chain) – Compute the restraint energy of this chain. energy of the distance restraint float
class hplattice.Monty.Monty(config, temp, chain)[source]

A collection of functions to perform Monte Carlo move-set operations on an HP chain.

Parameters: config (hplattice.Config.Config) – configuration parameters for chain and simulation temp (float) – temperature (K) chain (hplattice.Chain.Chain) – do monte carlo on this chain
kT()[source]
Returns: $$k_b * T$$ float
metropolis(replica)[source]

Judge the next conformation of the chain according to Metropolis criterion: $$e^{-\Delta E/kT}$$.

Parameters: replica (hplattice.Replica.Replica) – The replica containing the chain that should be judged. True if next conformation should be accepted. bool
move1(chain, vecindex=None, direction=None)[source]

Apply moveset MC1 (Dill and Chan, 1994, 1996) to the chain:

2. rigid rotations
Parameters: chain (hplattice.Chain.Chain) – apply move to this chain vecindex (int) – optional, vector to move. will be chosen randomly if no value is specified. direction (int) – optional, 1 for clockwise, -1 for counterclockwise. will be chosen randomly if no value is specified.
move2(chain, vecindex=None, direction=None, moveseed=None)[source]

Apply moveset MC2 (Dill and Chan, 1994, 1996) to the chain:

Parameters: chain (hplattice.Chain.Chain) – apply move to this chain vecindex (int) – optional, vector to move. will be chosen randomly if no value is specified. direction (int) – optional, 1 for clockwise, -1 for counterclockwise. will be chosen randomly if no value is specified. moveseed (float) – optional, moveseed $$<1/3$$ for three-bead flip; $$1/3<=$$ moveseed $$<2/3$$ for crankshaft; $$2/3<=$$ moveseed for rigid rotation.
move3(chain, vecindex=None, direction=None)[source]
Parameters: chain (hplattice.Chain.Chain) – apply move to this chain vecindex (int) – optional, vector to move. will be chosen randomly if no value is specified. direction (int) – optional, 1 for clockwise, -1 for counterclockwise. will be chosen randomly if no value is specified.
hplattice.Monty.random() → x in the interval [0, 1).