Skip to content
Open
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
3 changes: 3 additions & 0 deletions Pyrazinamide/alpha polymorph_volume.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PYRZIN
Identifier, Property , Value (Angstrom^3), Std, N, Name, Reference , Comment
1, Unit Cell Volume @ Unknown, 568.67, 1.15, 2, , 10.1107/S0365110X60001680, generated by automatic script, add Name and double check temperature etc.
3 changes: 3 additions & 0 deletions Pyrazinamide/beta polymorph_volume.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PYRZIN01
Identifier, Property , Value (Angstrom^3), Std, N, Name, Reference , Comment
1, Unit Cell Volume @ Unknown, 559.73, 0.00, 1, , 10.1107/S0567740872003589, generated by automatic script, add Name and double check temperature etc.
3 changes: 3 additions & 0 deletions Pyrazinamide/delta polymorph_volume.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PYRZIN02
Identifier, Property , Value (Angstrom^3), Std, N, Name, Reference , Comment
1, Unit Cell Volume @ Unknown, 279.56, 0.00, 1, , 10.1107/S0567740872004856, generated by automatic script, add Name and double check temperature etc.
3 changes: 3 additions & 0 deletions Pyrazinamide/gamma polymorph_volume.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PYRZIN03
Identifier, Property , Value (Angstrom^3), Std, N, Name, Reference , Comment
1, Unit Cell Volume @ Unknown, 277.59, 2.45, 2, , 10.1107/S0365110X61002102, generated by automatic script, add Name and double check temperature etc.
56 changes: 56 additions & 0 deletions existing_CSD_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import ccdc
import sys
import os
import numpy as np

entries = ccdc.io.EntryReader('CSD')
family = sys.argv[1]
common_name = sys.argv[2]
Polymorphs = []
volumes_by_polymorph = {}
temperature_by_polymorph = {}
Refcode_by_polymorph = {}
dois_by_polymorph = {}
for i in range(9):
if i == 0:
num = ""
else:
num = "%02i" % i
full_name = f"{family}{num}"
print(full_name)
try:
entry = entries.entry(full_name)
except Exception as e:
print(f"Could not retrieve crystal for {full_name}: {e}")
break
polymorph = entry.polymorph if entry.polymorph else "Unknown"
volume = entry.crystal.cell_volume
if volume is not None:
if polymorph not in volumes_by_polymorph:
volumes_by_polymorph[polymorph] = []
volumes_by_polymorph[polymorph].append(volume)
temperature = entry.temperature if entry.temperature else "Unknown"
if temperature is not None:
if polymorph not in temperature_by_polymorph:
temperature_by_polymorph[polymorph] = []
temperature_by_polymorph[polymorph].append(temperature)
refcode = entry.identifier
if polymorph not in Refcode_by_polymorph:
Refcode_by_polymorph[polymorph] = []
Refcode_by_polymorph[polymorph].append(refcode)
doi = entry.publication.doi if entry.publication and entry.publication.doi else "Unknown"
if polymorph not in dois_by_polymorph:
dois_by_polymorph[polymorph] = []
dois_by_polymorph[polymorph].append(doi)
if os.path.exists(common_name):
print(f"folder {common_name} exists.")
else:
print(f"making folder {common_name}")
os.mkdir(common_name)

for polymorph, volumes in volumes_by_polymorph.items():
output_file = open(os.path.join(common_name, f"{polymorph}_volume.csv"), 'w')
output_file.write("%s\n" % (Refcode_by_polymorph[polymorph][0])) # should be best R factor refcode rather than first really
output_file.write("Identifier, Property , Value (Angstrom^3), Std, N, Name, Reference , Comment\n")
output_file.write(f"1, Unit Cell Volume @ {temperature_by_polymorph[polymorph][0]}, {np.mean(volumes):.2f}, {np.std(volumes):.2f}, {len(volumes)}, ,{dois_by_polymorph[polymorph][0]}, generated by automatic script; add Name and double check temperature etc.\n")
Comment thread
IsaacSugden marked this conversation as resolved.
Comment thread
IsaacSugden marked this conversation as resolved.

Comment thread
IsaacSugden marked this conversation as resolved.
Comment thread
IsaacSugden marked this conversation as resolved.