Add new dft functional from python side

Dear all,
I am trying to reproduce some results from LC-blyp, which makes me to customize functional. And I found has already a solution to this question. However, when I add the same code from the post to my code, and using“awLCBLYP”) for a test. It reports functional no found. Is there any way to add new functional from the python side?

psi4 version: 1.3.2

Thank you very much

could you post your input?

The whole code is quite lengthy, here is the main part:

import psi4
import numpy as np
def mod_lcblyp(name, npoints, deriv, restricted=True):

    # Build a empty superfunctional
    sup = core.SuperFunctional.blank()

    # Name the functional and provide a description
    sup.set_description('    LC-BLYP Hyb-GGA Exchange-Correlation Functional\n')

    # Set the correlation functional
    sup.add_c_functional(core.LibXCFunctional('XC_GGA_C_LYP', restricted))

    b_x = core.LibXCFunctional('XC_GGA_X_B88', restricted)

   #Set exchange functional ( static + long-range contribution)

   # set the parameters for S7:

    return sup

def main():
    psi4.set_output_file('ethylene.dat', False)
    molecule_geo = psi4.geometry("
    C                 -0.66631400    0.00000000    0.00000000
    C                  0.66631400    0.00000000    0.00000000
    H                 -1.23960500    0.91940200    0.00000000
    H                 -1.23960500   -0.91940200    0.00000000
    H                  1.23960500   -0.91940200    0.00000000
    H                  1.23960500    0.91940200    0.00000000")

    eng, wfn ='scf', dft_functional='awLCBLYP', return_wfn=True, molecule=molecule_geo_dimer)

if  __name__ == '__main__':

At this stage PSI4 doesn’t know your functional name.

You want to use energy('scf',dft_functional=mod_lcblyp)

The other thread talked about some modified LC-BLYP, I think. So be careful about the used parameters!
There usually isn’t a global HF exchange (set_x_alpha(0.30)) in the LC scheme.

It could be easier to use the dictionary interface like shown here:

Thanks!! It works.
I will check the parameter.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.