File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -687,13 +687,18 @@ def incar_updates(self) -> dict:
687
687
@staticmethod
688
688
def _get_ensemble_defaults (structure : Structure , ensemble : str ) -> dict [str , Any ]:
689
689
"""Get default params for the ensemble."""
690
+ # Handle both old (ntypesp) and new (n_elems) pymatgen versions
691
+ n_types = getattr (structure , "n_elems" , None )
692
+ if n_types is None :
693
+ n_types = structure .ntypesp
694
+
690
695
defaults = {
691
696
"nve" : {"MDALGO" : 1 , "ISIF" : 2 , "ANDERSEN_PROB" : 0.0 },
692
697
"nvt" : {"MDALGO" : 2 , "ISIF" : 2 , "SMASS" : 0 },
693
698
"npt" : {
694
699
"MDALGO" : 3 ,
695
700
"ISIF" : 3 ,
696
- "LANGEVIN_GAMMA" : [10 ] * structure . ntypesp ,
701
+ "LANGEVIN_GAMMA" : [10 ] * n_types ,
697
702
"LANGEVIN_GAMMA_L" : 1 ,
698
703
"PMASS" : 10 ,
699
704
"PSTRESS" : 0 ,
You can’t perform that action at this time.
0 commit comments