Skip to content

Commit 0f5d3ad

Browse files
committed
species/vectors: drop converter import, inline get_vector
The previous commit changed zmat.py to a module-style import of vectors but the structural cycle (zmat -> vectors -> converter -> zmat) remained, so CodeQL kept flagging both edges. vectors.py only used converter in get_vector, where it called xyz_to_x_y_z(xyz) (O(N) per-axis split + check_xyz_dict validation) just to read two atoms' coordinates. Inline the two coord lookups directly and drop the module-level converter import. The cycle is now fully broken at the import-graph level.
1 parent f07d1f2 commit 0f5d3ad

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

arc/species/vectors.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from arc.common import logger
1010
from arc.exceptions import VectorsError
1111
from arc.molecule.molecule import Molecule
12-
from arc.species import converter
1312

1413

1514
def get_normal(v1: List[float],
@@ -361,11 +360,9 @@ def get_vector(pivot: int,
361360
Returns: list
362361
A vector pointing from the pivotal atom towards the anchor atom.
363362
"""
364-
x, y, z = converter.xyz_to_x_y_z(xyz)
365-
dx = x[anchor] - x[pivot]
366-
dy = y[anchor] - y[pivot]
367-
dz = z[anchor] - z[pivot]
368-
return [dx, dy, dz]
363+
px, py, pz = xyz['coords'][pivot]
364+
ax, ay, az = xyz['coords'][anchor]
365+
return [ax - px, ay - py, az - pz]
369366

370367

371368
def get_lp_vector(label: str,

0 commit comments

Comments
 (0)