Skip to content

Commit

Permalink
Revert "Remove useless pieces of code in update of space groups."
Browse files Browse the repository at this point in the history
This reverts commit c195a60.
  • Loading branch information
alexhernandezgarcia committed Oct 20, 2023
1 parent 9bbdd94 commit dd36350
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions gflownet/envs/crystals/spacegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,38 @@ def _restrict_space_groups(self, sg_subset: Optional[Iterable] = None):
for ps in ps_to_remove:
del self.point_symmetries[ps]

# Update self.crystal_lattice_systems based on point symmetries
cls_to_remove = []
point_symmetries = set(self.point_symmetries)
for cls in self.crystal_lattice_systems:
cls_point_symmetries = point_symmetries.intersection(
set(self.crystal_lattice_systems[cls]["point_symmetries"])
)
if len(cls_point_symmetries) == 0:
cls_to_remove.append(cls)
else:
self.crystal_lattice_systems[cls]["point_symmetries"] = list(
cls_point_symmetries
)
for cls in cls_to_remove:
del self.crystal_lattice_systems[cls]

# Update self.point_symmetries based on point symmetries
ps_to_remove = []
crystal_lattice_systems = set(self.crystal_lattice_systems)
for ps in self.point_symmetries:
ps_crystal_lattice_systems = crystal_lattice_systems.intersection(
set(self.point_symmetries[ps]["crystal_lattice_systems"])
)
if len(ps_crystal_lattice_systems) == 0:
ps_to_remove.append(ps)
else:
self.point_symmetries[ps]["crystal_lattice_systems"] = list(
ps_crystal_lattice_systems
)
for ps in ps_to_remove:
del self.point_symmetries[ps]

def get_all_terminating_states(
self, apply_stoichiometry_constraints: Optional[bool] = True
) -> List[List]:
Expand Down

0 comments on commit dd36350

Please sign in to comment.