Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RDF test #255

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified tests/integration/baseline_images/plot_test/msd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/integration/baseline_images/plot_test/shape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ def vasp_rdf_data(vasp_traj, structure, vasp_transitions):
trajectory=trajectory,
floating_specie='Li')

transitions = Transitions.from_trajectory(trajectory=trajectory,
structure=structure,
floating_specie='Li')

rdfs = radial_distribution(
sites=sites,
transitions=vasp_transitions,
transitions=transitions,
max_dist=5,
)

Expand All @@ -87,13 +91,13 @@ def vasp_rdf_data(vasp_traj, structure, vasp_transitions):

@pytest.fixture(scope='module')
def vasp_shape_data(vasp_traj):
trajectory = vasp_traj[-1000:]
trajectory = vasp_traj[-250:]
trajectory.filter('Li')

# shape analysis needs structure without supercell
structure = load_known_material('argyrodite')
sites = load_known_material('argyrodite')

sa = ShapeAnalyzer.from_structure(structure)
sa = ShapeAnalyzer.from_structure(sites)

shapes = sa.analyze_trajectory(trajectory, supercell=(2, 1, 1))

Expand Down
4 changes: 1 addition & 3 deletions tests/integration/plot_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import pytest
from helpers import image_comparison2

from gemdat.io import load_known_material
Expand Down Expand Up @@ -61,7 +60,6 @@ def test_jumps_3d_animation(vasp_jumps):
plots.jumps_3d_animation(jumps=vasp_jumps, t_start=1000, t_stop=1001)


@pytest.mark.xfail(reason='Needs to be checked')
@image_comparison2(baseline_images=['rdf1', 'rdf2', 'rdf3'])
def test_rdf23(vasp_rdf_data):
assert len(vasp_rdf_data) == 3
Expand All @@ -78,7 +76,7 @@ def test_shape(vasp_shape_data):

@image_comparison2(baseline_images=['msd'])
def test_msd_per_element(vasp_traj):
plots.msd_per_element(trajectory=vasp_traj)
plots.msd_per_element(trajectory=vasp_traj[-500:])


@image_comparison2(baseline_images=['path_energy'])
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/shape_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_shape(vasp_shape_data):
for shape in vasp_shape_data:
assert isinstance(shape, ShapeData)
assert shape.name == '48h'
assert shape.coords.shape == (76610, 3)
assert shape.coords.shape == (19284, 3)

# coords may not exceed threshold
assert np.all(shape.coords > -1)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/trajectory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def test_vibration_metrics(vasp_traj):

@pytest.vaspxml_available # type: ignore
def test_msd(vasp_traj):
msd = vasp_traj.mean_squared_displacement()
msd = vasp_traj[-100:].mean_squared_displacement()

assert msd.shape == (104, 3750)
assert np.isclose(msd[10, -1], 0.03396214706964429)
assert np.isclose(msd[52, -1], 0.30140820020960746)
assert np.isclose(msd[85, -1], 11.927261505164097)
assert msd.shape == (104, 100)
assert np.isclose(msd[10, -1], 0.0711843146266915)
assert np.isclose(msd[52, -1], 0.597740065985704)
assert np.isclose(msd[85, -1], 1.1881148711032665)
Loading