Example #1
0
def get_positions_from_pdbfile(filename):
    """
    Reads the positions from a PDB file.

    :param filename: Path to the file where we will read PDB coordinates.
    :type filename: str

    :returns:
      - positions ( `Quantity() <https://docs.openmm.org/development/api-python/generated/simtk.unit.quantity.Quantity.html>`_ ( np.array( [cgmodel.num_beads,3] ), simtk.unit ) ) - Positions for the particles in the PDB file.
    """

    pdb_mm_obj = PDBFile(filename)
    positions = pdb_mm_obj.getPositions()

    return positions
Example #2
0
def read_pdbfile(cgmodel, filename):
    """
    Reads the positions and topology from a PDB file.

    :param cgmodel: CGModel() class object
    :type cgmodel: class

    :param filename: Path to the file where we will read PDB coordinates.
    :type filename: str

    :returns:
      - cgmodel - A CGModel() class object with the positions and topology from the PDB file that was read.

    """

    pdb_mm_obj = PDBFile(filename)
    cgmodel.positions = pdb_mm_obj.getPositions()
    cgmodel.topology = pdb_mm_obj.getTopology()

    return cgmodel