oxdna simulation module

class oxdna_simulation.Simulation(file_dir: str, sim_dir: str | None = None)
build(clean_build=False)

Build dat, top, and input files in simulation directory.

Parameters:

clean_build (bool): If sim_dir already exsists, remove it and then rebuild sim_dir

input_file(parameters)

Modify the parameters of the oxDNA input file, all parameters are avalible at https://lorenzo-rovigatti.github.io/oxDNA/input.html

Parameters:

parameters (dict): dictonary of oxDNA input file parameters

add_protein_par()

Add a parfile from file_dir to sim_dir and add file name to input file

add_force_file()

Add a external force file from file_dir to sim_dir and add file name to input

add_force(force_js)

Add an external force to the simulation.

Parameters:

force_js (Force): A force object, essentially a dictonary, specifying the external force parameters.

add_observable(observable_js)

Add an observable that will be saved as a text file to the simulation.

Parameters:

observable_js (Observable): A observable object, essentially a dictonary, specifying the observable parameters.

make_sequence_dependant()

Add a sequence dependant file to simulation directory and modify input file to use it.

Parameters:

None

class oxdna_simulation.SimulationManager(n_processes=None)
queue_sim(sim, continue_run=False)

Add simulation object to the queue of all simulations.

Parameters:

sim (Simulation): Simulation to be queued. continue_run (bool): If true, continue previously run oxDNA simulation

worker_manager(gpu_mem_block=False, custom_observables=None, run_when_failed=False, cpu_run=False)

Head process in charge of allocating queued simulations to processes and gpu memory.

run(log=None, join=False, gpu_mem_block=False, custom_observables=None, run_when_failed=False, cpu_run=False)

Run the worker manager in a subprocess

start_nvidia_cuda_mps_control(pipe='$SLURM_TASK_PID')

Begin nvidia-cuda-mps-server.

Parameters:

pipe (str): directory to pipe control server information to. Defaults to PID of a slurm allocation

class oxdna_simulation.GenerateReplicas

Methods to generate multisystem replicas

multisystem_replica(systems, n_replicas_per_system, file_dir_list, sim_dir_list)

Create simulation replicas, with across multiple systems with diffrent inital files

Parameters:

systems (list): List of strings, where the strings are the name of the directory which will hold the inital files n_replicas_per_system (int): number of replicas to make per system file_dir_list (list): List of strings with path to intial files sim_dir_list (list): List of simulation directory paths

concat_all_system_traj()

Concatenate the trajectory of multiple replicas for each system

class oxdna_simulation.OxdnaAnalysisTools(sim)

Interface to OAT

align(outfile: str = 'aligned.dat', args: str = '', join: bool = False)

Align trajectory to mean strucutre

centroid(reference_structure='mean.dat', args='', join=False)

Extract conformation most similar to reference strucutre (mean.dat by default). centroid is actually a misnomer for this function.

decimate(outfile='strided_trajectory.dat', args='', join=False)

Modify trajectory file, mostly to decrease file size. Use args=’-h’ for more details

deviations(mean_structure='mean.dat', args='', join=False)

Calculate rmsf and rmsd with respect to the mean strucutre Use args=’-h’ for more details.

mean(traj='trajectory.dat', args='', join=False)

Compute the mean strucutre. Use args=’-h’ for more details

minify(traj='trajectory.dat', outfile='mini_trajectory.dat', args='', join=False)

Reduce trajectory file size. Use args=’-h’ for more details.

oxDNA_PDB(configuration='mean.dat', direction='35', pdbfiles='', args='', join=False)

Turn a oxDNA file into a PDB file. Use args=’-h’ for more details

pca(meanfile='mean.dat', outfile='pca.json', args='', join=False)

Preform principle componet analysis. Use args=’-h’ for more details

conformational_entropy(traj='trajectory.dat', temperature='293.15', meanfile='mean.dat', outfile='conformational_entropy.json', args='', join=False)

Calculate a strucutres conformational entropy (not currently supported in general). Use args=’-h’ for more details.

radius_of_gyration(traj='trajectory.dat', args='', join=False)

Calculate a strucutres radius_of_gyration (not currently supported in general). Use args=’-h’ for more details.

subset_trajectory(args='', join=False)

Extract specificed indexes from a trajectory, creating a new trajectory. Use args=’-h’ for more details

com_distance(base_list_file_1=None, base_list_file_2=None, base_list_1=None, base_list_2=None, args='', join=False)

Find the distance between the center of mass of two groups of particles (currently not supported generally). Use args=’-h’ for more details

angle(base_list_file_1=None, base_list_file_2=None, base_list_file_3=None, base_list_1=None, base_list_2=None, base_list_3=None, args='', join=False)

Find the angle between the center of mass of three groups of particles (currently not supported generally). Use args=’-h’ for more details

determine_cv_sign(base_list_file_1=None, base_list_file_2=None, base_list_file_3=None, base_list_1=None, base_list_2=None, base_list_3=None, args='', join=False)

Find the angle between the center of mass of three groups of particles (currently not supported generally). Use args=’-h’ for more details

class oxdna_simulation.Analysis(simulation)

Methods used to interface with oxDNA simulation in jupyter notebook (currently in work)

get_init_conf()

Returns inital topology and dat file paths, as well as x,y,z info of the conf.

get_last_conf()

Returns last topology and dat file paths, as well as x,y,z info of the conf.

view_init()

Interactivly view inital oxDNA conf in jupyter notebook.

view_last()

Interactivly view last oxDNA conf in jupyter notebook.

get_conf_count() int

Returns the number of confs in trajectory file.

get_conf(conf_id: int)

Returns x,y,z (and other) info of specified conf.

current_step() float

Returns the time-step of the most recently save oxDNA conf.

view_conf(conf_id: int)

Interactivly view oxDNA conf in jupyter notebook.

plot_energy(fig=None, ax=None, label=None)

Plot energy of oxDNA simulation.

class oxdna_simulation.Force

Currently implemented external forces for this oxDNA wrapper.

static morse(particle=None, ref_particle=None, a=None, D=None, r0=None, PBC=None)

Morse potential

static skew_force(particle=None, ref_particle=None, stdev=None, r0=None, shape=None, PBC=None)

Skewed Gaussian potential

static com_force(com_list=None, ref_list=None, stiff=None, r0=None, PBC=None, rate=None)

Harmonic trap between two groups

static mutual_trap(particle=None, ref_particle=None, stiff=None, r0=None, PBC=None)

A spring force that pulls a particle towards the position of another particle

Parameters:

particle (int): the particle that the force acts upon ref_particle (int): the particle that the particle will be pulled towards stiff (float): the force constant of the spring (in simulation units) r0 (float): the equlibrium distance of the spring PBC (bool): does the force calculation take PBC into account (almost always 1)

static string(particle, f0, rate, direction)

A linear force along a vector

Parameters:

particle (int): the particle that the force acts upon f0 (float): the initial strength of the force at t=0 (in simulation units) rate (float or SN string): growing rate of the force (simulation units/timestep) dir ([float, float, float]): the direction of the force

static harmonic_trap(particle, pos0, stiff, rate, direction)

A linear potential well that traps a particle

Parameters:

particle (int): the particle that the force acts upon pos0 ([float, float, float]): the position of the trap at t=0 stiff (float): the stiffness of the trap (force = stiff * dx) rate (float): the velocity of the trap (simulation units/time step) direction ([float, float, float]): the direction of movement of the trap

static rotating_harmonic_trap(particle, stiff, rate, base, pos0, center, axis, mask)

A harmonic trap that rotates in space with constant angular velocity

Parameters:

particle (int): the particle that the force acts upon pos0 ([float, float, float]): the position of the trap at t=0 stiff (float): the stiffness of the trap (force = stiff * dx) rate (float): the angular velocity of the trap (simulation units/time step) base (float): initial phase of the trap axis ([float, float, float]): the rotation axis of the trap mask([float, float, float]): the masking vector of the trap (force vector is element-wise multiplied by mask)

static repulsion_plane(particle, stiff, direction, position)

A plane that forces the affected particle to stay on one side.

Parameters:

particle (int): the particle that the force acts upon. -1 will act on whole system. stiff (float): the stiffness of the trap (force = stiff * distance below plane) dir ([float, float, float]): the normal vecor to the plane position(float): position of the plane (plane is d0*x + d1*y + d2*z + position = 0)

static repulsion_sphere(particle, center, stiff, r0, rate=1)

A sphere that encloses the particle

Parameters:

particle (int): the particle that the force acts upon center ([float, float, float]): the center of the sphere stiff (float): stiffness of trap r0 (float): radius of sphere at t=0 rate (float): the sphere’s radius changes to r = r0 + rate*t

class oxdna_simulation.Observable

Currently implemented observables for this oxDNA wrapper.

static distance(particle_1=None, particle_2=None, PBC=None, print_every=None, name=None)

Calculate the distance between two (groups) of particles

static hb_list(print_every=None, name=None, only_count=None)

Compute the number of hydrogen bonds between the specified particles

static particle_position(particle_id=None, orientation=None, absolute=None, print_every=None, name=None)

Return the x,y,z postions of specified particles

static potential_energy(print_every=None, split=None, name=None, precision=6, general_format=True)

Return the potential energy

static force_energy(print_every=None, name=None, print_group=None, precision=6, general_format='true')

Return the energy exerted by external forces

static kinetic_energy(print_every=None, name=None)

Return the kinetic energy