BioSimSpace._SireWrappers.ReplicaSystem¶
- class BioSimSpace._SireWrappers.ReplicaSystem(system, trajectory=None, num_replicas=None, is_squashed=None, **kwargs)[source]¶
A container class for storing molecular systems for replica dynamics simulations. Here a system has a single topology, but multiple coordinate sets (replicas).
- __init__(system, trajectory=None, num_replicas=None, is_squashed=None, **kwargs)[source]¶
Constructor.
- Parameters:
system (sire.system.System, sire.legacy.System.System,
System) – A Sire or BioSimSpace System object.trajectory (str, optional) – The path to a trajectory file containing multiple coordinate sets.
num_replicas (int, optional) – The number of replicas (coordinate sets) to create. If provided, the coordinate set in system will be duplicated this many times. This is only used if the system does not already contain multiple frames or a trajectory is not provided.
is_squashed (bool, optional) – Whether the trajectory is squashed (i.e. atoms for both the reference and perturbed states are stored in a single frame). This will be true for AMBER alchemical trajectories. Default is None, which will attempt to automatically determine this based on the system properties and trajectory format.
Methods
__init__(system[, trajectory, num_replicas, ...])Constructor.
getReplica(index[, is_lambda1, property_map])Get a specific replica (coordinate set) from the system.
getReplicas([is_lambda1, property_map])Get all replicas (coordinate sets) from the system.
load(stream, trajectory)Load a replica system from a stream and trajectory file.
loadReplicas(replica_system, filenames)Load multiple replicas (coordinate sets) from individual files.
Get the number of replicas (coordinate sets) in the system.
save(filename[, save_velocities])Save the replica system to a stream and trajectory file.
saveReplicas(filenames[, save_velocities, ...])Save each replica (coordinate set) to individual files.
Set the system to the perturbed (lambda = 1) state.
Set the system to the reference (lambda = 0) state.
- getReplica(index, is_lambda1=False, property_map={})[source]¶
Get a specific replica (coordinate set) from the system.
- Parameters:
index (int) – The index of the replica to retrieve (0-based).
is_lambda1 (bool, optional) – Whether to return the system at lambda = 1. Default is False.
property_map (dict, optional) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }
- Returns:
The requested replica as a BioSimSpace System object.
- Return type:
- getReplicas(is_lambda1=False, property_map={})[source]¶
Get all replicas (coordinate sets) from the system.
- Parameters:
is_lambda1 (bool, optional) – Whether to return the systems at lambda = 1. Default is False.
property_map (dict, optional) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }
- Returns:
A list of the replicas as BioSimSpace System objects.
- Return type:
list of
System
- static load(stream, trajectory)[source]¶
Load a replica system from a stream and trajectory file.
- Parameters:
stream (str) – The path to the stream file.
trajectory (str) – The path to the trajectory file.
- Returns:
The loaded replica system.
- Return type:
- static loadReplicas(replica_system, filenames)[source]¶
Load multiple replicas (coordinate sets) from individual files.
- Parameters:
replica_system (
ReplicaSystem) – A ReplicaSystem object to use as a template for loading the replicas.filenames (list of str) – A list of filenames to load each replica from. The extension will determine the format, which must be the same for all replicas.
- Returns:
The loaded replica system.
- Return type:
- nReplicas()[source]¶
Get the number of replicas (coordinate sets) in the system.
- Returns:
The number of replicas.
- Return type:
int
- save(filename, save_velocities=False)[source]¶
Save the replica system to a stream and trajectory file.
- Parameters:
filename (str) – The base filename.
save_velocities (bool, optional) – Whether to save velocities along with coordinates. Default is False.
- Returns:
stream (str) – The path to the saved stream file.
trajectory (str) – The path to the saved trajectory file.
- saveReplicas(filenames, save_velocities=False, is_lambda1=False)[source]¶
Save each replica (coordinate set) to individual files.
- Parameters:
filenames (list of str) – A list of filenames to save each replica to. The extension will determine the format, which must be the same for all replicas.
save_velocities (bool, optional) – Whether to save velocities along with coordinates. Default is False.