smc_lammps.post_process package

Subpackages

Submodules

smc_lammps.post_process.average_plot module

smc_lammps.post_process.average_plot.convert_units_distance(indices)
smc_lammps.post_process.average_plot.convert_units_time(steps)
smc_lammps.post_process.average_plot.create_figure_raw(steps, averages, num_samples: int)
smc_lammps.post_process.average_plot.create_figure_units(steps, averages, num_samples: int, linear_parameters=None)
smc_lammps.post_process.average_plot.get_averages(steps_array, indices_array, cutoff_to_shortest: bool = True)
smc_lammps.post_process.average_plot.get_data_raw(files: Sequence[str])
smc_lammps.post_process.average_plot.get_npz_files_from_args(args: Sequence[str])
smc_lammps.post_process.average_plot.linear(x, a, b)
smc_lammps.post_process.average_plot.linear_fit(steps, averages)
smc_lammps.post_process.average_plot.process(globs: Sequence[str])

smc_lammps.post_process.process_displacement module

smc_lammps.post_process.process_displacement.create_files(path: Path, steps: list[int], indices_array: list[list[int64]], positions_array: list[list[ndarray[tuple[Any, ...], dtype[float32]]]], id_tag_pairs_array: list[list[list[tuple[int, str]]]]) None
smc_lammps.post_process.process_displacement.create_plot(path: Path, steps: list[int], indices_array: Sequence[list[int64]], save_to: Path = PosixPath('bead_id_in_time.svg'), use_real_units: bool = True, plot_cycle: bool = False, moving_average: int = 0) None
smc_lammps.post_process.process_displacement.get_bead_distances(positions: ndarray[tuple[Any, ...], dtype[float32]], pos1: ndarray[tuple[Any, ...], dtype[float32]], pos2: ndarray[tuple[Any, ...], dtype[float32]], pos3: ndarray[tuple[Any, ...], dtype[float32]])
smc_lammps.post_process.process_displacement.get_best_match_dna_bead_in_smc(base_path: Path, traj: Path = PosixPath('output/output.lammpstrj'), continue_on_error: bool = False) tuple[list[int], list[list[int64]], list[list[ndarray[tuple[Any, ...], dtype[float32]]]], list[list[list[tuple[int, str]]]]]

Find the DNA bead that is inside of the SMC complex.

Parameters:
  • base_path – simulation directory (containing parameters.py and post_processing_parameters.py)

  • traj – path to lammps trajectory file to analyze (either relative to base_path or absolute)

  • continue_on_error – if an error occurs during parsing, try to analyze the data obtained up to that point

smc_lammps.post_process.process_displacement.get_msd_obstacle(folder_path)
smc_lammps.post_process.process_displacement.handle_dna_bead(full_data: LammpsData, filtered_dna: LammpsData, parameters, step) tuple[int64, ndarray[tuple[Any, ...], dtype[float32]], list[tuple[int, str]]]

Finds the DNA beads that are within the SMC ring and updates the indices, positions lists.

smc_lammps.post_process.process_displacement.is_sorted(lst: Sequence[Any]) bool
smc_lammps.post_process.process_displacement.main(argv: list[str])
smc_lammps.post_process.process_displacement.remove_outside_planar_n_gon(data: LammpsData, points: ndarray[tuple[Any, ...], dtype[float32]], delta_out_of_plane: float, delta_extended_plane: float)

removes all points outside a box created from an n-sided polygon in a plane. the points are the vertices of the n-gon and are assumed to be in the same plane. delta is the thickness of the box in each direction going out of the plane.

smc_lammps.post_process.process_displacement.split_into_index_groups(indices: Sequence[int], margin: int = 1) list[list[int]]

splits a (sorted) list of integers into groups of adjacent integers. adjacent means within [value, value + margin] (both bounds inclusive).

smc_lammps.post_process.process_displacement.write(file, steps: Sequence[int], positions: Sequence[ndarray[tuple[Any, ...], dtype[float32]]])

smc_lammps.post_process.smc_perspective module

class smc_lammps.post_process.smc_perspective.Atom(_id: str, _type: str, xyz: tuple[float, float, float], rounding: int = 2)

Bases: object

__init__(_id: str, _type: str, xyz: tuple[float, float, float], rounding: int = 2) None
rounding: int = 2
to_string() str
xyz: tuple[float, float, float]
smc_lammps.post_process.smc_perspective.main(trajectory_file: Path, output_file: Path, index1: int, index2: int, index3: int)
smc_lammps.post_process.smc_perspective.read_lammpstrj(trajectory_file: Path)
smc_lammps.post_process.smc_perspective.rigid_transform_3D(A, B) tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ndarray[tuple[Any, ...], dtype[_ScalarT]]]

implementation of Kabsch algorithm

smc_lammps.post_process.smc_perspective.transform_atoms(atom_data: Sequence[Sequence[Atom]], index1: int, index2: int, index3: int, v0: Sequence[float], v1: Sequence[float], v2: Sequence[float])
smc_lammps.post_process.smc_perspective.write_lammpstrj(file_path: Path, timesteps: Sequence[int], num_atoms: Sequence[int], box_bounds: Sequence[Sequence[list[float]]], atom_data: Sequence[Sequence[Atom]])

smc_lammps.post_process.types module

smc_lammps.post_process.util module

smc_lammps.post_process.util.get_cum_runtimes(runtimes: list[int]) dict[str, list[int]]

Returns the number of time steps that have passed at the START of each SMC phase.

Parameters:

runtimes – The list of runtimes (acquired from the post processing parameters).

Returns:

Dictionary with keys for each phase (APO, ATP, ADP), as well as a key for all phases combined (all).

smc_lammps.post_process.util.get_indices_array(id_tag_pairs_array: list[list[list[tuple[int, str]]]], order: Sequence[str] = ['pos_lower', 'pos_middle', 'pos_top', 'pos_center_arms']) list[ndarray[tuple[Any, ...], dtype[int64]]]

Returns arrays of indices based on an order of reference points.

smc_lammps.post_process.util.get_moving_average(array, n: int) ndarray[tuple[Any, ...], dtype[_ScalarT]]

Computes the moving average with window size n.

smc_lammps.post_process.util.get_post_processing_parameters(path: Path) dict[str, Any]

Loads the post processing parameters from the post_processing_parameters.py file.

Parameters:

path – Simulation base path.

Returns:

The module globals dictionary (see run_path()).

smc_lammps.post_process.util.get_scaled_cum_runtimes(runtimes: list[int], tscale: float) dict[str, list[float]]
smc_lammps.post_process.util.get_scaling(use_real_units: bool = True, parameters: Parameters | None = None) tuple[float, float, str, str]

Returns the scaling factors to go from simulation units to real units.

Returns the index scale (DNA bead index -> nm), and the time scale (timestep -> s).

Parameters:
  • use_real_units – If False, no conversion is performed (scaling = 1.0).

  • parameters – Simulation parameters.

Returns:

Tuple of (time scale, index scale, time units, index units)

Raises:

TypeErroruse_real_units is True, but parameters is set to None.

smc_lammps.post_process.util.get_site_cycle_segments(path: Path) list[tuple[int, int]]

Return timesteps when cycling site is on: list[(start_timestep, end_timestep)].

smc_lammps.post_process.util.keep_every_n(input_file: Path, output_file: Path, n: int) None

Keeps every nth timestep in a LAMMPS trajectory file.

  • If n == 1, everything is kept.

  • If n == 2, every other line is kept, (1st line kept, 2nd line discarded).

  • And so on.

Parameters:
  • input_file – LAMMPS trajectory file to read from.

  • output_file – LAMMPS trajectory file to write to (may be the same file as input_file).

  • n – Number of lines to skip over + 1 (see explanation above).

Raises:

ValueError – When n is smaller than or equal to zero.

smc_lammps.post_process.util.merge_lammpstrj(base_file: Path, second_file: Path, delete_after: bool = True) None

Merges two lammpstrj files together by removing any overlapping timesteps from the base file, and concatenatin the two files.

smc_lammps.post_process.util.qzip(array: Sequence[K], n: int) Iterator[tuple[K, ...]]

Creates a sequence of n arrays, each shifted to the left by i (its index). Useful to compute a moving average.

e.g. array = [1,2,3,4] and n = 3 returns => zip([1,2,3,4], [2,3,4], [3,4])

smc_lammps.post_process.util.scale_indices(indices: list[int64], iscale: float) list[float]
smc_lammps.post_process.util.scale_times(times: list[int], tscale: float) list[float]