Skip to content

Fix UKS gradient threading #2941

@loriab

Description

@loriab

I just noticed that the UKS gradients are off when nthreads>1. Failing tests are: dft_grad_lr2, dft_grad_lr3, dft_grad_meta, dft-grad2. An example case is:

func_reference = psi4.Matrix.from_list([                         #TEST
 [ 0.,          0.,         -5.23600907e-02],                    #TEST
 [ 0.,          0.,          5.23600907e-02]])                   #TEST
cam_b3lyp_reference = psi4.Matrix.from_list([                    #TEST
 [ 0.,          0.,         -1.09138077e-01],                    #TEST
 [ 0.,          0.,          1.09137576e-01]])                   #TEST
func_uks_reference = psi4.Matrix.from_list([                     #TEST
 [ 0.,          0.,          1.77777928e-03],                    #TEST
 [ 0.,          0.,         -1.77777928e-03]])                   #TEST
cam_b3lyp_uks_reference = psi4.Matrix.from_list([                #TEST
 [ 0.,          0.,         -3.46813335e-02],                    #TEST
 [ 0.,          0.,          3.46809033e-02]])                   #TEST

molecule {
    H  0.000  0.000  0.000
    F  0.000  0.000  1.100
}

set {
    scf_type              df
    basis                 cc-pvdz
    dft_radial_points     120
    dft_spherical_points  434
    e_convergence         12
    d_convergence         10
    points 5
}

molecule {
    1 2
    H  0.000  0.000  0.000
    F  0.000  0.000  1.100
}

set reference uks

anl_grad = gradient('scf', dft_functional="CAM-B3LYP", dertype=1)
fd_grad = gradient('scf', dft_functional="CAM-B3LYP", dertype=0)
compare_matrices(cam_b3lyp_uks_reference, anl_grad, 6, "Analytic vs Reference CAM Gradients")    #TEST
compare_matrices(anl_grad, fd_grad, 4, "Analytic vs FD CAM Gradients")    #TEST

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions