Skip to content

Commit

Permalink
Update readme for custom model
Browse files Browse the repository at this point in the history
  • Loading branch information
nnn911 committed Aug 18, 2023
1 parent 1a7a0c1 commit 17c6819
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ The modifier can be found under the label "Denoise particle positions" in the OV

- "Number of denoising steps" | `steps`: Number of denoising interations taken. More iterations require more time. You can check the mean displacement per iteration graph to assess convergence.
- "Nearest neighbor distance" | `scale` : Estimation of the nearest neighbor distance used to scale the coordinates before they are input into the model. If this is `None` OVITO will try to estimate the correct nearest neighbor distance.
- "Crystal structure / material system" | `structure` : Allows you to select one of: "FCC", "BCC", "HCP", or "SiO2", depending on your input structure. Note, that an SiO2 structure requires a type named "Si".
- "Crystal structure / material system" | `structure` : Allows you to select one of: "FCC", "BCC", "HCP", or "SiO2", depending on your input structure. Note, that an SiO2 structure requires a type named "Si" and "O". If you don't want to use any of the default material systems you can select "Custom". In that case OVITO will not estimate the "Nearest neighbor distance" and it has to be provided by the user.
- "Model file path" | `model_path`: Allows you define a custom pytorch model. The model will be loaded from the path entered. If this is set to `None` the default models for "SiO2" or "Cu" shipped with [graphite](https://github.com/LLNL/graphite/) will be loaded.
- "Device" | `device`: Allows you to select your computing device from: "cpu", "cuda", "mps". Only available devices will be shown. Please read the "Installation" section for additional information.
- "Only selected" | `only_selected`: Apply the modifier only to the selected particles. Following the convention set by other modifiers, even atoms that are not selected will be used as neighbors.

Expand Down
8 changes: 4 additions & 4 deletions src/scoreBasedDenoising/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ScoreBasedDenoising(ModifierInterface):
label="Crystal structure / material system",
)

modelPath = Union(None, Str, label="Model file path")
model_path = Union(None, Str, label="Model file path")

if torch.cuda.is_available():
device = Enum("cpu", "cuda", label="Device")
Expand Down Expand Up @@ -104,11 +104,11 @@ def denoise_snapshot(self, atoms, model, scale):
return data.pos.to("cpu").numpy() / scale, convergence

def getModelPath(self):
if self.modelPath is not None:
path = Path(self.modelPath)
if self.model_path is not None:
path = Path(self.model_path)
if not path.exists():
raise FileNotFoundError(f"{path} does not exist.")
return Path(self.modelPath)
return Path(self.model_path)
modelDir = impRes.files("graphite.pretrained_models.denoiser")
match self.structure:
case "SiO2":
Expand Down

0 comments on commit 17c6819

Please sign in to comment.