Skip to content

Commit

Permalink
make neighbour cut off optional in PES exploration
Browse files Browse the repository at this point in the history
  • Loading branch information
MBueschelberger committed Sep 14, 2023
1 parent cbadd3f commit eae9a28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion osp/dictionaries/ams/co_pt111_meso.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"n_expeditions": 30,
"n_explorers": 4,
"max_energy": 2.0,
"max_distance": 3.8,
"random_seed": 100,
"fixed_region":"surface",
"reference_region": "surface",
Expand Down
20 changes: 11 additions & 9 deletions osp/models/multiscale/co_pt111_meso.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class PESExploration:
By default an appropriate number of explorers are executed in parallel.""",
)
max_energy: confloat(gt=0.0) = Field(2.0, description="Maximum energy in eV")
max_distance: confloat(gt=0.0) = Field(
3.8, description="Maximum distance cutoff from neighbors in Ångström"
max_distance: Optional[confloat(gt=0.0)] = Field(
None, description="Maximum distance cutoff from neighbors in Ångström"
)
random_seed: conint(ge=1) = Field(100, description="Random seed.")
fixed_region: str = Field("surface", description="Fixed region of lattice.")
Expand Down Expand Up @@ -131,12 +131,6 @@ def _make_model(self):
max_energy.add(energy_value, rel=emmo.hasQuantityValue)
max_energy.add(energy_unit, rel=emmo.hasReferenceUnit)

max_distance = emmo.NeighborCutoff()
distance_value = emmo.Real(hasNumericalData=self.max_distance)
distance_unit = emmo.Ångström(hasSymbolData="Å")
max_distance.add(distance_value, rel=emmo.hasQuantityValue)
max_distance.add(distance_unit, rel=emmo.hasReferenceUnit)

ref_region = emmo.ReferenceRegion(hasSymbolData=self.reference_region)
random_seed = emmo.RandomSeed(hasNumericalData=self.random_seed)

Expand All @@ -149,12 +143,20 @@ def _make_model(self):
forcefield,
num_explorers,
max_energy,
max_distance,
ref_region,
random_seed,
symmetry_check,
rel=emmo.hasInput,
)

if self.max_distance:
max_distance = emmo.NeighborCutoff()
distance_value = emmo.Real(hasNumericalData=self.max_distance)
distance_unit = emmo.Ångström(hasSymbolData="Å")
max_distance.add(distance_value, rel=emmo.hasQuantityValue)
max_distance.add(distance_unit, rel=emmo.hasReferenceUnit)
calculation.add(max_energy, rel=emmo.hasInput)

return calculation

@property
Expand Down

0 comments on commit eae9a28

Please sign in to comment.