Ejemplo n.º 1
0
def check_del_atom(value):
    atoms, exp = value[0:2]
    proc, alg = value[-1]

    scat = ElasticScatter(exp_dict=exp, verbose=True)
    scat.set_processor(proc, alg)

    assert scat._check_wrap_atoms_state(atoms) == False
    # Test a set of different sized ensembles
    ans1 = scat.get_fq(atoms)
    assert scat._check_wrap_atoms_state(atoms) == True
    # Check that Scatter gave back something
    assert ans1 is not None
    assert np.any(ans1)

    atoms2 = dc(atoms)
    del atoms2[np.random.choice(len(atoms2))]
    assert scat._check_wrap_atoms_state(atoms2) == False
    ans2 = scat.get_fq(atoms2)
    assert scat._check_wrap_atoms_state(atoms2) == True
    # Check that Scatter gave back something
    assert ans2 is not None
    assert np.any(ans2)

    assert not np.allclose(ans1, ans2)
    # make certain we did not give back the same pointer
    assert ans1 is not ans2
    # Check that all the values are not zero
    del atoms, exp, proc, alg, scat, ans1
    return
Ejemplo n.º 2
0
def check_del_atom(value):
    atoms, exp = value[0:2]
    proc, alg = value[-1]

    scat = ElasticScatter(exp_dict=exp, verbose=True)
    scat.set_processor(proc, alg)

    assert scat._check_wrap_atoms_state(atoms) == False
    # Test a set of different sized ensembles
    ans1 = scat.get_fq(atoms)
    assert scat._check_wrap_atoms_state(atoms) == True
    # Check that Scatter gave back something
    assert ans1 is not None
    assert np.any(ans1)

    atoms2 = dc(atoms)
    del atoms2[np.random.choice(len(atoms2))]
    assert scat._check_wrap_atoms_state(atoms2) == False
    ans2 = scat.get_fq(atoms2)
    assert scat._check_wrap_atoms_state(atoms2) == True
    # Check that Scatter gave back something
    assert ans2 is not None
    assert np.any(ans2)

    assert not np.allclose(ans1, ans2)
    # make certain we did not give back the same pointer
    assert ans1 is not ans2
    # Check that all the values are not zero
    del atoms, exp, proc, alg, scat, ans1
    return