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
- contacts (list) – list of tuples, example
-
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
-
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: Trueif 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:
- three-bead flips
- 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,
1for clockwise,-1for 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:
- three-bead flips
- crankshaft moves
- 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,
1for clockwise,-1for 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:
- 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,
1for clockwise,-1for counterclockwise. will be chosen randomly if no value is specified.
- config (
-
hplattice.Monty.random() → x in the interval [0, 1).¶