Skip to content

Select

run_select_atoms(select, path_topo, path_output=None, path_coords=None, kwargs_universe=dict(), kwargs_writer=dict(), overwrite=False)

Select atoms from molecular structure using MDAnalysis and optionally write new coordinates.

PARAMETER DESCRIPTION
select

TYPE: str

path_topo

Path to topology file.

TYPE: str

path_output

Path to save new coordinate file. If None, then no file is written.

TYPE: str | None DEFAULT: None

path_coords

Paths to coordinate file(s) to load.

TYPE: str | list[str] | None DEFAULT: None

kwargs_universe

Keyword arguments for initializing the MDAnalysis Universe.

TYPE: dict[str, Any] DEFAULT: dict()

kwargs_writer

Keyword arguments for MDAnalysis writers.

TYPE: dict[str, Any] DEFAULT: dict()

overwrite

Overwrites coordinate file located at path_output. This will error out if False and the file exists.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
AtomGroup

Atomic positions after atom selection.

Example

Suppose we want to extract just protein atoms from an Amber simulation.

run_select_atoms(
    select="protein",
    path_topo="mol.prmtop",
    path_output="protein.nc",
    path_coords="traj.nc",
)