-
Notifications
You must be signed in to change notification settings - Fork 4
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
d09e6ae
commit 7723cb3
Showing
8 changed files
with
159 additions
and
58 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
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
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
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,26 @@ | ||
from ase import Atoms | ||
from ase.io import read | ||
from graph_pes.data import convert_to_atomic_graph, convert_to_atomic_graphs | ||
from graph_pes.models.pairwise import LennardJones | ||
|
||
structures = read("tests/test.xyz", ":") | ||
graphs = convert_to_atomic_graphs(structures, cutoff=3) | ||
|
||
|
||
def test_model(): | ||
model = LennardJones() | ||
predictions = model.predict(graphs) | ||
assert "energy" in predictions | ||
assert "forces" in predictions | ||
assert "stress" in predictions and graphs[0].has_cell | ||
assert predictions["energy"].shape == (len(graphs),) | ||
assert predictions["stress"].shape == (len(graphs), 3, 3) | ||
|
||
|
||
def test_isolated_atom(): | ||
atom = Atoms("He", positions=[[0, 0, 0]]) | ||
graph = convert_to_atomic_graph(atom, cutoff=3) | ||
assert graph.n_atoms == 1 and graph.n_edges == 0 | ||
|
||
model = LennardJones() | ||
assert model(graph) == 0 |
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