Skip to content

Commit

Permalink
Make rcut argument of build_random_cell mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
tovrstra committed Oct 7, 2024
1 parent 8fa7cf9 commit 7dc5b47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Changed

- Add `rcut` option to `build_random_cell`.
- Add mandatory `rcut` option to `build_random_cell`.


## [0.1.0] - 2024-10-06
Expand Down
4 changes: 1 addition & 3 deletions src/tinyff/atomsmithy.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def __call__(self, dist: ArrayLike) -> tuple[NDArray, NDArray]:
def build_random_cell(
cell_length: float,
natom: int,
rcut: float,
*,
rcut: float | None = None,
maxiter: int = 100,
rng: np.random.Generator | None = None,
):
Expand All @@ -109,8 +109,6 @@ def build_random_cell(
atpos0 = rng.uniform(0, cell_length, (natom, 3))

# Define cost function to push the atoms appart.
if rcut is None:
rcut = 0.49 * cell_length
pwff = PairwiseForceField(PushPotential(rcut), rcut)

def costgrad(atpos_raveled):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_atomsmithy.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ def test_push_cutoff():

def test_random_box():
rng = np.random.default_rng(42)
atpos = build_random_cell(10.0, 32, rng=rng)
atpos = build_random_cell(10.0, 32, 3.0, rng=rng)
nlist = build_nlist_simple(atpos, [10.0, 10.0, 10.0], rcut=4.0)
assert nlist["dist"].min() > 2.0

0 comments on commit 7dc5b47

Please sign in to comment.