- class hplattice.Replica.Replica(lattice_factory, config, repnum, nativeclist=None)¶
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.
- 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 the fraction of mc moves that have been viable and the fraction of viable moves that have been accepted.
Get contacts of current chain conformation.
Returns: list of tuples, example [(0, 4), (1, 6)] Return type: list
Compute energy of current chain conformation.
Returns: energy Return type: float
Get current temperature.
Returns: temperature Return type: float
Initialize stats about viability and acceptance of monte carlo moves.
Check if current contacts match contacts of native state.
Returns: True if current contacts match native contacts. Return type: bool
Returns: \(k_b * T\) Return type: float
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
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)¶
Update mc move stats based on outcome of most recent move.
- 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.
- hplattice.Replica.attemptswap(swap_method, replicas)¶
Attempt swap of replicas.
- swap_method (str) – 'random pair' to randomly choose two replicas to swap; 'neighbors' to randomly choose one replica i and swap it with its i+1 neighbor.
- replicas (list) – list of Replica objects
the indices of the two replicas and the success or failure of the swap.
(int, int, bool)
- hplattice.Replica.random() → x in the interval [0, 1).¶