Skip to content

Commit 900fc78

Browse files
authored
Pao (#180)
Correct errors in projected atomic orbitals - do not othogonalise before norm calculation - use absolute of eigenvalues for cutoff
1 parent 690ff4a commit 900fc78

File tree

3 files changed

+11
-89
lines changed

3 files changed

+11
-89
lines changed

docs/jupyter_execute/notebooks/localization.ipynb

Lines changed: 1 addition & 75 deletions
Large diffs are not rendered by default.

nbed/localizers/system.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
class LocalizedSystem:
1010
"""Required data from localized system.
1111
12-
Args:
13-
active_mo_inds (np.array): 1D array of active occupied MO indices.
14-
enviro_mo_inds (np.array): 1D array of environment occupied MO indices.
15-
c_active (np.array): C matrix of localized occupied active MOs (columns define MOs).
16-
c_enviro (np.array): C matrix of localized occupied ennironment MOs.
17-
c_loc_occ (np.array): C matrix of localized occupied MOs.
18-
c_loc_virt (np.array | None): C matrix of localized virual MOs.
19-
dm_active (np.array): active system density matrix.
20-
dm_enviro (np.array): environment system density matrix.
12+
active_mo_inds (np.array): 1D array of active occupied MO indices
13+
enviro_mo_inds (np.array): 1D array of environment occupied MO indices
14+
c_active (np.array): C matrix of localized occupied active MOs (columns define MOs)
15+
c_enviro (np.array): C matrix of localized occupied ennironment MOs
16+
c_loc_occ (np.array): C matrix of localized occupied MOs
17+
c_loc_virt (np.array | None): C matrix of localized virual MOs.
18+
dm_active (np.array): active system density matrix
19+
dm_enviro (np.array): environment system density matrix
2120
"""
2221

2322
active_mo_inds: NDArray

nbed/localizers/virtual/projected_atomic.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import numpy as np
66
from numpy.typing import NDArray
77
from pyscf.lib import StreamObject
8-
from scipy.linalg import fractional_matrix_power
98

109
from nbed.localizers.virtual.base import VirtualLocalizer
1110

@@ -106,9 +105,7 @@ def _localize_virtual_spin_pao(
106105
# Take the columns of C matrix (MOs)
107106
truncated_paos = pao_projector[:, np.abs(pao_norms) > norm_cutoff]
108107

109-
s_half = fractional_matrix_power(ao_overlap, 0.5)
110-
111-
renormalized_paos = s_half @ truncated_paos
108+
renormalized_paos = truncated_paos
112109
renormalized_paos = renormalized_paos / np.sqrt(
113110
np.einsum("ij,ij->j", renormalized_paos, renormalized_paos)
114111
)
@@ -121,7 +118,7 @@ def _localize_virtual_spin_pao(
121118

122119
logger.debug(f"{eigvecs.shape=}")
123120
# How to transform the truncated paos?
124-
final_paos = renormalized_paos[:, eigvals > overlap_cutoff]
121+
final_paos = renormalized_paos[:, np.abs(eigvals) > overlap_cutoff]
125122
logger.debug(f"{final_paos.shape=}")
126123

127124
if (n_paos := final_paos.shape[-1]) == 0:

0 commit comments

Comments
 (0)