@pytest.mark.parametrize('bodies', body_list)
@pytest.mark.parametrize('multihyps', multi_list)
def test_predict(all_gp, all_mgp, bodies, multihyps):
    '\n    test the predict for mc_simple kernel\n    '
    gp_model = all_gp[f'{bodies}{multihyps}']
    mgp_model = all_mgp[f'{bodies}{multihyps}']
    nenv = 6
    cell = (1.0 * np.eye(3))
    cutoffs = gp_model.cutoffs
    unique_species = gp_model.training_statistics['species']
    (struc_test, f) = get_random_structure(cell, unique_species, nenv)
    test_envi = env.AtomicEnvironment(struc_test, 0, cutoffs, cutoffs_mask=gp_model.hyps_mask)
    if ('2' in bodies):
        kernel_name = 'twobody'
    elif ('3' in bodies):
        kernel_name = 'threebody'
    assert Parameters.compare_dict(gp_model.hyps_mask, mgp_model.maps[kernel_name].hyps_mask)
    (gp_pred_en, gp_pred_envar) = gp_model.predict_local_energy_and_var(test_envi)
    gp_pred = np.array([gp_model.predict(test_envi, (d + 1)) for d in range(3)]).T
    print('mgp pred')
    mgp_pred = mgp_model.predict(test_envi)
    map_str = 'energy'
    gp_pred_var = gp_pred_envar
    print('mgp_en, gp_en', mgp_pred[3], gp_pred_en)
    assert np.allclose(mgp_pred[3], gp_pred_en, rtol=0.002), f'{bodies} body {map_str} mapping is wrong'
    print('mgp_pred', mgp_pred[0])
    print('gp_pred', gp_pred[0])
    print('isclose?', (mgp_pred[0] - gp_pred[0]), gp_pred[0])
    assert np.allclose(mgp_pred[0], gp_pred[0], atol=0.001), f'{bodies} body {map_str} mapping is wrong'
    if (mgp_model.var_map == 'simple'):
        print(bodies, multihyps)
        for i in range(struc_test.nat):
            test_envi = env.AtomicEnvironment(struc_test, i, cutoffs, cutoffs_mask=gp_model.hyps_mask)
            mgp_pred = mgp_model.predict(test_envi)
            mgp_var = mgp_pred[1]
            gp_var = predict_atom_diag_var(test_envi, gp_model, kernel_name)
            print('mgp_var, gp_var', mgp_var, gp_var)
            assert np.allclose(mgp_var, gp_var, rtol=0.01)
    print('struc_test positions', struc_test.positions, struc_test.species_labels)
test the predict for mc_simple kernel
@pytest.mark.parametrize('bodies', body_list)
@pytest.mark.parametrize('multihyps', multi_list)
def test_predict(all_gp, all_mgp, bodies, multihyps):
    '\n    \n    '
    gp_model = all_gp[f'{bodies}{multihyps}']
    mgp_model = all_mgp[f'{bodies}{multihyps}']
    nenv = 6
    cell = (1.0 * np.eye(3))
    cutoffs = gp_model.cutoffs
    unique_species = gp_model.training_statistics['species']
    (struc_test, f) = get_random_structure(cell, unique_species, nenv)
    test_envi = env.AtomicEnvironment(struc_test, 0, cutoffs, cutoffs_mask=gp_model.hyps_mask)
    if ('2' in bodies):
        kernel_name = 'twobody'
    elif ('3' in bodies):
        kernel_name = 'threebody'
    assert Parameters.compare_dict(gp_model.hyps_mask, mgp_model.maps[kernel_name].hyps_mask)
    (gp_pred_en, gp_pred_envar) = gp_model.predict_local_energy_and_var(test_envi)
    gp_pred = np.array([gp_model.predict(test_envi, (d + 1)) for d in range(3)]).T
    print('mgp pred')
    mgp_pred = mgp_model.predict(test_envi)
    map_str = 'energy'
    gp_pred_var = gp_pred_envar
    print('mgp_en, gp_en', mgp_pred[3], gp_pred_en)
    assert np.allclose(mgp_pred[3], gp_pred_en, rtol=0.002), f'{bodies} body {map_str} mapping is wrong'
    print('mgp_pred', mgp_pred[0])
    print('gp_pred', gp_pred[0])
    print('isclose?', (mgp_pred[0] - gp_pred[0]), gp_pred[0])
    assert np.allclose(mgp_pred[0], gp_pred[0], atol=0.001), f'{bodies} body {map_str} mapping is wrong'
    if (mgp_model.var_map == 'simple'):
        print(bodies, multihyps)
        for i in range(struc_test.nat):
            test_envi = env.AtomicEnvironment(struc_test, i, cutoffs, cutoffs_mask=gp_model.hyps_mask)
            mgp_pred = mgp_model.predict(test_envi)
            mgp_var = mgp_pred[1]
            gp_var = predict_atom_diag_var(test_envi, gp_model, kernel_name)
            print('mgp_var, gp_var', mgp_var, gp_var)
            assert np.allclose(mgp_var, gp_var, rtol=0.01)
    print('struc_test positions', struc_test.positions, struc_test.species_labels)