【问题标题】:I don't understand the indexing of 2 electron integrals in pyscf我不明白 pyscf 中 2 个电子积分的索引
【发布时间】:2023-02-17 20:27:22
【问题描述】:

我正在尝试创建一个包来执行 FCI 的修改版本。我正在尝试学习如何索引行列式、使用斯莱特规则求解方程等。我目前被困在 2 个电子积分上。我需要为我的基组获取一组积分,这些积分将用于为我的系统求解 slater-condon 规则。我目前正在运行一些测试。进度如下:

import pyscf as ps
import pyscf.mcscf as mc
import pyscf.tools.molden as md
import pyscf.lo as lo
import scipy
import pyscf.scf.ghf as ghf
import pyscf.ao2mo as ao2mo
import numpy as np

print("yes")

mol_h2o = ps.gto.M(atom = 'H 0 1 0; H 0 0 1', basis = 'ccpvdz', symmetry=False)

uhf_h2o = ps.scf.UHF(mol_h2o)
uhf_h2o.kernel()
print(mol_h2o.intor('int1e_kin').shape)
print(mol_h2o.intor('int1e_nuc').shape)
print(mol_h2o.intor('int1e_ovlp').shape)
print(mol_h2o.intor('int2e').shape)
print(uhf_h2o.mo_coeff.shape)
print(uhf_h2o.mo_occ.shape)

eri1 = mol_h2o.ao2mo(uhf_h2o.mo_coeff[0], uhf_h2o.mo_coeff[0], aosym = 's1', compact=False)
print(eri1.shape)

H=np.zeros([2,2])

N = 10
sum=0
for i in np.arange(0,N):
    if(uhf_h2o.mo_occ[0,i]==1):
        for j in np.arange(0,N):
            for k in np.arange(0,N):
                #sum = sum+ uhf_h2o.mo_coeff[0,i,j]*uhf_h2o.mo_coeff[0,i,k]*(mol_h2o.intor('int1e_kin')[j,k]+mol_h2o.intor('int1e_nuc')[j,k])
                sum = sum+ uhf_h2o.mo_coeff[0,j,i]*uhf_h2o.mo_coeff[0,k,i]*(mol_h2o.intor('int1e_kin')[j,k]+mol_h2o.intor('int1e_nuc')[j,k])
    if(uhf_h2o.mo_occ[1,i]==1):
        for j in np.arange(0,N):
            for k in np.arange(0,N):
                #sum = sum+ uhf_h2o.mo_coeff[0,i,j]*uhf_h2o.mo_coeff[0,i,k]*(mol_h2o.intor('int1e_kin')[j,k]+mol_h2o.intor('int1e_nuc')[j,k])
                sum = sum+ uhf_h2o.mo_coeff[1,j,i]*uhf_h2o.mo_coeff[1,k,i]*(mol_h2o.intor('int1e_kin')[j,k]+mol_h2o.intor('int1e_nuc')[j,k])
```
yes
converged SCF energy = -1.01844561914196  <S^2> = 1.5343282e-13  2S+1 = 1
(10, 10)
(10, 10)
(10, 10)
(10, 10, 10, 10)
(2, 10, 10)
(2, 10)
(100, 100)
'''`

I think I was able to properly get the 1 electron integrals. I am confused why er1.shape is returning (100,100) and how I can get a certain <ij||kl> integral from this 2D nd.array? 

Thanks in advance.

【问题讨论】:

  • 请阐明您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python chemistry


【解决方案1】:

PySCF 将二体电子排斥积分作为二维数组返回。要将其转换为索引为 &lt;ij||kl&gt; 的四维数组,您需要重塑返回的数组。在您的代码中,这对应于 eri1 = eri1.reshape(10, 10, 10, 10)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-04
    • 2014-08-19
    • 2016-06-23
    • 2016-12-28
    • 2022-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多