PDBxFile

class openmm.app.pdbxfile.PDBxFile(file)

PDBxFile parses a PDBx/mmCIF file and constructs a Topology and a set of atom positions from it.

__init__(file)

Load a PDBx/mmCIF file.

The atom positions and Topology can be retrieved by calling getPositions() and getTopology().

Parameters

file (string) – the name of the file to load. Alternatively you can pass an open file object.

Methods

__init__(file)

Load a PDBx/mmCIF file.

getNumFrames()

Get the number of frames stored in the file.

getPositions([asNumpy, frame])

Get the atomic positions.

getTopology()

Get the Topology of the model.

writeFile(topology, positions[, file, …])

Write a PDBx/mmCIF file containing a single model.

writeHeader(topology[, file, entry, keepIds])

Write out the header for a PDBx/mmCIF file.

writeModel(topology, positions[, file, …])

Write out a model to a PDBx/mmCIF file.

getTopology()

Get the Topology of the model.

getNumFrames()

Get the number of frames stored in the file.

getPositions(asNumpy=False, frame=0)

Get the atomic positions.

Parameters
  • asNumpy (bool=False) – if true, the values are returned as a numpy array instead of a list of Vec3s

  • frame (int=0) – the index of the frame for which to get positions

static writeFile(topology, positions, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, keepIds=False, entry=None)

Write a PDBx/mmCIF file containing a single model.

Parameters
  • topology (Topology) – The Topology defining the model to write

  • positions (list) – The list of atomic positions to write

  • file (string or file) – the name of the file to write. Alternatively you can pass an open file object.

  • keepIds (bool=False) – If True, keep the residue and chain IDs specified in the Topology rather than generating new ones. Warning: It is up to the caller to make sure these are valid IDs that satisfy the requirements of the PDBx/mmCIF format. Otherwise, the output file will be invalid.

  • entry (str=None) – The entry ID to assign to the CIF file

static writeHeader(topology, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, entry=None, keepIds=False)

Write out the header for a PDBx/mmCIF file.

Parameters
  • topology (Topology) – The Topology defining the molecular system being written

  • file (file=stdout) – A file to write the file to

  • entry (str=None) – The entry ID to assign to the CIF file

  • keepIds (bool=False) – If True, keep the residue and chain IDs specified in the Topology rather than generating new ones. Warning: It is up to the caller to make sure these are valid IDs that satisfy the requirements of the PDBx/mmCIF format. Otherwise, the output file will be invalid.

static writeModel(topology, positions, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, modelIndex=1, keepIds=False)

Write out a model to a PDBx/mmCIF file.

Parameters
  • topology (Topology) – The Topology defining the model to write

  • positions (list) – The list of atomic positions to write

  • file (file=stdout) – A file to write the model to

  • modelIndex (int=1) – The model number of this frame

  • keepIds (bool=False) – If True, keep the residue and chain IDs specified in the Topology rather than generating new ones. Warning: It is up to the caller to make sure these are valid IDs that satisfy the requirements of the PDBx/mmCIF format. Otherwise, the output file will be invalid.