-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathccdcPackingSimilarityTools.py
More file actions
42 lines (33 loc) · 1.31 KB
/
Copy pathccdcPackingSimilarityTools.py
File metadata and controls
42 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def returnNmatched_molecules(comparisonObject, crystal1, crystal2, returnRMSD=False):
''' All inputs are CCDC objects - this really just catches fails '''
compareResult = comparisonObject.compare(crystal1, crystal2)
if returnRMSD:
try:
return compareResult.nmatched_molecules, compareResult.rmsd
except:
return None, None
else:
try:
return compareResult.nmatched_molecules
except:
return None
def matchStructureLists(list1,
list2,
allowMolecularDifferences=False,
returnRMSD = False,
nRMSDMatches = 15):
''' Get number molecular matches for two lists of ccdc crystals
Return a numpy matrix '''
from ccdc.crystal import PackingSimilarity
import numpy as np
ps = PackingSimilarity()
ps.settings.allow_molecular_differences = allowMolecularDifferences
ps.settings.packing_shell_size = nRMSDMatches
data = np.array([[returnNmatched_molecules(ps, cI, cJ, returnRMSD=returnRMSD)
for cI in list1]
for cJ in list2])
if returnRMSD:
return data[:,:,0], data[:,:,1]
else:
return data
#class MatchCSPStructureLists