The number of residues per turn at each Monomer in the Polymer.

    Notes
    -----
    Each element of the returned list is the number of residues
    per turn, at a point on the Polymer primitive. Calculated using
    the relative positions of the CA atoms and the primitive of the
    Polymer. Element i is the calculated from the dihedral angle using
    the CA atoms of the Monomers with indices [i, i+1] and the
    corresponding atoms of the primitive. The final value is None.

    Parameters
    ----------
    p : ampal.Polypeptide
        `Polypeptide` from which residues per turn will be calculated.

    Returns
    -------
    rpts : [float]
        Residue per turn values.

def residues_per_turn(p):
    """ The number of residues per turn at each Monomer in the Polymer.

    Notes
    -----
    Each element of the returned list is the number of residues
    per turn, at a point on the Polymer primitive. Calculated using
    the relative positions of the CA atoms and the primitive of the
    Polymer. Element i is the calculated from the dihedral angle using
    the CA atoms of the Monomers with indices [i, i+1] and the
    corresponding atoms of the primitive. The final value is None.

    Parameters
    ----------
    p : ampal.Polypeptide
        `Polypeptide` from which residues per turn will be calculated.

    Returns
    -------
    rpts : [float]
        Residue per turn values.
    """
    cas = p.get_reference_coords()
    prim_cas = p.primitive.coordinates
    dhs = [abs(dihedral(cas[i], prim_cas[i], prim_cas[i + 1], cas[i + 1]))
           for i in range(len(prim_cas) - 1)]
    rpts = [360.0 / dh for dh in dhs]
    rpts.append(None)
    return rpts