Exemple #1
0
def test_target_rmsd_calculation(
    mock_Ih_table,
    mock_Ih_table_workfree,
    mock_multi_apm_withrestraints,
    mock_multi_apm_withoutrestraints,
):
    """Test the RMSD calculation for various scenarios - including an Ih
    table split into a work and free set and components with/without restraints.
    """
    target = ScalingTarget()
    assert len(target.rmsd_names) == 1
    assert len(target.rmsd_units) == 1
    assert target.param_restraints is True
    # with input, expect residuals of [-1, 0, 1], weights of [1, 1, 1],
    # restraints of [1, 2, 3], so expect residual of sqrt((2+6)/3)
    rmsds = target.rmsds(mock_Ih_table, mock_multi_apm_withrestraints)
    assert len(rmsds) == 1
    assert target.param_restraints is True

    rmsds = target.rmsds(mock_Ih_table_workfree, mock_multi_apm_withrestraints)
    assert len(rmsds) == 3
    assert rmsds[0] == pytest.approx((8.0 / 3.0)**0.5, abs=1e-6)
    assert rmsds[1] == pytest.approx((2.0 / 3.0)**0.5, abs=1e-6)
    assert rmsds[2] == pytest.approx((2.0 / 3.0)**0.5, abs=1e-6)
    assert target.param_restraints is True
    assert len(target.rmsd_names) == 3
    assert len(target.rmsd_units) == 3

    rmsds = target.rmsds(mock_Ih_table, mock_multi_apm_withoutrestraints)
    assert len(rmsds) == 1
    assert rmsds[0] == pytest.approx((2.0 / 3.0)**0.5, abs=1e-6)
    assert target.param_restraints is False
    assert len(target.rmsd_names) == 1
    assert len(target.rmsd_units) == 1
Exemple #2
0
def test_target_rmsd_calculation(mock_apm_restrained, mock_apm_unrestrained):
    """Test the RMSD calculation, with and without restraints."""
    target = ScalingTarget()
    assert target.param_restraints is True
    # with input, expect residuals of [-1, 0, 1], weights of [1, 1, 1],
    # restraints of [1, 2, 3], so expect residual of sqrt((2+6)/3)
    rmsds = target.rmsds(mock_Ih_table(), mock_apm_restrained)
    assert len(rmsds) == 1
    assert rmsds[0] == pytest.approx((8.0 / 3.0)**0.5, abs=1e-6)
    assert target.param_restraints is True

    # test rmsd calculation without restraints
    rmsds = target.rmsds(mock_Ih_table(), mock_apm_unrestrained)
    assert len(rmsds) == 1
    assert rmsds[0] == pytest.approx((2.0 / 3.0)**0.5, abs=1e-6)
    assert target.param_restraints is False