Skip to content

Commit

Permalink
correctly implemented other_rel_AO_per_edge_per_frag
Browse files Browse the repository at this point in the history
  • Loading branch information
mcocdawc committed Jan 28, 2025
1 parent 9a0313d commit c695d22
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/quemb/molbe/chemfrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,19 @@ class FragmentedMolecule:
#: in motif `i_motif`.
AO_per_motif_per_frag: Final[Sequence[Mapping[MotifIdx, Sequence[AOIdx]]]]

#: The relative atomic orbital indices per motif per fragment.
#: Relative means that the AO indices are relative to
#: the **own** fragment.
rel_AO_per_motif_per_frag: Final[Sequence[Mapping[MotifIdx, Sequence[OwnRelAOIdx]]]]

#: The relative atomic orbital indices per edge per fragment.
#: Relative means that the AO indices are relative to the **other**
#: fragment where the edge is a center.
#: This variable was formerly known as `center_idx`.
other_rel_AO_per_edge_per_frag: Final[
Sequence[Mapping[EdgeIdx, Sequence[OtherRelAOIdx]]]
]

@classmethod
def from_frag_structure(
cls, mol: Mole, frag_structure: FragmentedStructure
Expand Down Expand Up @@ -502,13 +513,31 @@ def from_frag_structure(
rel_AO_per_motif[motif] = [OwnRelAOIdx(AOIdx(i)) for i in indices]
rel_AO_per_motif_per_frag.append(rel_AO_per_motif)

other_rel_AO_per_edge_per_frag: list[
Mapping[EdgeIdx, Sequence[OtherRelAOIdx]]
] = [
{
i_edge: [
# We correctly reinterpet the AO indices as
# indices of the other fragment
cast(OtherRelAOIdx, i)
for i in rel_AO_per_motif_per_frag[frag_per_edge[i_edge]][i_edge]
]
for i_edge in edges
}
for edges, frag_per_edge in zip(
frag_structure.edges_per_frag, frag_structure.frag_idx_per_edge
)
]

return cls(
frag_structure,
mol,
AO_per_atom,
AO_per_frag,
AO_per_motif_per_frag,
rel_AO_per_motif_per_frag,
other_rel_AO_per_edge_per_frag,
)


Expand Down

0 comments on commit c695d22

Please sign in to comment.