hplattice.Replica¶
-
class
hplattice.Replica.
Replica
(lattice_factory, config, repnum, nativeclist=None)[source]¶ Each Replica is a container for a chain and a monte carlo sampler. During replica exchange simulations, the replicas attempt to swap temperatures at regular intervals. The success of a swap depends on the energies and temperatures of the replicas.
Parameters: - lattice_factory (
hplattice.LatticeFactory
) – factory object that knows how to create chains and monty samplers. - config (str) – path to configuration file
- repnum (int) – replica number
- nativeclist (list) – optional, native contacts as a list of tuples,
example
[(0, 4), (1, 6)]
-
compute_mc_acceptance
()[source]¶ Compute the fraction of mc moves that have been viable and the fraction of viable moves that have been accepted.
-
contactstate
()[source]¶ Get contacts of current chain conformation.
Returns: list of tuples, example [(0, 4), (1, 6)]
Return type: list
-
get_vec
()[source]¶ Get chain vectors.
Returns: chain vectors Return type: hplattice.Chain.Chain.Vectors
-
is_native
()[source]¶ Check if current contacts match contacts of native state.
Returns: True
if current contacts match native contacts.Return type: bool
-
metropolis_accept_move
()[source]¶ Apply metropolis criterion to determine whether new conformation of chain should replace current conformation.
Returns: True
if new conformation should be accepted.Return type: bool
-
propose_move
()[source]¶ Do a monte carlo move to produce a new conformation of the chain.
Returns: True
if new conformation is viable.Return type: bool
-
record_stats
(move_is_viable, move_is_accepted)[source]¶ Update mc move stats based on outcome of most recent move.
Parameters: - move_is_viable (bool) –
True
if the move was a viable, non-overlapping chain conformation. - move_is_accepted (bool) –
True
if the move was accepted as the new conformation of the chain.
- move_is_viable (bool) –
- lattice_factory (
-
hplattice.Replica.
attemptswap
(swap_method, replicas)[source]¶ Attempt swap of replicas.
Parameters: - swap_method (str) –
'random pair'
to randomly choose two replicas to swap;'neighbors'
to randomly choose one replicai
and swap it with itsi+1
neighbor. - replicas (list) – list of
Replica
objects
Returns: the indices of the two replicas and the success or failure of the swap.
Return type: (int, int, bool)
- swap_method (str) –
-
hplattice.Replica.
random
() → x in the interval [0, 1).¶