forked from materialsproject/pymatgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding MD input set to FHI-aims (materialsproject#3896)
* Added MD input set and generator for aims * Added MD input set and generator for aims * Conditionally add velocities to site properties * pre-commit auto-fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0f22690
commit 4a2c3df
Showing
9 changed files
with
165 additions
and
4 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
Binary file not shown.
Binary file not shown.
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 @@ | ||
{"xc": "pbe", "relativistic": "atomic_zora scalar", "MD_run": "10.0 NVT_parrinello 300 0.4", "MD_time_step": 0.002, "MD_MB_init": 300, "species_dir": "/home/andrey/workspace/pymatgen/tests/io/aims/species_directory/light", "k_grid": [2, 2, 2]} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,48 @@ | ||
"""Tests the MD input set generator""" | ||
|
||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
from pymatgen.io.aims.sets.core import MDSetGenerator | ||
from pymatgen.util.testing.aims import Si, compare_files | ||
|
||
module_dir = Path(__file__).resolve().parents[1] | ||
species_dir = module_dir / "species_directory" | ||
ref_path = (module_dir / "aims_input_generator_ref").resolve() | ||
|
||
|
||
def test_si_md(tmp_path): | ||
# default behaviour | ||
parameters = { | ||
"species_dir": str(species_dir / "light"), | ||
"k_grid": [2, 2, 2], | ||
} | ||
test_name = "md-si" | ||
# First do the exceptions | ||
with pytest.raises(ValueError, match="Ensemble something not valid"): | ||
MDSetGenerator(ensemble="something").get_input_set(Si) | ||
with pytest.raises(ValueError, match="Type parrinello is not valid for nve ensemble"): | ||
MDSetGenerator(ensemble="nve", ensemble_specs={"type": "parrinello"}).get_input_set(Si) | ||
with pytest.raises(ValueError, match="Velocities must be initialized"): | ||
MDSetGenerator(ensemble="nve", init_velocities=False).get_input_set(Si) | ||
with pytest.raises(ValueError, match="Temperature must be set"): | ||
MDSetGenerator(ensemble="nve").get_input_set(Si) | ||
with pytest.raises(ValueError, match="Temperature must be set"): | ||
MDSetGenerator(ensemble="nvt").get_input_set(Si) | ||
with pytest.raises(ValueError, match="parameter is not defined"): | ||
MDSetGenerator(ensemble="nve", ensemble_specs={"type": "damped"}, temp=300).get_input_set(Si) | ||
# then do the actual input set | ||
generator = MDSetGenerator( | ||
ensemble="nvt", | ||
ensemble_specs={"type": "parrinello", "parameter": 0.4}, | ||
temp=300, | ||
time=10.0, | ||
time_step=0.002, | ||
user_params=parameters, | ||
) | ||
input_set = generator.get_input_set(Si) | ||
input_set.write_input(tmp_path / test_name) | ||
|
||
return compare_files(test_name, tmp_path, ref_path) |