Repository: pyscf/pyscf

Issue #725: AttributeError in SCF calculations with k points and newton solver
Created: 2020-10-06T00:26:03Z
greetings,
while running some SCF calculations in PBC, using the Newton solver as in the script below, the following error is obtained:
import pyscf,sys,os
import numpy as np
from pyscf.pbc import gto,scf,dft,tools
from pyscf.pbc.tools.pbc import super_cell
cell = gto.Cell()
cell.a = 4.0*np.eye(3)
cell.atom = [['Mg',(0,0,0)]]
cell.basis = 'gth-szv'
cell.pseudo = 'gth-pbe'
cell.verbose = 4
cell.build()
mf = dft.KRKS(cell).density_fit()
mf.xc = 'pbe,pbe'
mf = scf.newton(mf)
mf.kernel()
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 709, in kernel
callback=self.callback, verbose=self.verbose)
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 527, in kernel
rotaiter.send((mo_coeff, mo_occ, dm, vhf, e_tot))
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 451, in _rotate_orb_cc
u = mf.update_rotate_matrix(dr, mo_occ, mo_coeff=mo_coeff)
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/pbc/scf/newton_ah.py", line 231, in update_rotate_matrix
dr = numpy.zeros((nmo,nmo), dtype=dx.dtype)
AttributeError: 'int' object has no attribute 'dtype'
upon looking into pyscf/pbc/soscf/newton_ah.py it appears that the variable dr is initialized at line 356 at dr=0. The for loop starting at line 362 is then skipped, and update_rotate_matrix is called with an integer number rather than an array in line 451.
Is this a bug? Can you help me understanding and fixing it?
thanks,
Mario

Duplicate issue #726: AttributeError in SCF calculations with k points and newton solver
Created: 2020-10-06T00:27:07Z
greetings,
while running some SCF calculations in PBC, using the Newton solver as in the script below, the following error is obtained:
import pyscf,sys,os
import numpy as np
from pyscf.pbc import gto,scf,dft,tools
from pyscf.pbc.tools.pbc import super_cell
cell = gto.Cell()
cell.a = 4.0*np.eye(3)
cell.atom = [['Mg',(0,0,0)]]
cell.basis = 'gth-szv'
cell.pseudo = 'gth-pbe'
cell.verbose = 4
cell.build()
mf = dft.KRKS(cell).density_fit()
mf.xc = 'pbe,pbe'
mf = scf.newton(mf)
mf.kernel()
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 709, in kernel
callback=self.callback, verbose=self.verbose)
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 527, in kernel
rotaiter.send((mo_coeff, mo_occ, dm, vhf, e_tot))
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/soscf/newton_ah.py", line 451, in _rotate_orb_cc
u = mf.update_rotate_matrix(dr, mo_occ, mo_coeff=mo_coeff)
File "/Users/mario/anaconda3/envs/qiskitdev/lib/python3.7/site-packages/pyscf/pbc/scf/newton_ah.py", line 231, in update_rotate_matrix
dr = numpy.zeros((nmo,nmo), dtype=dx.dtype)
AttributeError: 'int' object has no attribute 'dtype'
upon looking into pyscf/pbc/soscf/newton_ah.py it appears that the variable dr is initialized at line 356 at dr=0. The for loop starting at line 362 is then skipped, and update_rotate_matrix is called with an integer number rather than an array in line 451.
Is this a bug? Can you help me understanding and fixing it?
thanks,
Mario

Closing comment (2020-10-06T01:36:07Z): duplicate of #725