Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit molecule name, charge, and spin in properties #1810

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

ghutchis
Copy link
Member

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

@ghutchis
Copy link
Member Author

Thoughts @matterhorn103

@ghutchis ghutchis mentioned this pull request Nov 21, 2024
2 tasks
@avo-bot
Copy link

avo-bot commented Nov 21, 2024

This pull request has been mentioned on Avogadro Discussion. There might be relevant details there:

https://discuss.avogadro.cc/t/november-2024-live-updates/6446/1

Copy link
Contributor

Here are the build results
Avogadro2.AppImage
Ubuntu-Latest.tar.gz
Win64.exe
Artifacts will only be retained for 90 days.

@matterhorn103
Copy link
Contributor

matterhorn103 commented Nov 21, 2024

Looks good to me! :) I have some thoughts but none of it is necessary, and could definitely be kicked down the line, they would just improve the experience.

The first thing I notice is that the spin can go lower than 1, which obviously it shouldn't.

Secondly, we know for a fact that some combinations of charge and spin are not valid based on the proton count, so is it possible that we can have the +/- arrows be a bit smarter? By that I mean:

  1. Every time the charge is changed by 1 using the arrows the spin should change by 1 to match, either from 1 to 2 or 2 to 1 (i.e. the spin is always the lowest valid value)
  2. When the spin is changed with the arrows it should go in steps of 2 (and the charge is not changed). That way the arrows cycle between the valid spin states. For example incrementing the spin of a singlet would make it a triplet. This halves the number of necessary clicks!
  3. None of this should apply to when the numbers are typed, where the user should be able to choose freely just as they can now - this is important so they can override any errors in Avogadro's logic

If you were particularly keen for suggestions I'd also say that in an ideal world you would see the +/- arrows even before you click the field so it's clear they're editable, like how it is in the Manipulate Tool for example. But I suspect your choice of widgets is limited in the table?

@ghutchis
Copy link
Member Author

The first thing I notice is that the spin can go lower than 1, which obviously it shouldn't.

Ugh, that was a typo. Sorry.

When the spin is changed with the arrows it should go in steps of 2 (and the charge is not changed). That way the arrows cycle between the valid spin states. For example incrementing the spin of a singlet would make it a triplet. This halves the number of necessary clicks!

I think you mean in the input generators? At least for me, the table doesn't show any kind of arrows. There is only minimal validation at the moment.

I get your idea (i.e., to make sure the number is always valid) but I think I'd still leave it to the user. What if I have a molecule and want to run the radical cation. Do I have to change the charge before I can change the spin state? That seems non-intuitive. Some sort of color or warning that the spin state and charge are inconsistent might make sense though.

There's some code in the Molecule class that works like you describe. If I draw out a molecule and change the charge to +1 or -1, it will change the auto-defined multiplicity to 2 (and back to 1) according to the number of electrons.

@ghutchis
Copy link
Member Author

But some of this is probably better on the forum than buried in the pull request comments.

@ghutchis ghutchis linked an issue Nov 21, 2024 that may be closed by this pull request
2 tasks
@matterhorn103
Copy link
Contributor

matterhorn103 commented Nov 22, 2024

I think you mean in the input generators? At least for me, the table doesn't show any kind of arrows.

No, I mean in the molecular properties table. They only show up when I click to edit the fields, but they're there.

What if I have a molecule and want to run the radical cation. Do I have to change the charge before I can change the spin state?

The way I'm suggesting, you would in this case never have to change the spin state, because it would automatically be the radical cation after increasing the charge.

Maybe the idea would be more intuitive if it was separate buttons labelled as what they actually are: "add/remove an electron" and "increase/decrease spin".

Because I think those are the two actions that people actually want to do - either ionize their molecule or go from low-spin to high-spin.

There's some code in the Molecule class that works like you describe. If I draw out a molecule and change the charge to +1 or -1, it will change the auto-defined multiplicity to 2 (and back to 1) according to the number of electrons.

Good to know :)

But some of this is probably better on the forum than buried in the pull request comments.

Probably, I can open a thread tomorrow if you don't.

Copy link
Contributor

Here are the build results
Ubuntu-Latest.tar.gz
Avogadro2.AppImage
Win64.exe
Artifacts will only be retained for 90 days.

@ghutchis ghutchis added the enhancement feature changes / API changes label Nov 22, 2024
@ghutchis ghutchis merged commit 16a8ef4 into OpenChemistry:master Nov 22, 2024
23 checks passed
Copy link
Contributor

Here are the build results
Ubuntu-Latest.tar.gz
Avogadro2.AppImage
Win64.exe
Artifacts will only be retained for 90 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature changes / API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Total Charge / Spin Multiplicity
3 participants