shake_topology

A module containing the ShakeTopologyGenerator class.

Summary

Classes:

ShakeTopologyGenerator

A class for generating the shake topology for a given trajectory

Reference

class ShakeTopologyGenerator(
selection: SelectionCompatible = None,
use_full_atom_info: bool = False,
)[source]

Bases: object

A class for generating the shake topology for a given trajectory

Parameters:
  • selection (SelectionCompatible, optional) – Selection is either a selection object or any object that can be initialized via ‘Selection(selection)’. default None (all atoms)

  • use_full_atom_info (bool, optional) – If True, the full atom information (name, index, mass) is used for the selection, by default False Is always ignored if atoms is not a list of atom objects.

add_comments(
comments: list[str],
) None[source]

Adds comments to the topology.

Parameters:

comments (List[str]) – The comments to add to each line of the shake topology.

average_equivalents(
indices: list[Np1DIntArray] | Np2DIntArray,
comments: list[str] | None = None,
) None[source]

Averages the distances for equivalent atoms.

The parameter indices is a numpy 2d array of equivalent atom indices. Each row of the array contains the indices of equivalent atoms. All of the equivalent atoms will be averaged to a single distance.

Parameters:
  • indices (List[Np1DIntArray] | Np2DIntArray) – The indices of the equivalent atoms.

  • comments (List[str], optional) – The line comments for the averaged distances, by default None

generate_topology(
trajectory: Trajectory,
) None[source]

Generates a tuple of indices, target_indices, and distances for the given trajectory.

The generated numpy arrays represent all important information about the shake topology for the given trajectory.

  • indices: The indices of the atoms to use for the topology.

  • target_indices: The indices of the target atoms for the shaked atoms.

  • distances: The average distances between the shaked atoms and the target atoms.

Parameters:

trajectory (Trajectory) – The trajectory to generate the shake topology for.

write_topology(
filename: str | None = None,
mode: FileWritingMode | str = 'w',
) None[source]

Writes the topology to a file.

The topology is written to a file with the given filename. The file will contain the indices, target_indices, and distances of the topology. If no filename is given, the topology will be written to stdout.

Parameters:
  • filename (str) – The filename to write the topology to.

  • mode (FileWritingMode | str, optional) – The writing mode, by default “w”. The following modes are available: - “w”: write - “a”: append - “o”: overwrite

logger = <CustomLogger PQAnalysis.ShakeTopologyGenerator (INFO)>
property selection_object: SelectionCompatible

The selection object.

Type:

SelectionCompatible