Adjust bond lengths when click-to-edit

I know some people like clicking on atoms to change element (and build up, e.g. an alkyl chain)

A suggestion on GitHub was to adjust the bond lengths with this “alchemy” edit (e.g., H → C atom).

As I indicate in the development updates I just merged a change that does this:

AvogadroEdit

(I realized towards the end of the screencast that C-H vs. C-C is a bit more subtle than O → S → Se → C)

This seems like a useful improvement. My question is whether it should be a specific option, e.g. there’s currently “Adjust Hydrogens”

Should there be an “Adjust Bond Lengths” option? The code is very careful - it will only adjust the bond length if there’s only one non-hydrogen bonded to the atom being edited. So if you drew out a ring, and changed carbon to nitrogen, nothing will change because it’s hard to know what to do there.

Feedback? Ideas?

Should I also tweak bond edits (e.g., if you change from single to double, it moves the atoms to fit a better bond length)?

I personally like it a lot :slight_smile: At the moment, a quick clean-up FF optimization is basically obligatory after drawing anything at all, whereas with this, less so.

It should absolutely be the default behaviour imo.

I’m also in favour of the adjustments based on bond order, again initially restricted to terminal =XHn and #XHn groups.

I can imagine that sometimes people literally just want to change the element of an atom for a calculation but keep the geometry otherwise identical, so probably best to make it a configurable option as you propose. Just on by default.

Having it configurable would certainly be absolutely necessary if the feature was later extended to work in more complicated situations e.g. substitutions in rings, internal bonds changing bond order, because adjustments are more likely to be undesirable there.

As an aside, is the “adjust hydrogens” choice saved in a user’s config? If not, I think it probably should be so as to be persistent between sessions, and likewise for this.