@@ -983,7 +983,7 @@ def get_matching_coord(coord):
983
983
except (KeyError , ValueError ):
984
984
occu = 1
985
985
# If check_occu is True or the occupancy is greater than 0, create comp_d
986
- if check_occu or occu > 0 :
986
+ if not check_occu or occu > 0 :
987
987
coord = (x , y , z )
988
988
match = get_matching_coord (coord )
989
989
comp_dict = {el : max (occu , 1e-8 )}
@@ -1078,7 +1078,7 @@ def get_matching_coord(coord):
1078
1078
all_labels .extend (new_labels )
1079
1079
1080
1080
# rescale occupancies if necessary
1081
- all_species_noedit = all_species [:] # save copy before scaling in case of check_occu=True , used below
1081
+ all_species_noedit = all_species [:] # save copy before scaling in case of check_occu=False , used below
1082
1082
for idx , species in enumerate (all_species ):
1083
1083
total_occu = sum (species .values ())
1084
1084
if 1 < total_occu <= self ._occupancy_tolerance :
@@ -1114,14 +1114,14 @@ def get_matching_coord(coord):
1114
1114
sg = SpacegroupOperations ("Not Parsed" , - 1 , self .symmetry_operations )
1115
1115
struct = SymmetrizedStructure (struct , sg , equivalent_indices , wyckoffs )
1116
1116
1117
- if check_occu :
1117
+ if not check_occu :
1118
1118
struct = Structure (lattice , all_species , all_coords , site_properties = site_properties , labels = all_labels )
1119
1119
for idx in range (len (struct )):
1120
1120
struct [idx ] = PeriodicSite (
1121
1121
all_species_noedit [idx ], all_coords [idx ], lattice , properties = site_properties , skip_checks = True
1122
1122
)
1123
1123
1124
- if symmetrized or check_occu :
1124
+ if symmetrized or not check_occu :
1125
1125
return struct
1126
1126
1127
1127
struct = struct .get_sorted_structure ()
@@ -1166,7 +1166,7 @@ def get_structures(
1166
1166
Returns:
1167
1167
list[Structure]: All structures in CIF file.
1168
1168
"""
1169
- if check_occu : # added in https://github.com/materialsproject/pymatgen/pull/2836
1169
+ if not check_occu : # added in https://github.com/materialsproject/pymatgen/pull/2836
1170
1170
warnings .warn ("Structures with unphysical site occupancies are not compatible with many pymatgen features." )
1171
1171
if primitive and symmetrized :
1172
1172
raise ValueError (
0 commit comments