From 891d0ffa84c45a52e1f690f25e36c2ae8a768650 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 21 Nov 2024 15:42:46 -0500 Subject: [PATCH 1/5] rebased onto main --- src/kbe/lo_k.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/kbe/lo_k.py b/src/kbe/lo_k.py index 454d67da..68d1133a 100644 --- a/src/kbe/lo_k.py +++ b/src/kbe/lo_k.py @@ -162,7 +162,6 @@ def get_pao_k(Ciao, S, S12, S2): Return: Cpao (orthogonalized) """ - nk, nao, niao = Ciao.shape unused(niao) Cpao = [] From 3f2f6586c1a6ea47eb9159f906603ab4e96bd047 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 21 Nov 2024 15:57:27 -0500 Subject: [PATCH 2/5] explicitly ignore parts of a tuple upon multiple return values --- src/molbe/ube.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/molbe/ube.py b/src/molbe/ube.py index b622e822..4afe032a 100644 --- a/src/molbe/ube.py +++ b/src/molbe/ube.py @@ -324,7 +324,7 @@ def initialize(self, eri_, compute_hf): ) if compute_hf: - eh1_a, ecoul_a, ef_a = fobj_a.energy_hf( + eh1_a, ecoul_a, _ = fobj_a.energy_hf( return_e1=True, unrestricted=True, spin_ind=0 ) unused(ef_a) @@ -347,7 +347,7 @@ def initialize(self, eri_, compute_hf): ) if compute_hf: - eh1_b, ecoul_b, ef_b = fobj_b.energy_hf( + eh1_b, ecoul_b, _ = fobj_b.energy_hf( return_e1=True, unrestricted=True, spin_ind=1 ) unused(ef_b) @@ -417,7 +417,7 @@ def oneshot( self, solver="UCCSD", nproc=1, ompnum=4, calc_frag_energy=False, clean_eri=False ): if nproc == 1: - E, E_comp = be_func_u( + E, _ = be_func_u( None, zip(self.Fobjs_a, self.Fobjs_b), solver, @@ -430,7 +430,7 @@ def oneshot( frozen=self.frozen_core, ) else: - E, E_comp = be_func_parallel_u( + E, _ = be_func_parallel_u( None, zip(self.Fobjs_a, self.Fobjs_b), solver, From e0f4a72b1510655c16a1bb0bc2ad05ce5a2357ae Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 21 Nov 2024 16:03:18 -0500 Subject: [PATCH 3/5] manual reformatting --- src/kbe/misc.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/kbe/misc.py b/src/kbe/misc.py index d2038a56..6b4c804d 100644 --- a/src/kbe/misc.py +++ b/src/kbe/misc.py @@ -1,7 +1,8 @@ # Author(s): Oinam Romesh Meitei -import numpy -from pyscf import lib +import numpy as np +from numpy import arange +from pyscf.lib import cartesian_prod from pyscf.pbc import tools @@ -21,26 +22,15 @@ def sgeom(cell, kmesh=None): def get_phase(cell, kpts, kmesh): a_vec = cell.lattice_vectors() - Ts = lib.cartesian_prod( - (numpy.arange(kmesh[0]), numpy.arange(kmesh[1]), numpy.arange(kmesh[2])) - ) - Rs = numpy.dot(Ts, a_vec) - - tmp_ = numpy.dot(Rs, kpts.T) - - NRs = Rs.shape[0] - phase = 1 / numpy.sqrt(NRs) * numpy.exp(1j * numpy.dot(Rs, kpts.T)) - - return phase + Ts = cartesian_prod((arange(kmesh[0]), arange(kmesh[1]), arange(kmesh[2]))) + NRs = Ts.shape[0] + return 1 / np.sqrt(NRs) * np.exp(1j * (Ts @ a_vec @ kpts.T)) def get_phase1(cell, kpts, kmesh): a_vec = cell.lattice_vectors() - Ts = lib.cartesian_prod( - (numpy.arange(kmesh[0]), numpy.arange(kmesh[1]), numpy.arange(kmesh[2])) - ) - - return numpy.exp(-1.0j * (Ts @ a_vec @ kpts.T)) + Ts = cartesian_prod((arange(kmesh[0]), arange(kmesh[1]), arange(kmesh[2]))) + return np.exp(-1.0j * (Ts @ a_vec @ kpts.T)) class storePBE: From 3f67cc05b76b788c93d142712ddc093b8ea1887b Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 21 Nov 2024 17:46:52 -0500 Subject: [PATCH 4/5] import the used functions explicitly --- src/kbe/misc.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/kbe/misc.py b/src/kbe/misc.py index 6b4c804d..2ba8d1b4 100644 --- a/src/kbe/misc.py +++ b/src/kbe/misc.py @@ -1,7 +1,6 @@ # Author(s): Oinam Romesh Meitei -import numpy as np -from numpy import arange +from numpy import arange, exp, sqrt from pyscf.lib import cartesian_prod from pyscf.pbc import tools @@ -24,13 +23,13 @@ def get_phase(cell, kpts, kmesh): a_vec = cell.lattice_vectors() Ts = cartesian_prod((arange(kmesh[0]), arange(kmesh[1]), arange(kmesh[2]))) NRs = Ts.shape[0] - return 1 / np.sqrt(NRs) * np.exp(1j * (Ts @ a_vec @ kpts.T)) + return 1 / sqrt(NRs) * exp(1j * (Ts @ a_vec @ kpts.T)) def get_phase1(cell, kpts, kmesh): a_vec = cell.lattice_vectors() Ts = cartesian_prod((arange(kmesh[0]), arange(kmesh[1]), arange(kmesh[2]))) - return np.exp(-1.0j * (Ts @ a_vec @ kpts.T)) + return exp(-1.0j * (Ts @ a_vec @ kpts.T)) class storePBE: From 00d0846cc098fbac25ac34947f34069ce55f550d Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Fri, 22 Nov 2024 18:26:31 -0500 Subject: [PATCH 5/5] cleaned up after rebase --- src/molbe/ube.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/molbe/ube.py b/src/molbe/ube.py index 4afe032a..b622e822 100644 --- a/src/molbe/ube.py +++ b/src/molbe/ube.py @@ -324,7 +324,7 @@ def initialize(self, eri_, compute_hf): ) if compute_hf: - eh1_a, ecoul_a, _ = fobj_a.energy_hf( + eh1_a, ecoul_a, ef_a = fobj_a.energy_hf( return_e1=True, unrestricted=True, spin_ind=0 ) unused(ef_a) @@ -347,7 +347,7 @@ def initialize(self, eri_, compute_hf): ) if compute_hf: - eh1_b, ecoul_b, _ = fobj_b.energy_hf( + eh1_b, ecoul_b, ef_b = fobj_b.energy_hf( return_e1=True, unrestricted=True, spin_ind=1 ) unused(ef_b) @@ -417,7 +417,7 @@ def oneshot( self, solver="UCCSD", nproc=1, ompnum=4, calc_frag_energy=False, clean_eri=False ): if nproc == 1: - E, _ = be_func_u( + E, E_comp = be_func_u( None, zip(self.Fobjs_a, self.Fobjs_b), solver, @@ -430,7 +430,7 @@ def oneshot( frozen=self.frozen_core, ) else: - E, _ = be_func_parallel_u( + E, E_comp = be_func_parallel_u( None, zip(self.Fobjs_a, self.Fobjs_b), solver,