dynsight.trajectory.Trj

class dynsight.trajectory.Trj(universe, trajslice=None)[source]

Contains a trajectory.

Parameters:
  • universe (Universe)

  • trajslice (slice | None)

universe

a MDAnalysis.Universe containing the trajectory.

Type:

MDAnalysis.core.universe.Universe

Warning

This class is under development. The name and type of the “universe” attribute may change in the future.

Methods

dump_colored_trj

Save an .xyz file with the labels for each atom.

dump_xyz_with_insight

Save an .xyz file with the insights values for each atom.

get_coord_number

Compute coordination number on the trajectory.

get_coordinates

Returns the coordinates as an array.

get_lens

Compute LENS on the trajectory.

get_orientational_op

Compute the magnitude of the orientational order parameter.

get_rdf

Compute the radial distribution function g(r).

get_slice

Returns a Trj with a subset of frames.

get_soap

Compute SOAP on the trajectory.

get_timesoap

Compute SOAP and then timeSOAP on the trajectory.

get_velocity_alignment

Compute the average velocity alignment.

init_from_universe

Initialize Trj object from MDAnalysis.Universe.

init_from_xtc

Initialize Trj object from .gro and .xtc files.

init_from_xyz

Initialize Trj object from .xyz file.

with_slice

Returns a Trj with a different frames' slice.

Attributes

trajslice

universe

n_atoms

n_frames

dump_colored_trj(labels, file_path)[source]

Save an .xyz file with the labels for each atom.

The output file has columns: atom_type, x, y, z, label.

Parameters:
  • labels (NDArray[np.int64])

  • file_path (Path)

Return type:

None

dump_xyz_with_insight(insight_list, file_path)[source]

Save an .xyz file with the insights values for each atom.

The output file has columns: atom_type, x, y, z, ins_1, ins_2, …

Parameters:
Return type:

None

get_coord_number(r_cut, centers='all', selection='all', respect_pbc=True, neigcounts=None, n_jobs=1)[source]

Compute coordination number on the trajectory.

Returns:

  • neighcounts: a list[list[AtomGroup]], it can be used to

    speed up subsequent descriptors’ computations.

  • An Insight containing the number of neighbors. It has the

    following meta: name, r_cut, centers, selection.

Return type:

tuple

Parameters:
get_coordinates(selection)[source]

Returns the coordinates as an array.

The array has shape (n_frames, n_atoms, n_coordinates).

Parameters:

selection (str)

Return type:

NDArray[np.float64]

get_lens(r_cut, delay=1, centers='all', selection='all', respect_pbc=True, n_jobs=1)[source]

Compute LENS on the trajectory.

Returns:

Insight

An Insight containing LENS. It has the following meta: name, r_cut, delay, centers, selection.

Parameters:
Return type:

Insight

get_orientational_op(r_cut, order=6, centers='all', selection='all', respect_pbc=True, neigcounts=None, n_jobs=1)[source]

Compute the magnitude of the orientational order parameter.

Returns:

  • neighcounts: a list[list[AtomGroup]], it can be used to

    speed up subsequent descriptors’ computations.

  • An Insight containing the orientational order parameter.

    It has the following meta: name, r_cut, order, centers, selection.

Return type:

tuple

Parameters:
get_rdf(distances_range, s1='all', s2='all', exclusion_block=None, nbins=200, norm='rdf')[source]

Compute the radial distribution function g(r).

See https://docs.mdanalysis.org/1.1.1/documentation_pages/analysis/rdf.html.

Returns:

  • A list of values of the interparticle distance r

  • The corresponding list of values of g(r)

Return type:

tuple

Parameters:
  • distances_range (list[float])

  • s1 (str)

  • s2 (str)

  • exclusion_block (list[int] | None)

  • nbins (int)

  • norm (Literal['rdf', 'density', 'none'])

get_slice(start, stop, step)[source]

Returns a Trj with a subset of frames.

Warning

This function could fill up the memory in case of large trajectories and it’s deprecated. Use Trj.with_slice() instead.

Parameters:
Return type:

Trj

get_soap(r_cut, n_max, l_max, selection='all', centers='all', respect_pbc=True, n_jobs=1)[source]

Compute SOAP on the trajectory.

The returned Insight contains the following meta: name, r_cut, n_max, l_max, respect_pbc, selection, centers.

Parameters:
Return type:

Insight

get_timesoap(r_cut=None, n_max=None, l_max=None, soap_insight=None, selection='all', centers='all', respect_pbc=True, n_jobs=1, delay=1)[source]

Compute SOAP and then timeSOAP on the trajectory.

The returned Insights (soap and timesoap) contain the following meta: name, r_cut, n_max, l_max, respect_pbc, selection, centers. Regarding the timeSOAP Insight, the delay used is also included.

Parameters:
Return type:

tuple[Insight, Insight]

get_velocity_alignment(r_cut, centers='all', selection='all', respect_pbc=True, neigcounts=None, n_jobs=1)[source]

Compute the average velocity alignment.

Returns:

  • neighcounts: a list[list[AtomGroup]], it can be used to

    speed up subsequent descriptors’ computations.

  • An Insight containing the average velocities alignment.

    It has the following meta: name, r_cut, centers, selection.

Return type:

tuple

Parameters:
classmethod init_from_universe(universe)[source]

Initialize Trj object from MDAnalysis.Universe.

See https://docs.mdanalysis.org/2.9.0/documentation_pages/core/universe.html#MDAnalysis.core.universe.Universe.

Parameters:

universe (Universe)

Return type:

Trj

classmethod init_from_xtc(traj_file, topo_file)[source]

Initialize Trj object from .gro and .xtc files.

See https://docs.mdanalysis.org/2.9.0/documentation_pages/core/universe.html#MDAnalysis.core.universe.Universe.

Parameters:
  • traj_file (Path)

  • topo_file (Path)

Return type:

Trj

classmethod init_from_xyz(traj_file, dt)[source]

Initialize Trj object from .xyz file.

See https://docs.mdanalysis.org/2.9.0/documentation_pages/core/universe.html#MDAnalysis.core.universe.Universe.

Parameters:
  • dt (float) – the trajectory’s time-step.

  • traj_file (Path)

Return type:

Trj

with_slice(trajslice)[source]

Returns a Trj with a different frames’ slice.

Parameters:

trajslice (slice | None)

Return type:

Trj