-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Centroid is not created at correct position #1657
Comments
Hi, @matterhorn103 I attempted to replicate the issue involving the centroid but was unsuccessful. Everything seems to be functioning properly on my end. I created a molecule of ethane (C2H6) and navigated to the build menu, where I added a centroid. Afterward, I logged the positions of the atoms and centroid, and they appeared to be accurate. Is there another method you suggest for reproducing the bug? My apologies if I am misunderstanding your request. Atom 1: (-9.47656, 1.24692, 0)
Atom 2: (3.19798, 1.32027, -3.49332e-05)
Atom 3: (-9.83792, 2.0566, -0.598943)
Atom 4: (-9.82787, 0.320286, -0.403532)
Atom 5: (-9.83387, 1.35767, 1.00248)
Atom 6: (3.55529, 1.20951, -1.00251)
Atom 7: (3.54929, 2.2469, 0.403497)
Atom 8: (3.55934, 0.510585, 0.598908)
Centroid: (-3.13929, 1.28359, -1.74666e-05)
|
With your coordinates for ethane the centroid is also generated incorrectly for me. It is produced at: Weirdly when I try to reproduce my original bug I still get an incorrect centroid, but not at the same coordinates as before. Now it reproducibly appears at: This is a different PC but still OpenSUSE Tumbleweed and the AppImage of Avogadro. It is interesting that the numbers produced should be different for the same input coordinates. What version of Avogadro are you using? |
I'm having trouble understanding why the centroid isn't correctly positioned along the x-axis in your case. There also seems to be a slight variance in the centroid position for the y and z axes on the cyclopentane ring. After reviewing the codebase and examining the calculations, everything appears to be in order. I even logged the values for the centroid and atom coordinates, and they seem accurate. Here's the screenshot for cyclopentane ring:- I think it might not actually be a bug in the code, but rather a system-specific issue. Different PCs may behave differently when calculating the centroid. I'm using version 1.99.0 of Avogadro and have tested both the Appimage download and the source download, with consistent and correct results. May @ghutchis have some insights regarding the bug you are facing. |
Is this still an issue? Looks okay to me. |
Similar to the story in the centre-of-mass thread, the centroid seems to be correct for ethane and benzene in the AppImage, both branches of the Flatpak, and in my locally compiled Qt5 version, but in the local Qt6 version I see different behaviour. Weirdly though, if all atoms are selected and I click centroid, the dummy atom is added with By the way, another thing I spotted (which isn't so much a bug as just something that hasn't been expected and accounted for) is that dummy atoms also contribute to the calculation of a new centroid, which I feel shouldn't be the case. For example, the benzene centroid gets added at
but if I first select only three carbon atoms on one side of the ring and add a centroid, and then add a centroid without selecting anything, then the positions of the two are
If I explicitly select all atoms except the first dummy atom, and add a second centroid, the position is of course correct. |
Avogadro version: (please complete the following information from the About box):
Desktop version: (please complete the following information):
AppImage (Nightly but maybe a week old)
Describe the bug
Build > Add Centroid doesn't put the centroid in the correct place but instead a very large x value (y and z seem correct).
To Reproduce
Steps to reproduce the behavior:
The coordinates in the coordinate editor after adding a centroid for a cyclopentane ring:
C -4.113527 0.316425 0.000000
C -5.183343 2.094432 0.000013
H -0.574506 3.569662 0.899734
H -4.383103 -0.239449 0.873632
H -4.362473 -0.196962 -0.905185
C -3.405321 4.083372 0.000070
H -5.798374 2.152369 -0.873647
H -5.820881 2.154459 0.857242
C -1.039678 3.224507 0.000076
H -3.556076 4.682475 -0.873571
H -3.549994 4.658202 0.890878
C -0.904067 0.723253 0.000092
H -0.543563 3.592610 -0.873577
H -0.429724 0.327520 0.873759
H -0.334561 0.248164 -0.771176
Xx 381.170813 2.088398 0.000050
Presumably the same coordinates, minus the centroid, should reproduce the same centroid.
The text was updated successfully, but these errors were encountered: