-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
FNTwin
committed
Apr 2, 2024
1 parent
cef2b35
commit dbdd985
Showing
2 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from openqdc import Dummy | ||
from openqdc.utils.descriptors import ACSF, MBTR, SOAP, Descriptor | ||
|
||
|
||
@pytest.fixture | ||
def dummy(): | ||
return Dummy() | ||
|
||
|
||
@pytest.mark.parametrize("model", [SOAP, ACSF, MBTR]) | ||
def test_init(model): | ||
model = model(species=["H"]) | ||
assert isinstance(model, Descriptor) | ||
|
||
|
||
@pytest.mark.parametrize("model", [SOAP, ACSF, MBTR]) | ||
def test_descriptor(model, dummy): | ||
model = model(species=dummy.chemical_species) | ||
results = model.fit_transform([dummy.get_ase_atoms(i) for i in range(4)]) | ||
assert len(results) == 4 | ||
|
||
|
||
@pytest.mark.parametrize("model", [SOAP, ACSF, MBTR]) | ||
def test_from_positions(model): | ||
model = model(species=["H"]) | ||
_ = model.from_xyz([[0, 0, 0], [1, 1, 1]], [1, 1]) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"model,override", [(SOAP, {"r_cut": 3.0}), (ACSF, {"r_cut": 3.0}), (MBTR, {"normalize_gaussians": False})] | ||
) | ||
def test_overwrite(model, override, dummy): | ||
model = model(species=dummy.chemical_species, **override) |