Skip to content

Commit

Permalink
Fix a test pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede committed Jan 7, 2025
1 parent d1351e3 commit 304b762
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/dxtb/_src/calculators/types/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,21 @@ def _gradfcn(pos: Tensor) -> Tensor:
)
logger.debug("Hessian (numerical): Starting build (%s).", deriv.shape)

# copy here to avoid test pollution
_positions = positions.clone().detach()

count = 1
nsteps = 3 * self.numbers.shape[-1]
for i in range(self.numbers.shape[-1]):
for j in range(3):
with OutputHandler.with_verbosity(0):
positions[..., i, j] += step_size
gr = _gradfcn(positions)
_positions[..., i, j] += step_size
gr = _gradfcn(_positions)

positions[..., i, j] -= 2 * step_size
gl = _gradfcn(positions)
_positions[..., i, j] -= 2 * step_size
gl = _gradfcn(_positions)

positions[..., i, j] += step_size
_positions[..., i, j] += step_size
deriv[..., :, :, i, j] = 0.5 * (gr - gl) / step_size

logger.debug("Hessian (numerical): step %s/%s", count, nsteps)
Expand Down
1 change: 0 additions & 1 deletion src/dxtb/_src/integral/driver/libcint/overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,5 @@ def fcn(driver: libcint.LibcintWrapper) -> Tensor:
"driver instance itself seems to be batched."
)

print("aksdjkasd")
self.gradient = fcn(driver.drv)
return self.gradient

0 comments on commit 304b762

Please sign in to comment.