Closed JSchmie closed 3 years ago
As the issue #1 has been resolved, is this also resolved?
As the issue #1 has been resolved, is this also resolved?
Maybe. Is there a way like in issue #1 where I can get these orthogonalize_basis=False by load basis as well? Because in this case, I do not use the MOL Object.
Ah, sorry. I misunderstood your problem. The normalization in the code is to make it compatible with libcint (which PySCF also uses). The difference you present in the output section is probably due to different convention on which coefficient to display between DQC and PySCF (whether it is normalized coefficients or non-normalized coefficients).
Ah, sorry. I misunderstood your problem. The normalization in the code is to make it compatible with libcint (which PySCF also uses). The difference you present in the output section is probably due to different convention on which coefficient to display between DQC and PySCF (whether it is normalized coefficients or non-normalized coefficients).
Ok, but why is the overlap Matrix only for some specific cases (of used basis) equal to the Overlap matrix used by pscf? Shouldn't it be always different or always equal to each other?
Hello and thank you for the quick responses. I am working with Jacob here and I would like to add a few details to the problem of differing overlap matrices. If we consider e.g. a single H atom we arrive the same overlap matrix (up to 10-7) for both codes:
from pyscf import gto, scf
mol = gto.Mole()
mol.atom = [['Ni', [-1, 0.0, 0.0]]]
mol.spin = 0
mol.basis = '3-21G'
pyscf_o = mol.get_ovlp()
import dqc
from dqc.utils.datastruct import AtomCGTOBasis
import dqc.hamilton.intor as intor
basis=[dqc.loadbasis("28:3-21G")]
m = dqc.Mol("Ni 1 0 0", basis=basis)
atombases = [
AtomCGTOBasis(atomz=m.atomzs[i], bases=basis[i], pos=m.atompos[i]) \
for i in range(len(basis))
]
wrap = dqc.hamilton.intor.LibcintWrapper(atombases)
dqc_o = intor.overlap(wrap)
pyscf_o-dqc_o.numpy()
You will get a similar result when using He. However, as soon as we use a basis with ang_moms>0 we arrive at different results e.g. 3-21G for Li or Ni, or H with cc-pvdz. Li:
from pyscf import gto, scf
mol = gto.Mole()
mol.atom = [['Li', [-1, 0.0, 0.0]]]
mol.spin = 3
mol.basis = '3-21G'
pyscf_o = mol.get_ovlp()
import dqc
from dqc.utils.datastruct import AtomCGTOBasis
import dqc.hamilton.intor as intor
basis=[dqc.loadbasis("3:3-21G")]
m = dqc.Mol("Li -1 0 0", basis=basis)
atombases = [
AtomCGTOBasis(atomz=m.atomzs[i], bases=basis[i], pos=m.atompos[i]) \
for i in range(len(basis))
]
wrap = dqc.hamilton.intor.LibcintWrapper(atombases)
dqc_o = intor.overlap(wrap)
pyscf_o-dqc_o.numpy()
H cc-pvdz:
from pyscf import gto, scf
mol = gto.Mole()
mol.atom = [['H', [-1, 0.0, 0.0]]]
mol.spin = 1
mol.basis = 'cc-pvdz'
pyscf_o = mol.get_ovlp()
import dqc
from dqc.utils.datastruct import AtomCGTOBasis
import dqc.hamilton.intor as intor
basis=[dqc.loadbasis("1:cc-pvdz")]
m = dqc.Mol("H -1 0 0", basis=basis)
atombases = [
AtomCGTOBasis(atomz=m.atomzs[i], bases=basis[i], pos=m.atompos[i]) \
for i in range(len(basis))
]
wrap = dqc.hamilton.intor.LibcintWrapper(atombases)
dqc_o = intor.overlap(wrap)
pyscf_o-dqc_o.numpy()
So maybe the difference is in the conventions for higher angular momentum terms in the two codes. cheers and thank you for your help.
Ok, but why is the overlap Matrix only for some specific cases (of used basis) equal to the Overlap matrix used by pscf? Shouldn't it be always different or always equal to each other?
It's expected to have the same (permutation-equivariant) to PySCF. The difference is just what displayed in the printed coefficients (after normalization or before normalization).
However, as soon as we use a basis with ang_moms>0 we arrive at different results e.g. 3-21G for Li or Ni, or H with cc-pvdz. Li
As far as I'm aware of, the difference is just in the order of rows/cols of the matrix because the basis order in DQC for higher angmom is different from PySCF.
As far as I'm aware of, the difference is just in the order of rows/cols of the matrix because the basis order in DQC for higher angmom is different from PySCF.
That makes sense, I confirmed this for Li with 3-21G. I did not expect that as I had already checked this before for H with cc-pvzd where this does not seem to be the case. H cc-pvdz gives: pyscf: array([[1. , 0.6849, 0. , 0. , 0. ], [0.6849, 1. , 0. , 0. , 0. ], [0. , 0. , 1. , 0. , 0. ], [0. , 0. , 0. , 1. , 0. ], [0. , 0. , 0. , 0. , 1. ]]) dqc array([[1. , 0.9037, 0. , 0. , 0. ], [0.9037, 1. , 0. , 0. , 0. ], [0. , 0. , 1. , 0. , 0. ], [0. , 0. , 0. , 1. , 0. ], [0. , 0. , 0. , 0. , 1. ]])
I also checked that using cc-pvdz there is also a difference for Li that goes beyond that order of the basis functions.
It might be because the basis cc-pvdz from pyscf is different from cc-pvdz used in dqc.
#BASIS SET: (4s,1p) -> [2s,1p]
H S
13.0100000 0.0196850
1.9620000 0.1379770
0.4446000 0.4781480
H S
0.1220000 1.0000000
H P
0.7270000 1.0000000
while in DQC, it downloads from basis set exchange (https://www.basissetexchange.org/basis/cc-pvdz/format/nwchem/?version=1&elements=1):
#BASIS SET: (4s,1p) -> [2s,1p]
H S
1.301000E+01 1.968500E-02 0.000000E+00
1.962000E+00 1.379770E-01 0.000000E+00
4.446000E-01 4.781480E-01 0.000000E+00
1.220000E-01 5.012400E-01 1.000000E+00
H P
7.270000E-01 1.0000000
END
The first s basis in DQC includes the last row with weights 0.50124 while in PySCF, it doesn't include the last row. If you manually change the downloaded basis in DQC to fit the PySCF format, I suspect it will give the same results.
Thank you very much, I overlooked the difference in the basis sets. Than everything should be clear now.
It might be because the basis cc-pvdz from pyscf is different from cc-pvdz used in dqc.
#BASIS SET: (4s,1p) -> [2s,1p] H S 13.0100000 0.0196850 1.9620000 0.1379770 0.4446000 0.4781480 H S 0.1220000 1.0000000 H P 0.7270000 1.0000000
while in DQC, it downloads from basis set exchange (https://www.basissetexchange.org/basis/cc-pvdz/format/nwchem/?version=1&elements=1):
#BASIS SET: (4s,1p) -> [2s,1p] H S 1.301000E+01 1.968500E-02 0.000000E+00 1.962000E+00 1.379770E-01 0.000000E+00 4.446000E-01 4.781480E-01 0.000000E+00 1.220000E-01 5.012400E-01 1.000000E+00 H P 7.270000E-01 1.0000000 END
The first s basis in DQC includes the last row with weights 0.50124 while in PySCF, it doesn't include the last row. If you manually change the downloaded basis in DQC to fit the PySCF format, I suspect it will give the same results.
After manually changing the basis, it works like intended. Thank you very much.
I discovered some bug or more or less something I don't understand. So first when I want to just read the Basis from Basis Set Exchange the Parameters are different. I discovered a normalization function in your code, but I don't know what it really does. Bur it changes the input coefficients of the Basis functions. Another Problem I got was by calculation the overlapmatix. In comparison to a similar calculation in pyscf the matrix values are sometime the same. Using another Basis, the overlapmatix differs from each others.
So here is a code to replicate the errors:
So the output is:
So my question is when does the overlap matrix the same in pscf and dqc. As well as when will they differ from each other?
Desktop (please complete the following information):