Skip to content

Readers

sinccity.load

load(path, *, include_hetatm: bool = False, residues=None, masses=None, elements=None, unwrap='auto') -> Structure

Read a structure file, choosing the reader by extension.

Options a format does not have are ignored with a note.

Parameters:

Name Type Description Default
path

A .pdb, .gro, .sld (or .txt) or .vtk file.

required
include_hetatm bool

PDB only; also read HETATM records (never waters).

False
residues

PDB and GRO; the residue names to read, and only those.

None
masses

PDB and GRO; by residue name, the atom masses in u in topology order. Each mass gives the element of nearest mass.

None
elements

PDB and GRO; by residue name, the element symbols in order.

None
unwrap

PDB and GRO; make the aggregate whole across the periodic box. 'auto': GRO yes, PDB no (many programs write a placeholder CRYST1). True: PDB uses CRYST1, and a missing or placeholder box is an error. False: never.

'auto'

sinccity.read_pdb

read_pdb(path, *, include_hetatm: bool = False, residues=None, masses=None, elements=None, unwrap='auto') -> Structure

Read the atoms of a PDB file.

Policies: the first MODEL only; one alternate-location ID for the whole structure (blank plus the first non-blank ID seen); occupancy not applied; waters never read. Residue names are read from columns 18-21, where MD programs write four-letter names; a residue number that is not a decimal integer (hybrid-36 past 9999) starts a new residue whenever it changes. The CRYST1 box is stored unless it is unreadable or a placeholder (a side of 1 Å or less). Each policy that drops or ignores something adds a note. Elements per residue name come from masses, elements, the element column 77-78 when it is filled for the whole residue, or SasView's guess from the atom name, in that order.

Parameters:

Name Type Description Default
path

The PDB file.

required
include_hetatm bool

Also read HETATM records.

False
residues

The residue names to read. When given, it is the whole selection: the water and HETATM rules do not apply.

None
masses

As load takes it.

None
elements

As load takes it.

None
unwrap

As load takes it.

'auto'

sinccity.read_gro

read_gro(path, *, residues=None, masses=None, elements=None, unwrap='auto') -> Structure

Read the atoms of a GROMACS .gro file.

Fields are cut at their fixed columns, since names may touch numbers. As GROMACS defines it, the width of a position field is the distance between the decimal points of the first atom's x and y, which covers files written with -ndec. Positions are converted from nm to Å; velocities are ignored. The box on the last line is used for unwrapping. Elements per residue name come from masses, elements, or a guess from the atom names (see sinccity.elements.guess_stem), in that order.

Parameters:

Name Type Description Default
path

The .gro file.

required
residues

The residue names to read. A solvated system needs it: there is no water rule, and the reader notes when it reads more than one residue name without a selection.

None
masses

As load takes it.

None
elements

As load takes it.

None
unwrap

As load takes it.

'auto'

sinccity.read_sld

read_sld(path) -> Structure

Read a SasView SLD text file.

The first line is a header and is always skipped. Columns: x y z sld (4), x y z sld mx my mz (7) or x y z sld mx my mz volume (8); six columns are magnetic-only and refused. Without a volume column the points must form a lattice, and each pixel's volume is the product of the steps. A sparse subset that skips planes looks like a coarser lattice, so such files need the volume column.

sinccity.read_vtk

read_vtk(path) -> Structure

Read a legacy ASCII VTK UNSTRUCTURED_GRID as one point per cell.

Supports cell types 10 (tetrahedron), 11 (voxel), 12 (hexahedron), 13 (wedge) and 14 (pyramid), in the classic and the 5.1 OFFSETS layout. The nuclear SLD is the single one-component SCALARS field, given per cell or per point (point values are averaged to cells with SasView's inverse-square weights about the cell's vertex mean). Three-component fields are magnetic and ignored. Each cell becomes a point at its volume centroid with the cell's volume and SLD. Units are taken as Å and Å⁻².