Skip to content

Commit

Permalink
Fix error loading custom models
Browse files Browse the repository at this point in the history
  • Loading branch information
nnn911 committed Aug 18, 2023
1 parent 17c6819 commit 28d5952
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/scoreBasedDenoising/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _modify(self, data, frame, **kwargs):
case "FCC" | "BCC" | "HCP":
model = self.setupFccBccHcpModel(data)
case "Custom":
model = self.setupCustomModel(data)
model = self.setupCustomModel()
case _:
raise NotImplementedError

Expand All @@ -195,12 +195,19 @@ def _modify(self, data, frame, **kwargs):

noisy_atoms = ovito_to_ase(data)

if self.scale is not None:
modelScale = ScoreBasedDenoising.originalScale[self.structure] / self.scale
if self.structure == "Custom":
modelScale = self.scale
else:
estNNdist = self.estimateNearestNeighborsDistance(data)
print(f"Estimated nearest neighbor distance = {estNNdist:#.3g} A")
modelScale = ScoreBasedDenoising.originalScale[self.structure] / estNNdist
if self.scale is not None:
modelScale = (
ScoreBasedDenoising.originalScale[self.structure] / self.scale
)
else:
estNNdist = self.estimateNearestNeighborsDistance(data)
print(f"Estimated nearest neighbor distance = {estNNdist:#.3g} A")
modelScale = (
ScoreBasedDenoising.originalScale[self.structure] / estNNdist
)

denoised_atoms, convergence = yield from self.denoise_snapshot(
noisy_atoms, model, modelScale
Expand Down

0 comments on commit 28d5952

Please sign in to comment.