crystaltoolkit icon indicating copy to clipboard operation
crystaltoolkit copied to clipboard

Long CIF edge case

Open janosh opened this issue 4 years ago • 6 comments

Just mentioning this here in case you were looking for an edge case to include in your testing or something like that.

The website doesn't parse this very long CIF file of this C110 H106 Ge2 Li2 N8 O2 organic molecular crystal (or whatever this is) correctly.

cryst_misparsed.cif.zip

janosh avatar Nov 19 '21 12:11 janosh

Thanks for the report!

mkhorton avatar Nov 19 '21 17:11 mkhorton

The performance is actually pretty bad for any large crystal right now, it may be an underlying pymatgen issue too, I'll look into it.

mkhorton avatar Nov 19 '21 17:11 mkhorton

Update on this issue. The problem here is two-fold:

(1) the current Materials Project cloud deployment is a little under-resourced, which limits what we can do, and

(2) the visualizer will not perform well for large crystals anyway because the pymatgen bonding algorithms are pretty slow, and because no level-of-detail support has been added to the Three.js-based scene visualizer in mp-react-components meaning that spheres etc. are rendered at too high a fidelity in very large scene where hundreds of objects are present

Suggested resolution is to implement a max_sites attribute on StructureMoleculeComponent and respond with an appropriate error message when this is exceeded.

mkhorton avatar Jul 18 '22 18:07 mkhorton

@mkhorton Hi, Is there any example to show How to parse the CIF file into the the JSON format data which can be displayed in the mp-react-components scene visulizer?

Aaronphy avatar Dec 05 '23 06:12 Aaronphy

I can’t test this right now, but it would be something like:

import crystal_toolkit  # side-effect import to get structure.get_scene()
from pymatgen.core.structure import Structure

structure = Structure.from_file("your_cif.cif")

scene = structure.get_scene()

scene.to_json()

Apologies if I’ve mis-remembered a method name here. Hope this helps!

mkhorton avatar Dec 05 '23 07:12 mkhorton

@mkhorton I

I can’t test this right now, but it would be something like:

import crystal_toolkit  # side-effect import to get structure.get_scene()
from pymatgen.core.structure import Structure

structure = Structure.from_file("your_cif.cif")

scene = structure.get_scene()

scene.to_json()

Apologies if I’ve mis-remembered a method name here. Hope this helps!

@mkhorton I use this way to implement the Visualization of the test.cif. However it lost the lines between the atoms. test.cif.zip image

But it shows well at https://next-gen.materialsproject.org/toolkit after uploading the cif file.

image

Could you help to tell me the difference? If I missed something?

Aaronphy avatar Jan 09 '24 12:01 Aaronphy