diff --git a/scripts/MOFs_Mercury-MER-007/ReadMe.md b/scripts/MOFs_Mercury-MER-007/ReadMe.md new file mode 100644 index 0000000..1bfb5be --- /dev/null +++ b/scripts/MOFs_Mercury-MER-007/ReadMe.md @@ -0,0 +1,25 @@ +# Analyse Pore Space + +## Summary + +This script shows a simple use case of Pore Analyser. It takes a list of selected CSD entries and computes their pore properties, prints the results and writes them to a CSV file. + +## Requirements + +CSD Python API (v 3.5.0 or later) + +pandas (v 2.2.3 or later) + +## Licensing Requirements + +CSD-Core + +## Instructions on Running + +In a command prompt run `python pore_analyser.py`. + +## Author + +Andrew J. Peel (2025-10-10) + +> For feedback or to report any issues please contact [support@ccdc.cam.ac.uk](mailto:support@ccdc.cam.ac.uk) diff --git a/scripts/MOFs_Mercury-MER-007/pore_analyser.py b/scripts/MOFs_Mercury-MER-007/pore_analyser.py new file mode 100644 index 0000000..731426a --- /dev/null +++ b/scripts/MOFs_Mercury-MER-007/pore_analyser.py @@ -0,0 +1,39 @@ +from ccdc.io import EntryReader +from ccdc.descriptors import CrystalDescriptors +from pathlib import Path +import pandas as pd + + +# Read CSD entries +entry_reader = EntryReader('CSD') + +# Selection of MOF-76 type structures M = lanthanoid, yttrium +refcodes = ['MARXEK', 'NADZID', 'QOTZEG', 'SADLIU', + 'SEHXIN', 'UPIBOM', 'YIMPAP', 'YIMPIX', 'YIMSAS'] + +# Headers for table +print(f"{'Refcode':<10} {'Formula':<20} {'He Volume (ų)':>15} {'System Vol (ų)':>18}") +print("-" * 65) + +# Calculate pore properties +results = [] +for refcode in refcodes: + mof = entry_reader.entry(refcode) + formula = mof.formula + crys = mof.crystal # Need crystal object to calcuate descriptors + pore_analyser = CrystalDescriptors.PoreAnalyser(crys) + He_vol_tot = pore_analyser.total_helium_volume + sys_vol = pore_analyser.system_volume + results.append({'Refcode': refcode, + 'Formula': formula, + 'He Volume (ų)': He_vol_tot, + 'System Vol (ų)': sys_vol}) + print(f"{refcode:<10} {formula:<20} {He_vol_tot:15.3f} {sys_vol:18.3f}") + +# Create DataFrame +df = pd.DataFrame(results) +df = df.round(3) + +# Write data to csv +workdir = Path.cwd() +df.to_csv(f'{workdir}/results.csv', index=False, encoding='utf-8-sig')