Closed CorySimon closed 8 years ago
The images are definitely doable. According to this stackoverflow post, it shouldn't be much work. I'll do this when I get some time.
Regarding the interactive viewer, you also can. You can use the source code from the examples as a starting point. If you have any questions on implementing, let me know.
It looks like mof.html
in the examples
folder is what I am looking for.
Can you please provide an example of how to use IMolecule or your script format_converter.py
to convert e.g. a .cssr file to a JSON to use in mof.html
?
The intended use of the library was through the UI. If you pip install
ed this, typing imolecule
will pop open a web UI. Drag and drop your .cssr file in, and then click save as -> json.
If you didn't go this route, there's also a format converter shim I use for testing. From this code, you can run with e.g.
python format_converter.py myfile.cssr cssr json > molecule.json
I should probably rewrite it with argparse and expose it through e.g. imolecule convert
, but haven't gotten there.
Saving molecule renders is now possible like so:
Setting show_save=True
displays a save icon that can be clicked to save the current camera angle on the molecule. Let me know if it works for you.
Awesome, thank you. Can you please make an option to change the dpi? The resolution is very low in the images that I save.
The current approach saves a render of the current buffer, so it's tied to the size of the viewing window.
As a short-term solution, you can expand the size of your imolecule render before saving.
As a longer term solution, I like the idea of rendering in an off-screen buffer. Itll be some work to see if it's possible, but it'd make saving more consistent.
On Monday, November 9, 2015, Cory Simon notifications@github.com wrote:
Awesome, thank you. Can you please make an option to change the dpi? The resolution is very low in the images that I save.
— Reply to this email directly or view it on GitHub https://github.com/patrickfuller/imolecule/issues/25#issuecomment-155238389 .
25e6899f8cb27479d88080bf878d47b75202a549 renders at high resolution. Current default is to scale width to 2560px and maintain aspect ratio. Proof:
Let me know if this works for you.
This is an excellent and much needed tool, thank you!
Is there a way to save a snapshot of the molecule as e.g. a .png file, such as:
Further, a way to host this interactive viewer on a website? e.g. some .html code to copy and paste into Jekyll?