delete_xyz_trj_atoms

Deletes specified atoms from a single XYZ or an XYZ trajectory. Also allows the user to sample the trajectory with a stride option.

Module Contents

Functions

parse_in_file(in_file_path)

Parses the .in file and returns a set of atom indices to remove.

remove_atoms_from_xyz(xyz_input, xyz_output, ...[, stride])

Reads an xyz trajectory from xyz_input, removes atoms whose 1-indexed order

main(in_files, xyz_input, xyz_output)

Attributes

in_files

delete_xyz_trj_atoms.parse_in_file(in_file_path)

Parses the .in file and returns a set of atom indices to remove. The .in file can contain ranges (e.g. “1-8”) and single numbers, and any text after a ‘#’ is ignored.

delete_xyz_trj_atoms.remove_atoms_from_xyz(xyz_input, xyz_output, atoms_to_remove, stride=1)

Reads an xyz trajectory from xyz_input, removes atoms whose 1-indexed order (in each frame) is in atoms_to_remove, updates the atom count per frame, applies the stride sampling, and writes the cleaned frames to xyz_output.

Each frame is assumed to consist of:
  • A first line with an integer (total number of atoms)

  • A title/comment line (left unchanged)

  • Followed by that many atom coordinate lines.

The stride indicates that the output should include:
  • The first frame,

  • Every stride-th frame from the trajectory,

  • And the last frame (if not already included).

delete_xyz_trj_atoms.main(in_files, xyz_input, xyz_output)
delete_xyz_trj_atoms.in_files