Skip to content

Commit

Permalink
examples: Added crystal example; Type hinted CrystalBase iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
Somerandomguy10111 committed Jun 29, 2024
1 parent 51ee70f commit 6f83b4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CrystalStructure/crystal/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __iadd__(self, other):
self.append(item)
return self

def __iter__(self):
def __iter__(self) -> Iterable[AtomicSite]:
return iter(self.atomic_sites)

def __len__(self):
Expand Down
10 changes: 10 additions & 0 deletions CrystalStructure/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
# ---------------------------------------------------------

class CrystalExamples:
@staticmethod
def get_crystal(secondary : bool, mute : bool = False):
cif_content = CrystalExamples.get_cif_content(secondary=secondary)
crystal_structure = CrystalStructure.from_cif(cif_content=cif_content)
if not mute:
print(f'--> Cif content:\n {open(cif1_fpath).read()}')
print(f'--> Crystal structure:\n {crystal_structure}')
return crystal_structure


@staticmethod
def get_base(mute : bool = True) -> CrystalBase:
crystal_stucture = CrystalExamples.get_crystal(mute=mute)
Expand Down

0 comments on commit 6f83b4d

Please sign in to comment.