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:
687687 @staticmethod
688688 def _get_ensemble_defaults (structure : Structure , ensemble : str ) -> dict [str , Any ]:
689689 """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+
690695 defaults = {
691696 "nve" : {"MDALGO" : 1 , "ISIF" : 2 , "ANDERSEN_PROB" : 0.0 },
692697 "nvt" : {"MDALGO" : 2 , "ISIF" : 2 , "SMASS" : 0 },
693698 "npt" : {
694699 "MDALGO" : 3 ,
695700 "ISIF" : 3 ,
696- "LANGEVIN_GAMMA" : [10 ] * structure . ntypesp ,
701+ "LANGEVIN_GAMMA" : [10 ] * n_types ,
697702 "LANGEVIN_GAMMA_L" : 1 ,
698703 "PMASS" : 10 ,
699704 "PSTRESS" : 0 ,
You can’t perform that action at this time.
0 commit comments