Skip to content

Commit

Permalink
allow newer pymatgen verions (#1105)
Browse files Browse the repository at this point in the history
Co-authored-by: Jimmy Shen <[email protected]>
Co-authored-by: J. George <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2025
1 parent edbd0b1 commit 233c2a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/atomate2/vasp/sets/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,18 @@ def incar_updates(self) -> dict:
@staticmethod
def _get_ensemble_defaults(structure: Structure, ensemble: str) -> dict[str, Any]:
"""Get default params for the ensemble."""
# Handle both old (ntypesp) and new (n_elems) pymatgen versions
n_types = getattr(structure, "n_elems", None)
if n_types is None:
n_types = structure.ntypesp

defaults = {
"nve": {"MDALGO": 1, "ISIF": 2, "ANDERSEN_PROB": 0.0},
"nvt": {"MDALGO": 2, "ISIF": 2, "SMASS": 0},
"npt": {
"MDALGO": 3,
"ISIF": 3,
"LANGEVIN_GAMMA": [10] * structure.ntypesp,
"LANGEVIN_GAMMA": [10] * n_types,
"LANGEVIN_GAMMA_L": 1,
"PMASS": 10,
"PSTRESS": 0,
Expand Down

0 comments on commit 233c2a9

Please sign in to comment.