Skip to content

ValueError in g-tensor calculation #11

@1234zou

Description

@1234zou

Dear PySCF developers,
I'm trying to use this repo to perform a UHF g-tensor calculation. But got the following error

Traceback (most recent call last):
  File "/public/home/jxzou/vip_test/Tp2Co_C6H6/Co_quartet/Co_quartet_uhf_nmr.py", line 22, in <module>
    gobj.kernel()
  File "/public/home/jxzou/software/properties/pyscf/prop/gtensor/uhf.py", line 486, in kernel
    gpara = self.para(mo1, self._scf.mo_coeff, self._scf.mo_occ)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/properties/pyscf/prop/gtensor/uhf.py", line 513, in para
    self.mo10, self.mo_e10 = self.solve_mo1()
                             ^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/properties/pyscf/prop/nmr/uhf.py", line 174, in solve_mo1
    mo10, mo_e10 = ucphf.solve(vind, mo_energy, mo_occ, h1, s1,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/pyscf-2.11.0/pyscf/scf/ucphf.py", line 41, in solve
    return solve_withs1(fvind, mo_energy, mo_occ, h1, s1,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/pyscf-2.11.0/pyscf/scf/ucphf.py", line 147, in solve_withs1
    mo1 = lib.krylov(vind_vo, mo1base.reshape(-1, nov),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/pyscf-2.11.0/pyscf/lib/linalg_helper.py", line 1311, in krylov
    axt = aop(x1)
          ^^^^^^^
  File "/public/home/jxzou/software/pyscf-2.11.0/pyscf/scf/ucphf.py", line 137, in vind_vo
    v = fvind(mo1).reshape(nd, nov)
        ^^^^^^^^^^
  File "/public/home/jxzou/software/properties/pyscf/prop/nmr/uhf.py", line 203, in vind
    v1mo = numpy.hstack((numpy.asarray(v1a),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/public/home/jxzou/software/anaconda3/lib/python3.11/site-packages/numpy/core/shape_base.py", line 359, in hstack
    return _nx.concatenate(arrs, 1, dtype=dtype, casting=casting)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 15 and the array at index 1 has size 12

The input script is

from pyscf import gto, scf, lib
from pyscf.prop import gtensor

lib.num_threads(32)
mol = gto.M()
mol.atom = '''
Co           0.000000000         0.000000000         0.000000000
'''

mol.basis = 'def2-TZVP'
mol.charge = 0
mol.spin = 3
mol.verbose = 4
mol.build(parse_arg=False)

mf = scf.UHF(mol)
mf.max_cycle = 128
mf.max_memory = 64000 # MB
mf.kernel()

gobj = gtensor.uhf.GTensor(mf).set(verbose=4)
gobj.kernel()

Is the problem related to numpy version? Here is what I got from conda list numpy

# packages in environment at /public/home/jxzou/software/anaconda3:
#
# Name                    Version                   Build  Channel
numpy                     1.26.4          py311h08b1b3b_0
numpy-base                1.26.4          py311hf175353_0
numpydoc                  1.5.0           py311h06a4308_0

Python version is 3.11.7.

Thanks a lot,
Jingxiang

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions