2222@dataclass
2323class CrystalStructure (JsonDataclass ):
2424 lattice : Lattice
25- base : CrystalBasis
25+ basis : CrystalBasis
2626 spacegroup : Optional [int ] = None
2727 chemical_composition : Optional [str ] = None
2828 wyckoff_symbols : Optional [list [str ]] = None
@@ -47,7 +47,7 @@ def from_pymatgen(cls, pymatgen_structure: Structure) -> CrystalStructure:
4747 atomic_site = AtomSite (x , y , z , occupancy = occupancy , species_str = str (species ))
4848 base .append (atomic_site )
4949
50- crystal_str = cls (lattice = lattice , base = base )
50+ crystal_str = cls (lattice = lattice , basis = base )
5151
5252 return crystal_str
5353
@@ -59,7 +59,7 @@ def to_cif(self) -> str:
5959 return pymatgen_structure .to (filename = '' , fmt = 'cif' )
6060
6161 def to_pymatgen (self ) -> Structure :
62- non_void_sites = self .base .atom_sites
62+ non_void_sites = self .basis .atom_sites
6363 atoms = [site .atom .as_pymatgen for site in non_void_sites ]
6464 positions = [(site .x , site .y , site .z ) for site in non_void_sites ]
6565
@@ -72,14 +72,14 @@ def to_pymatgen(self) -> Structure:
7272 def get_view (self ) -> str :
7373 the_dict = asdict (self )
7474 the_dict = {str (key ) : str (value ) for key , value in the_dict .items () if not isinstance (value , Structure )}
75- the_dict ['base' ] = f'{ self .base [0 ]} , ...'
75+ the_dict ['base' ] = f'{ self .basis [0 ]} , ...'
7676 return json .dumps (the_dict , indent = '-' )
7777
7878 # ---------------------------------------------------------
7979 # properties
8080
8181 def calculate_properties (self ):
82- if len (self .base ) == 0 :
82+ if len (self .basis ) == 0 :
8383 raise ValueError ('Base is empty! Cannot calculate properties of empty crystal. Aborting ...' )
8484
8585 pymatgen_structure = self .to_pymatgen ()
@@ -91,11 +91,11 @@ def calculate_properties(self):
9191 self .chemical_composition = pymatgen_structure .composition .formula
9292
9393 def get_standardized (self ) -> CrystalStructure :
94- struct = self .to_pymatgen () if len (self .base ) > 0 else Structure (self .lattice , ["H" ], [[0 , 0 , 0 ]])
94+ struct = self .to_pymatgen () if len (self .basis ) > 0 else Structure (self .lattice , ["H" ], [[0 , 0 , 0 ]])
9595 analzyer = SpacegroupAnalyzer (structure = struct )
9696 std_struct = analzyer .get_conventional_standard_structure ()
97- if len (self .base ) == 0 :
98- return CrystalStructure (lattice = std_struct .lattice , base = CrystalBasis .empty ())
97+ if len (self .basis ) == 0 :
98+ return CrystalStructure (lattice = std_struct .lattice , basis = CrystalBasis .empty ())
9999 else :
100100 return CrystalStructure .from_pymatgen (pymatgen_structure = std_struct )
101101
@@ -106,12 +106,12 @@ def scale(self, target_density: float):
106106 @cached_property
107107 def packing_density (self ) -> float :
108108 volume_uc = self .volume_uc
109- atomic_volume = self .base .calculate_atomic_volume ()
109+ atomic_volume = self .basis .calculate_atomic_volume ()
110110 return atomic_volume / volume_uc
111111
112112 @cached_property
113113 def num_atoms (self ) -> int :
114- return len (self .base )
114+ return len (self .basis )
115115
116116 @cached_property
117117 def volume_uc (self ) -> float :
0 commit comments