-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
9c52372
commit 6faddcb
Showing
2 changed files
with
26 additions
and
0 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
25 changes: 25 additions & 0 deletions
25
src/metatensor_models/soap_bpnn/tests/test_functionality.py
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,25 @@ | ||
import os | ||
|
||
import ase | ||
import rascaline.torch | ||
import torch | ||
import yaml | ||
|
||
from metatensor_models.soap_bpnn import SoapBPNN | ||
|
||
|
||
path = os.path.dirname(__file__) | ||
hypers_path = os.path.join(path, "../default.yml") | ||
dataset_path = os.path.join(path, "data/qm9_reduced_100.xyz") | ||
|
||
|
||
def test_prediction_subset(): | ||
"""Tests that the model can predict on a subset | ||
of the elements it was trained on.""" | ||
|
||
all_species = [1, 6, 7, 8, 9] | ||
hypers = yaml.safe_load(open(hypers_path, "r")) | ||
soap_bpnn = SoapBPNN(all_species, hypers).to(torch.float64) | ||
|
||
structure = ase.Atoms("O2", positions=[[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) | ||
soap_bpnn([rascaline.torch.systems_to_torch(structure)]) |