Best file format to send geometry/orbitals/vibrations to Avogadro

We’re writing a PyQt application that, inter alia, should provide 3D visualisation of the results of Molpro calculations. The simple idea in play is to do this by launching the Avogadro app with the necessary data (nuclear geometry, orbitals and their basis, normal vibrational modes) provided in a file - this avoids us having to maintain any kind of linking to Avogadro libraries. If at all possible, it should be that the user just has to install Avogadro (presumably 2 not 1) and not mess with understanding how to install plugins. Any file format can be coded up. What would be the best file format that Avogadro would always understand? cjson? But if so, I cannot find the defining documentation including normal modes.

The existing thing in Avogadro1 that parses Molpro’s human-readable output is not, unfortunately, an option - besides the fact that that output format could change in the future, this parser gets things wrong, for example, by displaying the initial, not final, geometry in a geometry optimisation.

Thanks for any suggestions!
Peter

Sounds great! Avogadro 2 offers RPC calls, for example load file X: https://two.avogadro.cc/api/rpc.html which would work well for this purpose. (I’m working on a Python module that should make it a bit easier, but don’t have a lot of free time right now. So bug me.)

There’s a Pydantic model: chemicaljson/chemicaljson.py at 60f8a37a160706960c3591a5a508609400ec9122 · OpenChemistry/chemicaljson · GitHub

For what it’s worth, that compiles a JSON schema: chemicaljson/cjson.schema at 60f8a37a160706960c3591a5a508609400ec9122 · OpenChemistry/chemicaljson · GitHub

I wrote a converter from cclib to CJSON here: https://github.com/OpenChemistry/avogadro-cclib/blob/cc14cafcdfc1c27858ac1e4a64c010ca95467310/cclibScript.py

And I’ve been working closely with the cclib folks to improve their support.

Feel free to ping either here or in the chemicaljson repository if there’s something needed in CJSON. We’d certainly like to see it gain wider use.

Thanks, but I just can’t get it to work. If you or someone could post an example cjson (or any other format - we really don’t care) file that really will cause Avogadro to show orbitals and vibrations, I would soon be up and running.

Yes, we would plan to eventually use the rpc (although I couldn’t make that work either with simple C++ code) if it became available directly from python.

(Something seems off with calculating an electron density from that benzene.cjson, but orbitals work.)

Here’s an example in Python (e.g., saving screenshots) - the saveGraphic message is new to the HEAD code, but loadFile should work on all releases.

The new work will be part of the avogadro Python module and offer methods rather than requiring scripts to handle the JSON-RPC themselves.

Thanks. Both those examples, like the various ones I have already tried, open perfectly in Avogadro 1.97.0 and show just the nuclear geometry. But there is no clue in any of the menus or button tooltips as to what one should then do to see the vibrations or orbitals. In Avogadro1, my recollection is that these were offered immediately on opening an appropriate file.

Yes, at the moment, there are no “popup windows.”

But you can check Analysis → Vibrational Modes… will only activate if vibrations are present.

And in Analysis → Create Surfaces you will see “Molecular Orbital” and “Electron Density” if the basis and orbitals have loaded properly.

Thanks. I guess ‘Analysis’ means ‘Analytic’, and ‘Vibrational Modes’ means ‘Vibrations’, and now I understand how it works. But it seems as if using this for displaying orbitals is not very fruitful, since it plots the isosurface for a signed value - ie you can see only the positive- or negative-phase lobe, but not both together.

Perhaps we would be better for now trying to drive Avogadro1 instead of 1.97? That at least would avoid the tiresome need to manually follow the menus (and what should a user understand by ‘Nothing’ in the ‘Create Surfaces’ pop-up, and how to type in the contour value, and how to get the density to display anything at all…?). Is there a constructible file format for vibrations, and for orbitals, that could be sent into that, please?

It’s a bug. It’s fixed in the current development code, which will be released as 1.98. It is marked as a beta.

No, and as I’ve typed out dozens on times on the forum, we can’t maintain the 1.x codebase.

If you have some constructive feedback as far as the Avogadro2 betas, please submit it through GitHub and of course as a volunteer org, we always welcome help.