coudertlab / CrystalNets.jl

A julia package for the manipulation of crystal net representations and topology
MIT License
40 stars 3 forks source link

Incorrect topology prediction example for all clustering algorithms #12

Closed BurnerJ closed 2 years ago

BurnerJ commented 2 years ago

Hi! I have been testing the code, and found an example where the predicted net is not what I would expect. It should be a bcu topology, but the closest topology (with the right number of connection points) is from the SingleNodes clustering algorithm (returns ssb). Do you have any suggestions on troubleshooting this issue? I have used the following options:

CrystalNets.Options(structure=StructureType.MOF, bonding=Bonding.Input, clusterings=[Clustering.Auto, Clustering.Standard, Clustering.PEM])

Thanks! test3.txt

BurnerJ commented 2 years ago

I think I see where my confusion lies... the algorithm determines the inorganic SBU as containing only metal atoms. This leads to the result that there are four connection points for the inorganic SBU (the metal atoms) and four connection points for the organic SBU (two vertices, with 4 connection points), giving rise to the ssb topology. Is there a way to control where the cuts are made for the inorganic/organic SBUs? If the cuts in this case are made at the C-C bond in the middle of the two pyrazole rings, then one arrives at a bcu topology (one vertex, 8 connection points) which is what topcryst reports).

Liozou commented 2 years ago

Hi! The clustering algorithm is indeed quite involved, and as with all heuristics, it may behave in a surprising way. What happens here is that all atoms of the pyrazole rings are considered to be part of the same organic SBU, which prevents the metals from being bonded together. To avoid this, use detect_organiccycles=false among your options: the full call will look like

julia> determine_topology("/.../DB0_m12.cif", CrystalNets.Options(structure=StructureType.MOF, bonding=Bonding.Input, clusterings=[Clustering.Auto, Clustering.Standard, Clustering.PEM], detect_organiccycles=false))
AllNodes, SingleNodes: bcu
Standard: ssb
PEM: stw

If you need fancier clustering options in addition to that, you can have a look at the cluster_kinds option, which accepts a ClusterKinds that specifies the rules for grouping clusters.

I hope this help, and please let me know if you have any other question!

BurnerJ commented 2 years ago

Understood, thanks very much for the help!