Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions scripts/MOFs_Mercury-MER-007/ReadMe.md
Original file line number Diff line number Diff line change
@@ -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 [[email protected]](mailto:[email protected])
39 changes: 39 additions & 0 deletions scripts/MOFs_Mercury-MER-007/pore_analyser.py
Original file line number Diff line number Diff line change
@@ -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')