-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
first try at implementing bond-order calculations #672
Conversation
28bf115
to
9bad0c3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #672 +/- ##
==========================================
+ Coverage 75.68% 75.71% +0.02%
==========================================
Files 398 398
Lines 50418 50547 +129
==========================================
+ Hits 38161 38270 +109
- Misses 12257 12277 +20 ☔ View full report in Codecov by Sentry. |
Thanks @zerothi, apologies for this late response. I just took a look now and tested the methods for a benzene molecule. This is what I got: import sisl
dm = sisl.get_sile('benzene/RUN.fdf').read_density_matrix()
def calcBO(method):
print(f"method={method}:")
bo = dm.bond_order(method=method)
for i in range(bo.na):
print(bo.atoms[i].symbol, end=" ")
#for j in range(bo.na):
for j in range(i + 1):
print(f"{bo[i, j]:5.2f}", end=" ")
print()
calcBO("mayer")
calcBO("wiberg")
calcBO("bond+anti") that produces
I don't quite understand this as for benzene I would expect to find (quoting from Wikipedia/Bond_order):
None of the three methods provide approx. the value |
PS If I read the DM from a spin-polarized calculation I get completely different results for
|
As a reference, running ORCA for benzene produces these Mayer charges and bond orders in the output file:
I think these numbers make: ~1.5 for C-C resonant bonds and ~1 for C-H single bonds. |
Thanks @tfrederiksen I have found the problem (it had to do with how the formula should be understood, MM vs simple multiplications). I just have to generalize it for supercells so it works for chains etc. |
f5a6fa9
to
2a38fd7
Compare
|
||
from .sparse import SparseOrbitalBZSpin | ||
from .spin import Spin | ||
|
||
__all__ = ["DensityMatrix"] | ||
|
||
|
||
def _get_density(DM, orthogonal, what="sum"): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
@tfrederiksen could you have a look again. I believe it is better now, I get this with Benzene and a Cchain:
|
@@ -57,24 +57,44 @@ | |||
__all__ = ["SparseCSR", "ispmatrix", "ispmatrixd"] | |||
|
|||
|
|||
def _rows_and_cols(csr, rows=None): | |||
"""Retrieve the sparse patterns rows and columns from the sparse matrix | |||
def _to_coo(csr, data: bool = True, rows=None): |
Check notice
Code scanning / CodeQL
Returning tuples with varying lengths Note
tuple of size 2
tuple of size 3
f794455
to
aa84152
Compare
This fixes #507 by adding the Wiberg and Mayer implementations. I am not fully sure the Mayer is correct, since the expressions are PS_abPS_ba, but due to symmetry, I would expect this to be PS_ab ** 2. fixed bond+antibond method, factor 0.5 Signed-off-by: Nick Papior <[email protected]>
Still needs a bit refinement, but it should be there now. Signed-off-by: Nick Papior <[email protected]>
Also corrected Wiberg (which gives bad results) Signed-off-by: Nick Papior <[email protected]>
While the mulliken bond-order can easily be calculated from the mulliken output, this will make it simpler. Signed-off-by: Nick Papior <[email protected]>
589bee7
to
40907da
Compare
While it is a bit weird to have bond_order return orbital-order, I think it is not necessary to create a new method to retrieve the bond-order. Better to keep it simple. Signed-off-by: Nick Papior <[email protected]>
I'll merge this, I think it looks correct, @tfrederiksen if/when you get the time, a check from your side would be grateful. For now I think it is OK to put in and let people play with it :) Thanks! |
I finally got to test this and it looks good to me too. For benzene, I now get this:
With the For [2]-triangulene, which has a S=1/2 ground state, I find among the carbons:
and some nonzero "spin-z" components:
Not sure what to take away from the latter, though. |
Thanks for following up. Yeah, I am not sure about the spin details. But I guess they can be used to correlate differences between two structures/states. I would assume it means something is the spin configuration is a localized or delocalized quantity. |
This fixes #507 by adding the Wiberg and Mayer implementations.
I am not fully sure the Mayer is correct, since the expressions are PS_abPS_ba, but due to symmetry, I would expect this to be PS_ab ** 2.
@tfrederiksen would you please have a look at whether this makes sense? I am a bit puzzled about the Mayer implementation, it just looks the same as Wiberg, except the overlap matrix, and perhaps Mayer should be the default.
DensityMatrix
#507isort .
andblack .
at top-leveldocs/
CHANGELOG.md