def test_class(self): """Tests container behavior.""" model = kproxy_supercell.TDProxy(self.model_krks, "dft", [1, 1, 1], density_fitting_ks) # Shifted k-point grid is not TRS: an exception should be raised with self.assertRaises(RuntimeError): model.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]) 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]) # 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 test_class(self): """Tests container behavior.""" model = kproxy_supercell.TDProxy(self.model_krks, "dft", [1, 1, 1], KRKS) model.nroots = self.td_model_krks.nroots assert not model.fast model.kernel() testing.assert_allclose(model.e, self.td_model_krks.e, atol=1e-5) assert_vectors_close(model.xy, numpy.array(self.td_model_krks.xy), atol=1e-12)
def test_class(self): """Tests container behavior.""" model = kproxy_supercell.TDProxy(self.model_krhf, "hf", [1, 1, 1], density_fitting_hf) model.nroots = self.td_model_krhf.nroots assert not model.fast model.kernel() testing.assert_allclose(model.e, self.td_model_krhf.e, atol=1e-5) assert_vectors_close(model.xy, numpy.array(self.td_model_krhf.xy), atol=1e-12)
def test_class(self): """Tests container behavior.""" model = kproxy_supercell.TDProxy(self.model_krks, "dft", [self.k, 1, 1], KRKS) model.nroots = self.td_model_rks.nroots assert not model.fast model.kernel() testing.assert_allclose(model.e, self.td_model_rks.e, atol=1e-5) if self.k == 2: vecs = model.xy.reshape(len(model.xy), -1)[:, self.ov_order] # A loose tolerance here because of a low plane-wave cutoff assert_vectors_close(vecs, numpy.array(self.td_model_rks.xy).squeeze(), atol=1e-3) # Test real testing.assert_allclose(model.e.imag, 0, atol=1e-8)
def test_class(self): """Tests container behavior.""" model = kproxy_supercell.TDProxy(self.model_krhf, "hf", [self.k, 1, 1], density_fitting_hf) model.nroots = self.td_model_krhf.nroots assert not model.fast model.kernel() testing.assert_allclose(model.e, self.td_model_krhf.e, atol=1e-5) # Test real testing.assert_allclose(model.e.imag, 0, atol=1e-8) nocc = nvirt = 4 testing.assert_equal(model.xy.shape, (len(model.e), 2, self.k, self.k, nocc, nvirt)) # Test only non-degenerate roots d = abs(model.e[1:] - model.e[:-1]) < 1e-8 d = numpy.logical_or(numpy.concatenate(([False], d)), numpy.concatenate((d, [False]))) d = numpy.logical_not(d) assert_vectors_close(self.td_model_krhf.xy[d], model.xy[d], atol=1e-5)
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())