Handling of bond order

A few parts to this. Not an urgent topic, thoughts for post v1.99, so doesn’t need immediate feedback.

Adding back partial bond order and dashed bonds that represent it are on the to-do list for v2.0 and have an open issue.

The spec for cjson currently specifies that "bonds"["order"] should be a list of integers. Presumably for dashed bonds this would have to be changed to floats so that they can be stored as 0.5, 1.5 etc.?

I think it’d be good if one day (not urgent imo) Avogadro could support the depiction of transition metal complexes with quadruple bonds (and up) as well, in case anyone needs to make images of them. So I opened a new issue for that too.

cjson supports bond orders of 4, and Avogadro seems to keep them stored in memory as such, they are listed correctly in Analysis > Properties > Bond Properties..., and they are retained just fine across reading/editing/saving cjson files. So I think all that’s missing is the ability to display and create them.

More generally I am very keen to work on the ORCA reader that Avogadro uses, as it is close to my heart and I have used it a fair bit throughout my studies, and the forum and Reddit see a lot of interest in using Avogadro to visualize ORCA output.

The reader (which is avogadrolibs/avogadro/quantumio/orca.cpp I assume) has, or looks like it should have, the ability to read Mayer bond indices, which are calculated by default in ORCA calculations.Looking to the future, it would be cool if these were one of the things displayed by Avogadro under Molecular Properties, and I’d like to help make that happen.

For this, they need to be read by Avo, rather than just detected and used to create double bonds. They should then be stored both in-memory and in the save format in a standardized way, right?

If fractional bond order becomes supported for "bonds"["order"] in cjson in order to support dashed bonds, one possibility would be to store calculated bond orders there. However, manual choices by the user and calculation results would overwrite each other.

So my question is: if I work on the ORCA reader so that the calculated bond orders are stored and saved to cjson, where should I put them? Various ideas, many variations are possible:

  1. "bonds"["order"] (bad)
  2. "bonds"["calculatedOrder"]
  3. "bonds"["bondIndex"] to represent calculated bond orders, but risks confusion with "bonds"["index"]
  4. "bonds"["calculatedBondIndices"]
  5. "properties"["bondOrders"]
  6. "properties"["calculatedBondOrders"]
  7. "properties"["mayerBondIndices"]

In my view there should be a generic “calculated bond order” field because Avogadro or any other program shouldn’t be required to support multiple different possible methods of calculation e.g. Mayer, Wiberg. xtb only produces the latter. So 6 should only be used in combination with one of the others.

Best option to my mind is then something like e.g. ORCA files could have the Mayer indices written to "bonds"["calculatedOrder"] and "properties"["mayerBondIndices"], xtb files could write Wiberg indices to "bonds"["calculatedOrder"] and "properties"["wibergBondIndices"]. Then Avogadro sources drawn/idealized/user-chosen bond orders from "bonds"["order"] and calculated orders from "bonds"["calculatedOrder"], and can use the latter to inform selection of the former if the former are missing.

This would create headaches. While most of us know that “bond orders” are real-valued things, chemists really like to draw a valence bond structure with single, double, etc.

On the other hand, I snuck in a commit which adds “labels” as a bond property in CJSON for Avogadro 1.99 … because a colleague would like to display decimal bond orders. There’s not yet depiction code, but the “plumbing” is there.

I don’t think I had time to add that to the ORCA reader so that the Mayer bond orders were added as labels, but it makes sense. Somewhere I also have some notes about more general bond properties.