|
| 1 | +from ccdc.io import EntryReader |
| 2 | +from ccdc.descriptors import CrystalDescriptors |
| 3 | +from pathlib import Path |
| 4 | +import pandas as pd |
| 5 | + |
| 6 | + |
| 7 | +# Read CSD entries |
| 8 | +entry_reader = EntryReader('CSD') |
| 9 | + |
| 10 | +# Selection of MOF-76 type structures M = lanthanoid, yttrium |
| 11 | +refcodes = ['MARXEK', 'NADZID', 'QOTZEG', 'SADLIU', |
| 12 | + 'SEHXIN', 'UPIBOM', 'YIMPAP', 'YIMPIX', 'YIMSAS'] |
| 13 | + |
| 14 | +# Headers for table |
| 15 | +print(f"{'Refcode':<10} {'Formula':<20} {'He Volume (ų)':>15} {'System Vol (ų)':>18}") |
| 16 | +print("-" * 65) |
| 17 | + |
| 18 | +# Calculate pore properties |
| 19 | +results = [] |
| 20 | +for refcode in refcodes: |
| 21 | + mof = entry_reader.entry(refcode) |
| 22 | + formula = mof.formula |
| 23 | + crys = mof.crystal # Need crystal object to calcuate descriptors |
| 24 | + pore_analyser = CrystalDescriptors.PoreAnalyser(crys) |
| 25 | + He_vol_tot = pore_analyser.total_helium_volume |
| 26 | + sys_vol = pore_analyser.system_volume |
| 27 | + results.append({'Refcode': refcode, |
| 28 | + 'Formula': formula, |
| 29 | + 'He Volume (ų)': He_vol_tot, |
| 30 | + 'System Vol (ų)': sys_vol}) |
| 31 | + print(f"{refcode:<10} {formula:<20} {He_vol_tot:15.3f} {sys_vol:18.3f}") |
| 32 | + |
| 33 | +# Create DataFrame |
| 34 | +df = pd.DataFrame(results) |
| 35 | +df = df.round(3) |
| 36 | + |
| 37 | +# Write data to csv |
| 38 | +workdir = Path.cwd() |
| 39 | +df.to_csv(f'{workdir}/results.csv', index=False, encoding='utf-8-sig') |
0 commit comments