Ejemplo n.º 1
0
def test_nerf_long():
    PROTEIN_XYZ = np.loadtxt('test_protein.xyz', dtype=np.dtype('f8'))

    dof = iNeRF(PROTEIN_XYZ)
    xyz = NeRF(dof)

    assert np.all(np.absolute(xyz - PROTEIN_XYZ) < 0.001)
Ejemplo n.º 2
0
def test_nerf_vectorized_abc():
    DOFS = perturb_dofs(np.repeat(DOF[np.newaxis], repeats, axis=0),
                        bond_length_factor=0.01 * np.ones(1),
                        bond_angle_factor=0.1 * np.ones(len(DOF)),
                        bond_torsion_factor=1.0 * np.ones((repeats, len(DOF))))

    xyzs = NeRF(DOFS, abcs=ABC, deps=DEP)
    dofs = iNeRF(xyzs, deps=DEP)

    xyzs_delta = xyzs - XYZ

    dofs_delta = dofs - DOF
    dofs_delta[np.where(dofs_delta > 180.0)] -= 360.0
    dofs_delta[np.where(dofs_delta < -180.0)] += 360.0

    assert np.all(np.absolute(np.mean(xyzs_delta, axis=0)) < 0.05)
    assert np.all(np.absolute(np.mean(dofs_delta, axis=0)) < 0.05)
Ejemplo n.º 3
0
    ])

    dep = np.array([
        [0, 0, 0],  #
        [0, 0, 0],  #
        [1, 0, 0],  #
        [1, 0, 2],  #
        [3, 1, 0],  # <- Perturb SG1-CB1-CA1-N1
        [4, 3, 1],  # <- Perturb SG2-SG1-CB1-CA1
        [5, 4, 3],  # <- Perturb CB2-SG2-SG1-CB1
        [6, 5, 4],  # <- Perturb CA2-CB2-SG2-SG1
        [7, 6, 5],  # <- Perturb N2-CA2-CB2-SG2
        [7, 6, 8],  #
    ])

    dof = nerf.iNeRF(xyz, dependency=dep)

    repeats = 100
    dofs = np.repeat(dof[np.newaxis], repeats, axis=0)
    for i in [4, 5, 6, 7, 8]:  # [CA1-CB1, CB1-SG1, SG1-SG2, SG2-CB2, CB2-CA2]
        dofs[:, i, 2] += np.random.uniform(-5, 5, repeats)
        dofs[:, i,
             2] = (dofs[:, i, 2] + (180.0 + chi_resolution / 2.0)) % 360.0 - (
                 180.0 + chi_resolution / 2.0)

    xyzs = nerf.NeRF(dofs, dependency=dep)

    stubs_a = homog.hstub(xyzs[:, 0, :], xyzs[:, 1, :],
                          xyzs[:, 2, :])  # N1 CA1 C1
    stubs_b = homog.hstub(xyzs[:, -2, :], xyzs[:, -3, :],
                          xyzs[:, -1, :])  # N2 CA2 C2
Ejemplo n.º 4
0
def test_nerf_abc():
    xyz = NeRF(DOF, abcs=ABC, deps=DEP)
    dof = iNeRF(xyz, deps=DEP)

    assert np.all(np.absolute(xyz - XYZ) < 0.001)
    assert np.all(np.absolute(dof - DOF) < 0.001)
Ejemplo n.º 5
0
def test_nerf():
    xyz = NeRF(DOF, deps=DEP)
    dof = iNeRF(xyz, deps=DEP)

    assert np.all(np.absolute(xyz - ORIGIN_XYZ) < 0.001)
    assert np.all(np.absolute(dof - DOF) < 0.001)