simularium_readdy_models.common package¶
Submodules¶
simularium_readdy_models.common.particle_data module¶
simularium_readdy_models.common.readdy_util module¶
- class simularium_readdy_models.common.readdy_util.ReaddyUtil[source]¶
Bases:
object
Utilities used for Simularium ReaDDy models
- add_angle(types1, types2, types3, force_const, angle, system)[source]¶
- adds an angle to the system (if it hasn’t been added already)
from each type in types1 through each type in types2 to each type in types3 with force constant force_const and angle [radians]
- add_bond(types1, types2, force_const, bond_length, system)[source]¶
- adds a bond to the system (if it hasn’t been added already)
from each type in types1 to each type in types2 with force constant force_const and length bond_length [nm]
- add_dihedral(types1, types2, types3, types4, force_const, angle, system)[source]¶
- adds a cosine dihedral to the system (if it hasn’t been added already)
from each type in types1 through each type in types2 through each type in types3 to each type in types4 with force constant force_const and angle [radians]
- add_polymer_angle_1D(particle_types1, polymer_offset1, particle_types2, polymer_offset2, particle_types3, polymer_offset3, force_const, angle, system)[source]¶
- adds an angle between all polymer numbers
with offset polymer_offset of types particle_types with force constant force_const and angle [radians]
- add_polymer_angle_2D(particle_types1, polymer_offsets1, particle_types2, polymer_offsets2, particle_types3, polymer_offsets3, force_const, angle, system)[source]¶
- adds an angle between all polymer numbers
with offsets polymer_offsets of types particle_types with force constant force_const and angle [radians]
- add_polymer_bond_1D(particle_types1, polymer_offset1, particle_types2, polymer_offset2, force_const, bond_length, system)[source]¶
- adds a bond between all polymer numbers
from types particle_types1 with offset polymer_offset1 to types particle_types2 with offset polymer_offset2 with force constant force_const and length bond_length [nm]
- add_polymer_bond_2D(particle_types1, polymer_offsets1, particle_types2, polymer_offsets2, force_const, bond_length, system)[source]¶
- adds a bond between all polymer numbers
from types particle_types1 with offsets polymer_offsets1 to types particle_types2 with offsets polymer_offsets2 with force constant force_const and length bond_length [nm]
- add_polymer_dihedral_1D(particle_types1, polymer_offset1, particle_types2, polymer_offset2, particle_types3, polymer_offset3, particle_types4, polymer_offset4, force_const, angle, system)[source]¶
- adds a cosine dihedral between all polymer numbers
with offset polymer_offset of types particle_types with force constant force_const and angle [radians]
- add_polymer_dihedral_2D(particle_types1, polymer_offsets1, particle_types2, polymer_offsets2, particle_types3, polymer_offsets3, particle_types4, polymer_offsets4, force_const, angle, system)[source]¶
- adds a cosine dihedral between all polymer numbers
with offsets polymer_offsets of types particle_types with force constant force_const and angle [radians]
- add_repulsion(types1, types2, force_const, distance, system)[source]¶
- adds a pairwise repulsion to the system (if it hasn’t been added already)
between each type in types1 and each type in types2 with force constant force_const with equilibrium distance [nm]
- static analyze_frame_get_chain_of_types(start_particle_id, neighbor_types, frame_particle_data, chain_length=0, last_particle_id=None, result=[], next_neighbor_index=None, exact_match=True)[source]¶
Starting from the particle with start_particle_id, get ids for a chain of particles with neighbor_types in the given frame of data, avoiding the particle with last_particle_id, if chain_length = 0, return entire chain
- static analyze_frame_get_count_of_topologies_of_type(time_index, topology_type, topology_records, traj)[source]¶
Get the number of topologies of a given type at the given time index
- static analyze_frame_get_id_for_neighbor_of_types(particle_id, neighbor_types, frame_particle_data, exclude_ids=[], exact_match=True)[source]¶
Get the id for the first neighbor with one of the neighbor_types in the given frame of data
- static analyze_frame_get_ids_for_types(particle_types, frame_particle_data)[source]¶
Get a list of ids for all the particles with particle type in the given list of types in the given frame of data
- static analyze_frame_get_neighbor_ids_of_types(particle_id, particle_types, frame_particle_data, exact_match)[source]¶
Get a list of ids for all the neighbors of particle_id with particle type in the given list of types in the given frame of data
- static analyze_reaction_count_over_time(reactions, reaction_name)[source]¶
Get a list of the number of times a reaction happened between each analyzed timestep of the given reaction
- static calculate_concentration(n, dim)[source]¶
- calculates the concentration for a species
with number of particles n in a cuboidal container with dimensions dim = dimx, dimy, dimz [nm]
returns concentration [uM]
- static calculate_diffusionCoefficient(r0, eta, T)[source]¶
- calculates the theoretical diffusion constant of a spherical particle
with radius r0[nm] in a media with viscosity eta [cP] at temperature T [Kelvin]
returns nm^2/s
- static calculate_nParticles(C, dim)[source]¶
- calculates the number of particles for a species
at concentration C [uM] in a cuboidal container with dimensions dim = dimx, dimy, dimz [nm]
returns unitless number
- static calculate_polymer_number(number, offset)[source]¶
- calculates the polymer number
from number by offset in [-2, 2]
returns number in [1,3]
- static clamp_polymer_offsets_2D(polymer_index_x, polymer_offsets)[source]¶
clamp offsets so y polymer offset is incremented if new x polymer index is not in [1,3]
- static create_readdy_simulation(system, n_cpu, sim_name='', total_steps=0, record=False, save_checkpoints=False)[source]¶
Create the ReaDDy simulation
- static get_angle_between_vectors(v1, v2, in_degrees=False)[source]¶
get the angle between two vectors in radians unless in_degrees is True
- static get_current_monomers(current_topologies)[source]¶
During a running simulation, get data for topologies of particles
- static get_current_particle_edges(current_topologies)[source]¶
During a running simulation, get all the edges in the ReaDDy topologies as (particle1 id, particle2 id) from readdy.simulation.current_topologies
- static get_first_neighbor(topology, vertex, exclude_vertices, verbose=False, debug_msg='', error_msg='')[source]¶
get the first neighboring vertex
- static get_first_vertex_of_types(topology, vertex_types, verbose=False, debug_msg='', error_msg='')[source]¶
get the first vertex with any of the given types
- static get_neighbor_of_type(topology, vertex, vertex_type, exact_match, exclude_vertices=[], verbose=False, debug_msg='', error_msg='')[source]¶
get the first neighboring vertex of type vertex_type
- static get_neighbor_of_types(topology, vertex, vertex_types, exclude_vertices, verbose=False, debug_msg='', error_msg='')[source]¶
get the first neighboring vertex with any of the given types, excluding particles with the given ids
- static get_neighbors_of_type(topology, vertex, vertex_type, exact_match, verbose=False, debug_msg='', error_msg='')[source]¶
get all neighboring vertices with a given type
- static get_non_periodic_boundary_position(pos1, pos2, box_size)[source]¶
if the distance between two positions is greater than box_size, move the second position across the box (for positioning calculations)
- static get_orientation_from_positions(positions)[source]¶
orthonormalize and cross the vectors from position 2 to the other positions to get a basis local to position 2, positions = [position 1, position 2, position 3]
- static get_orientation_from_vectors(v1, v2)[source]¶
orthonormalize and cross the vectors to get a rotation matrix
- static get_perpendicular_components_of_vector(v, v_perpendicular)[source]¶
Get the components of v that are perpendicular to v_perpendicular
- static get_random_boundary_position(box_size)[source]¶
get a random position on one of the boundary faces
- static get_random_vertex_of_type(topology, vertex_type, exact_match, verbose=False, debug_msg='', error_msg='')[source]¶
get a random vertex with a given type
- static get_random_vertex_of_types(topology, vertex_types, verbose=False, debug_msg='', error_msg='')[source]¶
get a random vertex with any of the given types
- static get_types_with_polymer_numbers_1D(particle_types, x, polymer_offset)[source]¶
- creates a list of types with 1D polymer numbers
for each type in particle types at polymer number x with polymer_offset dx in [-2, 2]
returns list of types
- static get_types_with_polymer_numbers_2D(particle_types, x, y, polymer_offsets)[source]¶
- creates a list of types with 2D polymer numbers
for each type in particle types at polymer number x_y with polymer_offsets [dx, dy] both in [-2, 2]
returns list of types
- static get_vertex_of_type(topology, vertex_type, exact_match, verbose=False, debug_msg='', error_msg='')[source]¶
get the first vertex with a given type
- static get_vertex_with_id(topology, vertex_id, verbose=False, debug_msg='', error_msg='')[source]¶
get the first vertex with a given id
- static get_vertices_of_type(topology, vertex_type, exact_match, verbose=False, debug_msg='', error_msg='')[source]¶
get all vertices with a given type
- static load_reactions(trajectory, stride, total_reactions_mapping, recorded_steps=1000.0)[source]¶
Read reaction counts per frame from a ReaDDy trajectory and create a DataFrame with the number of times each ReaDDy reaction and total set of reactions has happened by each time step / stride
- static monomer_data_and_reactions_from_file(h5_file_path, stride=1, timestep=0.1, reaction_names=None, pickle_file_path=None, save_pickle_file=False)[source]¶
For data saved in a ReaDDy .h5 file:
For each time point, get monomer data as a dictionary: {
- “topologies”mapping of topology id to data for each topology:
- [id: int]{
“type_name” : str, “particle_ids” : List[int]
}
- “particles”mapping of particle id to data for each particle:
- [id: int]{
“type_name” : str, “position” : np.ndarray, “neighbor_ids” : List[int]
}
}
Also return the counts of reactions over time, the timestamps for each frame, and the reaction time increment in seconds
- static particle_type_with_flags(particle_type, add_flags, remove_flags, reverse_sort=False)[source]¶
get particle type with the flags added and removed
- static rate_function_infinity(topology)[source]¶
rate function for a reaction that should trigger immediately whenever reactants are available
- static reaction_function_reset_state(topology)[source]¶
reaction function for removing flags from a topology
- static set_flags(topology, recipe, vertex, add_flags, remove_flags, reverse_sort=False)[source]¶
set flags on a vertex
- static vertex_not_found(topology, verbose, error_msg, debug_msg)[source]¶
If a vertex was not found, check if an exception should be raised or a debug message should be printed If error_msg == “”, don’t raise an exception If not verbose or debug_msg == “”, don’t print the message
- static vertex_satisfies_type(vertex_type, types_include, types_exclude)[source]¶
check if vertex satisfies the type requirements