|
| 1 | +import os |
| 2 | + |
| 3 | +from pyscf.pbc import df, dft, gto, lib |
| 4 | + |
| 5 | +# For ppRPA excitation energy of N-electron system in particle-particle channel |
| 6 | +# mean field is (N-2)-electron |
| 7 | + |
| 8 | +# carbon vacancy in diamond |
| 9 | +# see Table.1 in https://doi.org/10.1021/acs.jctc.4c00829 |
| 10 | +cell = gto.Cell() |
| 11 | +cell.build(unit='angstrom', |
| 12 | + a=[[7.136000, 0.000000, 0.000000], |
| 13 | + [0.000000, 7.136000, 0.000000], |
| 14 | + [0.000000, 0.000000, 7.136000]], |
| 15 | + atom=[ |
| 16 | + ["C", (0.001233209267, 0.001233209267, 1.777383281725)], |
| 17 | + ["C", (0.012225089066, 1.794731051862, 3.561871956432)], |
| 18 | + ["C", (1.782392880032, 1.782392880032, 5.362763822515)], |
| 19 | + ["C", (1.780552680464, -0.013167298675, -0.008776569968)], |
| 20 | + ["C", (3.557268948138, 0.012225089066, 1.790128043568)], |
| 21 | + ["C", (5.339774910934, 1.794731051862, 1.790128043568)], |
| 22 | + ["C", (-0.013167298675, 1.780552680464, -0.008776569968)], |
| 23 | + ["C", (1.782392880032, 3.569607119968, -0.010763822515)], |
| 24 | + ["C", (1.794731051862, 5.339774910934, 1.790128043568)], |
| 25 | + ["C", (2.671194343578, 0.900046784093, 0.881569117555)], |
| 26 | + ["C", (0.887735886768, 0.887735886768, 6.244403380954)], |
| 27 | + ["C", (0.900046784093, 2.680805656422, 4.470430882445)], |
| 28 | + ["C", (2.680805656422, 4.451953215907, 0.881569117555)], |
| 29 | + ["C", (0.895786995277, 6.238213500378, 0.896853305635)], |
| 30 | + ["C", (0.930821705350, 0.930821705350, 2.673641624787)], |
| 31 | + ["C", (4.421178294650, 0.930821705350, 2.678358375213)], |
| 32 | + ["C", (0.900046784093, 2.671194343578, 0.881569117555)], |
| 33 | + ["C", (6.238213500378, 0.895786995277, 0.896853305635)], |
| 34 | + ["C", (2.680805656422, 0.900046784093, 4.470430882445)], |
| 35 | + ["C", (4.451953215907, 2.680805656422, 0.881569117555)], |
| 36 | + ["C", (0.930821705350, 4.421178294650, 2.678358375213)], |
| 37 | + ["C", (1.794731051862, 0.012225089066, 3.561871956432)], |
| 38 | + ["C", (0.012225089066, 3.557268948138, 1.790128043568)], |
| 39 | + ["C", (3.569607119968, 1.782392880032, -0.010763822515)], |
| 40 | + ["C", (1.736746319267, 1.736746319267, 1.671367479693)], |
| 41 | + ["C", (5.351404126874, 0.000595873126, 0.004129648157)], |
| 42 | + ["C", (0.000595873126, 5.351404126874, 0.004129648157)], |
| 43 | + ["C", (2.676000000000, 2.676000000000, 6.244000000000)], |
| 44 | + ["C", (6.244000000000, 2.676000000000, 2.676000000000)], |
| 45 | + ["C", (2.676000000000, 6.244000000000, 2.676000000000)], |
| 46 | + ["C", (0.000595873126, 0.000595873126, 5.347870351843)], |
| 47 | + ["C", (0.001233209267, 5.350766790733, 3.574616718275)], |
| 48 | + ["C", (1.780552680464, 5.365167298675, 5.360776569968)], |
| 49 | + ["C", (3.571447319536, -0.013167298675, 5.360776569968)], |
| 50 | + ["C", (5.365167298675, 1.780552680464, 5.360776569968)], |
| 51 | + ["C", (5.365167298675, 3.571447319536, -0.008776569968)], |
| 52 | + ["C", (5.350766790733, 5.350766790733, 1.777383281725)], |
| 53 | + ["C", (4.464264113232, 0.887735886768, 6.243596619046)], |
| 54 | + ["C", (4.451953215907, 2.671194343578, 4.470430882445)], |
| 55 | + ["C", (2.671194343578, 4.451953215907, 4.470430882445)], |
| 56 | + ["C", (0.895786995277, 6.249786499622, 4.455146694365)], |
| 57 | + ["C", (4.421178294650, 4.421178294650, 2.673641624787)], |
| 58 | + ["C", (6.249786499622, 4.456213004723, 0.896853305635)], |
| 59 | + ["C", (0.887735886768, 4.464264113232, 6.243596619046)], |
| 60 | + ["C", (6.249786499622, 0.895786995277, 4.455146694365)], |
| 61 | + ["C", (4.456213004723, 6.249786499622, 0.896853305635)], |
| 62 | + ["C", (5.350766790733, 0.001233209267, 3.574616718275)], |
| 63 | + ["C", (-0.013167298675, 3.571447319536, 5.360776569968)], |
| 64 | + ["C", (3.571447319536, 5.365167298675, -0.008776569968)], |
| 65 | + ["C", (3.615253680733, 1.736746319267, 3.680632520307)], |
| 66 | + ["C", (3.615253680733, 3.615253680733, 1.671367479693)], |
| 67 | + ["C", (6.244000000000, 2.676000000000, 6.244000000000)], |
| 68 | + ["C", (6.244000000000, 6.244000000000, 2.676000000000)], |
| 69 | + ["C", (1.736746319267, 3.615253680733, 3.680632520307)], |
| 70 | + ["C", (2.676000000000, 6.244000000000, 6.244000000000)], |
| 71 | + ["C", (3.557268948138, 5.339774910934, 3.561871956432)], |
| 72 | + ["C", (5.351404126874, 5.351404126874, 5.347870351843)], |
| 73 | + ["C", (3.569607119968, 3.569607119968, 5.362763822515)], |
| 74 | + ["C", (5.339774910934, 3.557268948138, 3.561871956432)], |
| 75 | + ["C", (4.464264113232, 4.464264113232, 6.244403380954)], |
| 76 | + ["C", (4.456213004723, 6.238213500378, 4.455146694365)], |
| 77 | + ["C", (6.238213500378, 4.456213004723, 4.455146694365)], |
| 78 | + ["C", (6.244000000000, 6.244000000000, 6.244000000000)], |
| 79 | + ], |
| 80 | + dimension=3, |
| 81 | + max_memory=90000, |
| 82 | + verbose=5, |
| 83 | + basis='cc-pvdz', |
| 84 | + # create a (N-2)-electron system |
| 85 | + charge=2, |
| 86 | + precision=1e-12) |
| 87 | + |
| 88 | +gdf = df.RSDF(cell) |
| 89 | +gdf.auxbasis = "cc-pvdz-ri" |
| 90 | +gdf_fname = 'gdf_ints.h5' |
| 91 | +gdf._cderi_to_save = gdf_fname |
| 92 | +if not os.path.isfile(gdf_fname): |
| 93 | + gdf.build() |
| 94 | + |
| 95 | +# =====> Part I. Restricted ppRPA <===== |
| 96 | +# After SCF, PySCF might fail in Makov-Payne correction |
| 97 | +# save chkfile to restart |
| 98 | +chkfname = 'scf.chk' |
| 99 | +if os.path.isfile(chkfname): |
| 100 | + kmf = dft.RKS(cell).rs_density_fit() |
| 101 | + kmf.xc = "b3lyp" |
| 102 | + kmf.exxdiv = None |
| 103 | + kmf.with_df = gdf |
| 104 | + kmf.with_df._cderi = gdf_fname |
| 105 | + data = lib.chkfile.load(chkfname, 'scf') |
| 106 | + kmf.__dict__.update(data) |
| 107 | +else: |
| 108 | + kmf = dft.RKS(cell).rs_density_fit() |
| 109 | + kmf.xc = "b3lyp" |
| 110 | + kmf.exxdiv = None |
| 111 | + kmf.with_df = gdf |
| 112 | + kmf.with_df._cderi = gdf_fname |
| 113 | + kmf.chkfile = chkfname |
| 114 | + kmf.kernel() |
| 115 | + |
| 116 | +# direct diagonalization, N6 scaling |
| 117 | +# ppRPA can be solved in an active space |
| 118 | +from pyscf.pprpa.rpprpa_direct import RppRPADirect |
| 119 | +pp = RppRPADirect(kmf, nocc_act=50, nvir_act=50) |
| 120 | +# number of two-electron addition states to print |
| 121 | +pp.pp_state = 50 |
| 122 | +# solve for singlet states |
| 123 | +pp.kernel("s") |
| 124 | +# solve for triplet states |
| 125 | +pp.kernel("t") |
| 126 | +pp.analyze() |
| 127 | + |
| 128 | +# Davidson algorithm, N4 scaling |
| 129 | +# ppRPA can be solved in an active space |
| 130 | +from pyscf.pprpa.rpprpa_davidson import RppRPADavidson |
| 131 | +pp = RppRPADavidson(kmf, nocc_act=50, nvir_act=50, nroot=50) |
| 132 | +# solve for singlet states |
| 133 | +pp.kernel("s") |
| 134 | +# solve for triplet states |
| 135 | +pp.kernel("t") |
| 136 | +pp.analyze() |
| 137 | + |
| 138 | +# =====> Part II. Unrestricted ppRPA <===== |
| 139 | +chkfname = 'uscf.chk' |
| 140 | +if os.path.isfile(chkfname): |
| 141 | + kmf = dft.UKS(cell).rs_density_fit() |
| 142 | + kmf.xc = "b3lyp" |
| 143 | + kmf.exxdiv = None |
| 144 | + kmf.with_df = gdf |
| 145 | + kmf.with_df._cderi = gdf_fname |
| 146 | + data = lib.chkfile.load(chkfname, 'scf') |
| 147 | + kmf.__dict__.update(data) |
| 148 | +else: |
| 149 | + kmf = dft.UKS(cell).rs_density_fit() |
| 150 | + kmf.xc = "b3lyp" |
| 151 | + kmf.exxdiv = None |
| 152 | + kmf.with_df = gdf |
| 153 | + kmf.with_df._cderi = gdf_fname |
| 154 | + kmf.chkfile = chkfname |
| 155 | + kmf.kernel() |
| 156 | + |
| 157 | +# direct diagonalization, N6 scaling |
| 158 | +# ppRPA can be solved in an active space |
| 159 | +from pyscf.pprpa.upprpa_direct import UppRPADirect |
| 160 | +pp = UppRPADirect(kmf, nocc_act=50, nvir_act=50) |
| 161 | +# number of two-electron addition states to print |
| 162 | +pp.pp_state = 50 |
| 163 | +# solve ppRPA |
| 164 | +pp.kernel() |
| 165 | +pp.analyze() |
| 166 | + |
0 commit comments