|
|
本帖最后由 zjxitcc 于 2025-11-11 15:13 编辑
SF-TDA, MRSF-TDA, SA-SF-TDA methods are usually based on the ROKS (restricted open-shell Kohn-Sham, also called RODFT) reference wave function. But ROKS is often very difficult to be converged. The SCF algorithm in GAMESS is not as robust as that in mainstream/popular quantum chemistry (QC) programs, which makes the ROKS calculation even harder.
I wrote a tutorial (in Chinese) which aims to solve this problem thoroughly. The idea is to separate the target calculation into two steps: (i) ROKS calculation, (ii) SF-/MRSF-/SA-SF-/TDA calculation. We can use one QC program (which has very robust ROKS code, e.g. PySCF/ORCA/Gaussian) to perform the ROKS calculation, and use another program (GAMESS/OpenQP/Q-Chem, etc) to perform the desired spin-flip calculation. A combination of two programs makes the whole calculation more efficient and fewer SCF convergence faliures.
I'll take your molecule as an example. Firstly, we write/create the following Python script `Cz2BP_MRSFt_PBE0.py`
- from pyscf import gto, dft, lib
- from mokit.lib.py2gms import py2gms
- lib.num_threads(64) # 64 CPU cores
- mol = gto.M()
- # 82 atom(s)
- mol.atom = '''
- C 3.76399300 -0.50818100 0.38545400
- C 2.60277900 0.14659700 -0.06114300
- (not shown)
- '''
- mol.basis = {
- (def-TZVP basis set data, not shown)
- }
- mol.charge = 0
- mol.spin = 2
- mol.verbose = 4
- mol.build(parse_arg=False)
- # routine ROKS calculation
- mf = dft.ROKS(mol)
- mf.xc = 'pbe0'
- mf.grids.atom_grid = (99,590)
- mf.verbose = 4
- mf.max_cycle = 50
- mf.max_memory = 160000 # 160 GB
- mf.level_shift = 0.1
- mf.kernel()
- if mf.converged is False:
- mf = mf.newton()
- mf.kernel()
- # stable=opt for ROKS wave function
- mo, _, stable, _ = mf.stability(tol=1e-7,return_status=True)
- if stable is False:
- dm = mf.make_rdm1(mo, mf.mo_occ)
- mf.kernel(dm0=dm)
- mo, _, stable, _ = mf.stability(tol=1e-7,return_status=True)
- # export GAMESS .inp file
- py2gms(mf, 'Cz2BP_MRSFt_PBE0.inp', mrsf=True)
复制代码
This is also an input file of the open source QC package PySCF. You can find this script attached
Cz2BP_MRSFt_PBE0.py
(7.83 KB, 下载次数 Times of downloads: 0)
You can submit the PySCF job, e.g.
- python Cz2BP_MRSFt_PBE0.py >Cz2BP_MRSFt_PBE0.out 2>&1 &
复制代码 This python script says that firstly the ROKS PBE0 calculation would be performed, secondly check the ROKS wave function stability and try to find a lower solution (in an iterative way) if the ROKS wave function is not stable. Thirdly, export/punch stable ROKS wave function and create GAMESS MRSF-TDA input file called `Cz2BP_MRSFt_PBE0.inp`. Here py2gms is a function from MOKIT, which is able to (correctly) transform MOs from PySCF to GAMESS. You can find Cartesian coordinates, basis set data (def-TZVP), MRSF keywords, MO coefficients are well written in .inp
- $CONTRL SCFTYP=ROHF RUNTYP=ENERGY ICHARG=0 MULT=3 NOSYM=1 ICUT=11
- MAXIT=200 ISPHER=1 DFTTYP=PBE0 TDDFT=MRSF $END
- $SYSTEM MWORDS=300 $END
- $SCF DIRSCF=.T. FDIFF=.F. MOM=.T. $END
- $GUESS GUESS=MOREAD NORB=1090 $END
- $DFT NRAD0=99 NLEB0=590 NRAD=99 NLEB=590 $END
- $TDDFT NSTATE=5 NRAD=99 NLEB=590 $END
复制代码 Note that `DFTTYP=BHHLYP` is written in the .inp file by default since the BHandHLYP is the most frequently used functional in spin-flip calculations. Since you use PBE0, we need to modify it into `DFTTYP=PBE0`. Usually the SCF iteration in GAMESS would be converged in 1~2 cycles when we apply this trick. And the program immediately moves forward to the MRSF calculation. There are some rare cases that the energy goes higher or oscillating even if the initial ROKS energy is already the lowest. We can add the keyword `MOM=.T.` if such case happens. Finally we can submit the GAMESS job, e.g.
- rungms Cz2BP_MRSFt_PBE0.inp 00 64 >Cz2BP_MRSFt_PBE0.gms 2>&1 &
复制代码 A smooth convergence can be found in GAMESS output file (.gms)
- ITER EX TOTAL ENERGY E CHANGE DENSITY CHANGE DIIS ERROR INTEGRALS SKIPPED
- * * * INITIATING DIIS PROCEDURE * * *
- 1 0 -1843.2831356194 -1843.2831356194 0.044601763 0.000078659 2194165061210776939510
- 2 1 -1843.2831355007 0.0000001186 0.001964492 0.000009821 2193945982510777418946
- 3 2 -1843.2831193900 0.0000161107 0.001395311 0.000574187 2193943440710777425512
- 4 3 -1843.2831354921 -0.0000161021 0.000055589 0.000011031 2193944894210777422167
- 5 4 -1843.2831354991 -0.0000000071 0.000038054 0.000006210 2193945115510777421894
- 6 5 -1843.2831355005 -0.0000000014 0.000043029 0.000004214 2193944894310777422381
- 7 6 -1843.2831355012 -0.0000000007 0.000013974 0.000001654 2193944769910777422655
- 8 7 -1843.2831355008 0.0000000004 0.000010141 0.000003306 2193944743110777422770
- 9 8 -1843.2831355012 -0.0000000004 0.000014131 0.000001722 2193944703110777422832
- 10 9 -1843.2831355012 -0.0000000001 0.000013286 0.000001411 2193944612910777422949
- 11 10 -1843.2831355013 -0.0000000001 0.000004101 0.000000793 2193944530810777423034
- 12 11 -1843.2831355013 0.0000000000 0.000007330 0.000000671 2193944506410777423072
- 13 12 -1843.2831355013 -0.0000000000 0.000001489 0.000000591 2193944470610777423118
- 14 13 -1843.2831355013 0.0000000000 0.000005537 0.000000944 2193944503710777423108
- 15 14 -1843.2831355012 0.0000000001 0.000006524 0.000001680 2193944509210777423084
- 16 15 -1843.2831355013 -0.0000000001 0.000000745 0.000000180 2193944511910777423067
- 17 16 -1843.2831355013 -0.0000000000 0.000000127 0.000000014 2193944505710777423069
- -----------------
- DENSITY CONVERGED
- -----------------
复制代码 Many people who want to perform spin-flip calculations encountered such problem and solve it successfully by using this trick. Maybe you can, or you have solved this problem by using other techniques, but I want to remind you that this molecule has two different ROKS solutions
- converged SCF energy = -1843.27474917186
- converged SCF energy = -1843.28312805381
复制代码 This 1st solution is energetically higher and not stable (which means it is a saddle point in the wave function parameter space), while the 2nd solution is stable and energetically favorable.
By the way, if you did not use MOKIT and PySCF before, but now are williing to have a try, you can simply run
- conda create -n mokit-py39 python=3.9
- conda activate mokit-py39
- conda install mokit -c mokit
- pip install pyscf
- conda deactivate
复制代码 to install both MOKIT and PySCF. For further installation guide, please click here. For more utilities/modules to transform MOs among QC packages, you can read the following tutorials
《利用MOKIT从PySCF向其他量化程序传轨道》,《利用MOKIT从Gaussian向其他量化程序传轨道》,《利用MOKIT从ORCA向其他量化程序传轨道》
|
|