def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) cls.model_krks = model_krks = KRKS(cell, k) model_krks.kernel() cls.td_model_rks_supercell = kproxy_supercell.TDProxy(model_krks, "dft", [cls.k, 1, 1], KRKS) cls.td_model_rks_supercell.kernel() cls.ref_m_supercell = cls.td_model_rks_supercell.eri.tdhf_full_form()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.kernel() cls.td_model_krhf = td_model_krhf = KTDHF(model_krhf) td_model_krhf.kernel() cls.ref_m = retrieve_m(td_model_krhf) cls.ref_e = td_model_krhf.e
def setUpModule(): global cell, cell1 cell = Cell().build(a=np.eye(3) * 1.8, atom='''He 0. 0. 0. He 0.4917 0.4917 0.4917''', basis={'He': [[0, [2.5, 1]]]}) cell1 = Cell().build( a=np.eye(3) * 2.6, atom='''He 0.4917 0.4917 0.4917''', basis={ 'He': [ [0, [4.8, 1, -.1], [1.1, .3, .5], [0.15, .2, .8]], [1, [0.8, 1]], ] })
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = 'sto-3g' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() # model_krhf.with_df._cderi_to_save = cls.df_file model_krhf.with_df._cderi = cls.df_file model_krhf.conv_tol = 1e-14 model_krhf.kernel() cls.td_model_krhf = model_ktd = ktd.TDRHF(model_krhf) model_ktd.nroots = 5 model_ktd.kernel()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.kernel() # Gamma cls.td_model_rhf_gamma = gtd.TDRHF(model_krhf) cls.td_model_rhf_gamma.kernel() cls.ref_m_gamma = cls.td_model_rhf_gamma.eri.tdhf_full_form() # Supercell cls.td_model_rhf_supercell = std.TDRHF(model_krhf) cls.td_model_rhf_supercell.kernel() cls.ref_m_supercell = cls.td_model_rhf_supercell.eri.tdhf_full_form()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() cls.model_rhf = model_rhf = RHF(cell) model_rhf.kernel() cls.td_model_rhf = td_model_rhf = TDHF(model_rhf) td_model_rhf.nroots = 5 td_model_rhf.kernel() cls.ref_m_rhf = retrieve_m(td_model_rhf)
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() # The slow supercell KTDHF cls.td_model_krhf = td_model_krhf = krhf_slow.TDRHF(model_krhf) td_model_krhf.kernel() cls.ref_m = tuple(td_model_krhf.eri.tdhf_full_form(i) for i in range(cls.k))
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # The Gamma-point reference cls.model_rks = model_rks = KRKS(super_cell(cell, [cls.k, 1, 1])) model_rks.conv_tol = 1e-14 model_rks.kernel() # K-points cls.model_krks = model_krks = KRKS(cell, k) model_krks.conv_tol = 1e-14 model_krks.kernel() adjust_mf_phase(model_rks, model_krks) ke = numpy.concatenate(model_krks.mo_energy) ke.sort() # Make sure mo energies are the same testing.assert_allclose(model_rks.mo_energy[0], ke) # TD cls.td_model_rks = td_model_rks = tdp.TDProxy(model_rks, "dft") td_model_rks.kernel() cls.td_model_krks = td_model_krks = ktdp.TDProxy(model_krks, "dft", [cls.k, 1, 1], KRKS) td_model_krks.kernel() # GW cls.gw = gw.GW(td_model_rks, td.TDRHF(model_rks).ao2mo()) cls.kgw = kgw.GW(td_model_krks, ktd.TDRHF(model_krks).ao2mo()) cls.order_k, cls.order_p, cls.order = ov_order_supercell(cls.kgw.imds) orbs = [] for k in range(cls.k): for o in numpy.arange(2, 6): orbs.append(numpy.where(numpy.logical_and(cls.order_k == k, cls.order_p == o))[0][0]) cls.gw.orbs = numpy.array(orbs) cls.kgw.orbs = numpy.arange(2, 6)
def setUpModule(): global cell cell = Cell() cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.685068664391 1.685068664391 1.685068664391 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 0 cell.build()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # The Gamma-point reference cls.model_rhf = model_rhf = RHF(super_cell(cell, [cls.k, 1, 1]), kpt=k[0]).density_fit() model_rhf.conv_tol = 1e-14 model_rhf.kernel() # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() adjust_mf_phase(model_rhf, model_krhf) ke = numpy.concatenate(model_krhf.mo_energy) ke.sort() # Make sure mo energies are the same testing.assert_allclose(model_rhf.mo_energy, ke) # Make sure no degeneracies are present testing.assert_array_less(1e-4, ke[1:] - ke[:-1]) cls.ov_order = ov_order(model_krhf) # The Gamma-point TD cls.td_model_rhf = td_model_rhf = td.TDRHF(model_rhf) td_model_rhf.kernel() cls.ref_m = td_model_rhf.eri.tdhf_full_form()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() ke = numpy.concatenate(model_krhf.mo_energy) ke.sort() # Make sure no degeneracies are present testing.assert_array_less(1e-4, ke[1:] - ke[:-1]) # TD cls.td_model_srhf = td_model_srhf = std.TDRHF(model_krhf) td_model_srhf.kernel() cls.td_model_krhf = td_model_krhf = ktd.TDRHF(model_krhf) td_model_krhf.kernel() # adjust_td_phase(td_model_srhf, td_model_krhf) # GW cls.gw = sgw.GW(td_model_srhf) cls.kgw = kgw.GW(td_model_krhf)
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.get_abs_kpts((.1, .2, .3)) # The Gamma-point reference cls.model_rhf = model_rhf = RHF(cell, k).density_fit() model_rhf.conv_tol = 1e-14 model_rhf.kernel() # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() adjust_mf_phase(model_rhf, model_krhf) testing.assert_allclose(model_rhf.mo_energy, model_krhf.mo_energy[0]) testing.assert_allclose(model_rhf.mo_coeff, model_krhf.mo_coeff[0]) # The Gamma-point TD cls.td_model_rhf = td_model_rhf = td.TDRHF(model_rhf) td_model_rhf.kernel() cls.ref_m = td_model_rhf.eri.tdhf_full_form()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.get_abs_kpts((.1, .2, .3)) cls.model_krks = model_krks = KRKS(cell, kpts=k).density_fit() model_krks.kernel()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # K-points cls.model_krks = model_krks = KRKS(cell, k) model_krks.conv_tol = 1e-14 model_krks.kernel() # TD cls.td_model_srks = td_model_srks = stdp.TDProxy( model_krks, "dft", [cls.k, 1, 1], KRKS) td_model_srks.kernel() cls.td_model_krks = td_model_krks = ktdp.TDProxy( model_krks, "dft", [cls.k, 1, 1], KRKS) td_model_krks.kernel() # GW cls.gw = sgw.GW(td_model_srks, std.TDRHF(model_krks).ao2mo()) cls.kgw = kgw.GW(td_model_krks, ktd.TDRHF(model_krks).ao2mo())
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # K-points cls.model_krks = model_krks = KRKS(cell, k) model_krks.conv_tol = 1e-14 model_krks.kernel() # Supercell reference cls.model_rks = model_rks = kproxy_supercell.k2s( model_krks, [cls.k, 1, 1], KRKS) # Ensure orbitals are real testing.assert_allclose(model_rks.mo_coeff[0].imag, 0, atol=1e-8) cls.ov_order = ov_order(model_krks) # The Gamma-point TD cls.td_model_rks = td_model_rks = KTDDFT(model_rks) td_model_rks.kernel()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'sto-3g' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel()
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1]) # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() # Add random phases numpy.random.seed(0) for i in model_krhf.mo_coeff: i *= numpy.exp(2.j * numpy.pi * numpy.random.rand(i.shape[1]))[numpy.newaxis, :] # The slow supercell KTDHF cls.td_model_krhf = td_model_krhf = krhf_slow_supercell.TDRHF( model_krhf) td_model_krhf.kernel() cls.ref_m = td_model_krhf.eri.tdhf_full_form()
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Author: Qiming Sun <*****@*****.**> # import unittest from pyscf import lib from pyscf.pbc.gto import Cell from pyscf.pbc.scf import RHF, KRHF from pyscf.pbc import tdscf cell = Cell() cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.685068664391 1.685068664391 1.685068664391 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 0 cell.build()
# Add ewald_exxdiv contribution because G=0 was not included in the # non-uniform grids if (exxdiv == 'ewald' and (cell.dimension < 2 or # 0D and 1D are computed with inf_vacuum (cell.dimension == 2 and cell.low_dim_ft_type == 'inf_vacuum'))): _ewald_exxdiv_for_G0(cell, kpts_band, dms, vk_kpts, kpts_band) return _format_jks(vk_kpts, dm_kpts, input_band, kpts) if __name__ == '__main__': from pyscf.pbc.gto import Cell cells = [] cell = Cell() cell.a = np.eye(3) * 1.8 cell.atom = '''#He 0. 0. 0. He 0.4917 0.4917 0.4917''' cell.basis = {'He': [[0, [2.5, 1]]]} cell.build() cells.append(cell) if 1: cell = Cell() cell.a = np.eye(3) * 2.4 cell.atom = '''He 0. 0. 0. He 0.4917 0.4917 0.4917''' cell.basis = { 'He': [ [0, [4.1, 1, -.2], [0.5, .2, .5], [0.15, .5, .5]],
from pyscf.pbc.gto import Cell from pyscf.pbc.scf import KRHF from pyscf.pbc.tdscf.krhf_slow import TDRHF from pyscf.pbc.gw import KRGW cell = Cell() cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 7 cell.build() model = KRHF(cell, cell.make_kpts([2, 1, 1])) model.kernel() model_td = TDRHF(model) model_td.kernel() model_gw = KRGW(model_td) model_gw.kernel() print(model_gw.mo_energy)
def setUpClass(cls): cls.cell = cell = Cell() # Lift some degeneracies cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} # cell.basis = 'gth-dzvp' cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 5 cell.build() k = cell.make_kpts([cls.k, 1, 1], scaled_center=cls.k_c) # The Gamma-point reference cls.model_rhf = model_rhf = RHF(super_cell(cell, [cls.k, 1, 1]), kpt=k[0]).density_fit() model_rhf.conv_tol = 1e-14 model_rhf.kernel() # K-points cls.model_krhf = model_krhf = KRHF(cell, k).density_fit() model_krhf.conv_tol = 1e-14 model_krhf.kernel() adjust_mf_phase(model_rhf, model_krhf) ke = numpy.concatenate(model_krhf.mo_energy) ke.sort() # Make sure mo energies are the same testing.assert_allclose(model_rhf.mo_energy, ke) # Make sure no degeneracies are present testing.assert_array_less(1e-4, ke[1:] - ke[:-1]) # TD cls.td_model_rhf = td_model_rhf = td.TDRHF(model_rhf) td_model_rhf.kernel() cls.td_model_krhf = td_model_krhf = ktd.TDRHF(model_krhf) td_model_krhf.kernel() adjust_td_phase(td_model_rhf, td_model_krhf) # GW cls.gw = gw.GW(td_model_rhf) cls.kgw = kgw.GW(td_model_krhf) cls.order_k, cls.order_p, cls.order = ov_order_supercell(cls.kgw.imds) orbs = [] for k in range(cls.k): for o in numpy.arange(2, 6): orbs.append(numpy.where(numpy.logical_and(cls.order_k == k, cls.order_p == o))[0][0]) cls.gw.orbs = numpy.array(orbs) cls.kgw.orbs = numpy.arange(2, 6)