Skip to content
Merged

Pao #180

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 1 addition & 75 deletions docs/jupyter_execute/notebooks/localization.ipynb

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions nbed/localizers/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
class LocalizedSystem:
"""Required data from localized system.

Args:
active_mo_inds (np.array): 1D array of active occupied MO indices.
enviro_mo_inds (np.array): 1D array of environment occupied MO indices.
c_active (np.array): C matrix of localized occupied active MOs (columns define MOs).
c_enviro (np.array): C matrix of localized occupied ennironment MOs.
c_loc_occ (np.array): C matrix of localized occupied MOs.
c_loc_virt (np.array | None): C matrix of localized virual MOs.
dm_active (np.array): active system density matrix.
dm_enviro (np.array): environment system density matrix.
active_mo_inds (np.array): 1D array of active occupied MO indices
enviro_mo_inds (np.array): 1D array of environment occupied MO indices
c_active (np.array): C matrix of localized occupied active MOs (columns define MOs)
c_enviro (np.array): C matrix of localized occupied ennironment MOs
c_loc_occ (np.array): C matrix of localized occupied MOs
c_loc_virt (np.array | None): C matrix of localized virual MOs.
dm_active (np.array): active system density matrix
dm_enviro (np.array): environment system density matrix
"""

active_mo_inds: NDArray
Expand Down
7 changes: 2 additions & 5 deletions nbed/localizers/virtual/projected_atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
from numpy.typing import NDArray
from pyscf.lib import StreamObject
from scipy.linalg import fractional_matrix_power

from nbed.localizers.virtual.base import VirtualLocalizer

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

s_half = fractional_matrix_power(ao_overlap, 0.5)

renormalized_paos = s_half @ truncated_paos
renormalized_paos = truncated_paos
renormalized_paos = renormalized_paos / np.sqrt(
np.einsum("ij,ij->j", renormalized_paos, renormalized_paos)
)
Expand All @@ -121,7 +118,7 @@ def _localize_virtual_spin_pao(

logger.debug(f"{eigvecs.shape=}")
# How to transform the truncated paos?
final_paos = renormalized_paos[:, eigvals > overlap_cutoff]
final_paos = renormalized_paos[:, np.abs(eigvals) > overlap_cutoff]
logger.debug(f"{final_paos.shape=}")

if (n_paos := final_paos.shape[-1]) == 0:
Expand Down
Loading