From 76713f9fcdd08b33ef84cc9e656a8c09d852373c Mon Sep 17 00:00:00 2001 From: Andrew Peel Date: Wed, 15 Oct 2025 13:44:30 +0100 Subject: [PATCH 1/2] Add MOF workshop files --- scripts/MOFs_Mercury-MER-007/ReadMe.md | 25 ++++++++++++ scripts/MOFs_Mercury-MER-007/pore_analyser.py | 39 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 scripts/MOFs_Mercury-MER-007/ReadMe.md create mode 100644 scripts/MOFs_Mercury-MER-007/pore_analyser.py diff --git a/scripts/MOFs_Mercury-MER-007/ReadMe.md b/scripts/MOFs_Mercury-MER-007/ReadMe.md new file mode 100644 index 0000000..4118ce0 --- /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) \ No newline at end of file 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') From 1e0ea7d3c61ead6c851876aeb11b6886002d05c4 Mon Sep 17 00:00:00 2001 From: Andrew Peel Date: Wed, 15 Oct 2025 13:51:15 +0100 Subject: [PATCH 2/2] Add blank line to ReadMe NO_JIRA --- scripts/MOFs_Mercury-MER-007/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/MOFs_Mercury-MER-007/ReadMe.md b/scripts/MOFs_Mercury-MER-007/ReadMe.md index 4118ce0..1bfb5be 100644 --- a/scripts/MOFs_Mercury-MER-007/ReadMe.md +++ b/scripts/MOFs_Mercury-MER-007/ReadMe.md @@ -22,4 +22,4 @@ In a command prompt run `python pore_analyser.py`. 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) \ No newline at end of file +> For feedback or to report any issues please contact [support@ccdc.cam.ac.uk](mailto:support@ccdc.cam.ac.uk)