Model

The Model class stores the structural data of your system, and as such it contains all Chain, Molecule, and Atom instances of your system. It is possibly the most useful class for a user in practice, as the function that generates hybrid systems to be used in alchemical calculations (pmx.alchemy.mutate()) acts on this object.

API Reference

class pmx.model.Model(filename=None, pdbline=None, renumber_atoms=True, renumber_residues=True, rename_atoms=False, scale_coords=None, bPDBTER=True, bNoNewID=True, bPDBGAP=False, **kwargs)

Model Class.

Parameters
  • filename (str) – filename of input structure

  • pdbline (bool(?)) – what is pdbline?

  • renumber_atoms (bool, optional) – renumber all atoms from 1. Default is True.

  • renumber_residues (bool, optional) – renumber all residues from 1. In this way, each residue will have a unique ID, also across chains. Default is True.

  • rename_atoms (bool, optional) – rename atoms so to conform to Gromacs format. Default is False.

  • scale_coords (A|nm, optional) – whether to enforce the units of the coordinates to be in A or in nm. By default, PDB coordinates are assumed to be in Angstrom (A) and GRO coordinates in nanometers (nm). If you read a PDB file but would like operate on nm coordinates, then select “nm”. Viceversa, if you read a GRO file but would like to work on A coordinates, select “A”. Note that if you read a PDB file in A coordinates and select “A”, nothing happens (same for GRO and “nm” selection).

  • bPDBTER (bool) – whether to recognize TER lines and other chain breaks, e.g. discontinuous residue indices(?). Default is True.

  • bNoNewID (bool) – whether to assign new chain IDs? If True, new chain IDs starting with ‘pmx’ will be assigned(?). Only relevant if bPDBTER is True. Default is True.

  • bPDBGAP (bool) – whether search for gaps in the chain to assign new chain IDs.

title

title of model. Default is ‘PMX MODEL’.

Type

str

filename

filename from which the Model was imported, otherwise None.

Type

str

chains

list of Chain instances

Type

list

chdic

dict with chain IDs as keys and Chain instances as values

Type

dict

residues

list of molecules/residues

Type

list

unity

coordinates unit, either ‘A’ or ‘nm’.

Type

str

box

3x3 array containing the box vectors. See Gromacs manual, Table 3.1

Type

2d array

moltype

Type of system: protein, dna, rna, or unknown if organic molecule or a mix of molecules are in the system.

Type

str

Methods

read(filename[, bPDBTER, bNoNewID, bPDBGAP])

PDB/GRO file reader.

write(fn[, title, nr, bPDBTER, bAssignChainIDs])

Writes Model to file.

renumber_residues()

Renumbers all residues from 1.

renumber_atoms([start])

Renumber all atoms starting from a chosen number (default is 1).

insert_residue(pos, res, chain_id)

Inserts a residue in Model.

insert_chain(pos, new_chain)

Inserts a Chain in Model.

remove_atom(atom)

Removes an Atom instance.

remove_residue(residue[, renumber_atoms, …])

Removes a Molecule/residue instance.

remove_chain(key)

Removes a Chain instance given the chain ID.

replace_residue(residue, new[, bKeepResNum])

Replaces a residue.

fetch_residue(idx[, chain])

Get a residue based on its index, or index and chain.

fetch_residues(key[, inv])

Gets residues using a list of residue names.