Skip to content

Commit

Permalink
Scale scaling constants by number of atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
WardLT committed Dec 25, 2023
1 parent 725db57 commit b8e4beb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jitterbug/model/dscribe/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,6 @@ def train_calculator(self, data: list[Atoms]) -> Calculator:
model=model,
desc=self.descriptors,
desc_scaling=(offset_x, scale_x),
energy_scaling=(offset_y, scale_y),
energy_scaling=(offset_y / len(data[0]), scale_y / len(data[0])),
device=self.device
)
4 changes: 4 additions & 0 deletions tests/models/test_soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def test_model(soap, train_set):
# Run the fitting
calcs = model.train(train_set)

# Make sure the forces are reasonable
eng = calcs[0].get_potential_energy(train_set[0])
assert np.isclose(eng, train_set[0].get_potential_energy(), atol=1e-2)

# Test the mean hessian function
mean_hess = model.mean_hessian(calcs)
assert mean_hess.shape == (9, 9), 'Wrong shape'
Expand Down

0 comments on commit b8e4beb

Please sign in to comment.