@@ -360,15 +360,15 @@ def get_virial(self) -> np.ndarray | None:
360
360
class AtomConfig (MSONable ):
361
361
"""Object for representing the data in a atom.config or final.config file."""
362
362
363
- def __init__ (self , structure : Structure | IStructure , sort_structure : bool = False ):
363
+ def __init__ (self , structure : IStructure | Structure , sort_structure : bool = False ):
364
364
"""Initialization function.
365
365
366
366
Args:
367
367
structure (Structure): Structure object
368
368
sort_structure (bool, optional): Whether to sort the structure. Useful if species
369
369
are not grouped properly together. Defaults to False.
370
370
"""
371
- self .structure : Structure = structure
371
+ self .structure : Structure = Structure . from_sites ( structure )
372
372
if sort_structure :
373
373
self .structure = self .structure .get_sorted_structure ()
374
374
elements_counter = dict (sorted (Counter (self .structure .species ).items ()))
@@ -396,7 +396,7 @@ def from_str(cls, data: str, mag: bool = False) -> Self:
396
396
properties : dict [str , float ] = {}
397
397
structure = Structure (
398
398
lattice = ac_extractor .get_lattice (),
399
- species = ac_extractor .get_types (),
399
+ species = ac_extractor .get_types (), # type:ignore[arg-type]
400
400
coords = ac_extractor .get_coords ().reshape (- 1 , 3 ),
401
401
coords_are_cartesian = False ,
402
402
properties = properties ,
@@ -420,7 +420,7 @@ def from_file(cls, filename: PathLike, mag: bool = False) -> Self:
420
420
AtomConfig object.
421
421
"""
422
422
with zopen (filename , mode = "rt" , encoding = "utf-8" ) as file :
423
- return cls .from_str (data = file .read (), mag = mag )
423
+ return cls .from_str (data = file .read (), mag = mag ) # type:ignore[arg-type]
424
424
425
425
@classmethod
426
426
def from_dict (cls , dct : dict ) -> Self :
@@ -468,7 +468,7 @@ def get_str(self) -> str:
468
468
def write_file (self , filename : PathLike , ** kwargs ):
469
469
"""Write AtomConfig to a file."""
470
470
with zopen (filename , mode = "wt" , encoding = "utf-8" ) as file :
471
- file .write (self .get_str (** kwargs ))
471
+ file .write (self .get_str (** kwargs )) # type:ignore[arg-type]
472
472
473
473
def as_dict (self ):
474
474
"""
@@ -696,4 +696,4 @@ def get_hsp_row_str(label: str, index: int, coordinate: float) -> str:
696
696
def write_file (self , filename : PathLike ):
697
697
"""Write HighSymmetryPoint to a file."""
698
698
with zopen (filename , mode = "wt" , encoding = "utf-8" ) as file :
699
- file .write (self .get_str ())
699
+ file .write (self .get_str ()) # type:ignore[arg-type]
0 commit comments