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.
Returns:the sum of squared-distances over the selected contacts.
Return type:float
energy(chain)[source]

Compute the restraint energy of a given chain.

Parameters:chain (hplattice.Chain.Chain) – Compute the restraint energy of this chain.
Returns:energy of the distance restraint
Return type: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:
kT()[source]
Returns:\(k_b * T\)
Return type: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.
Returns:True if next conformation should be accepted.
Return type:bool
move1(chain, vecindex=None, direction=None)[source]

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

  1. three-bead flips
  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:

  1. three-bead flips
  2. crankshaft moves
  3. 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.
  • 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]

Apply rigid rotations to the chain:

  1. 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.
hplattice.Monty.random() → x in the interval [0, 1).