Skip to content

Commit c407721

Browse files
Set keys to set the sobol sampling from the sscha inputfile. (not tested yet). The new inputs for the file are "sobol_sampling"=(bool) and "sobol_scatter"=(float) in "&relax".
1 parent 59305b0 commit c407721

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Modules/Relax.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
__RELAX_TARGET_PRESSURE__ = "target_pressure"
3333
__RELAX_FIXVOLUME__ = "fix_volume"
3434
__RELAX_BULK_MODULUS__ = "bulk_modulus"
35+
__RELAX_SOBOL__ = "sobol_sampling"
36+
__RELAX_SOBOL_SCATTER__ = "sobol_scatter"
3537

3638
__TYPE_SINGLE__ = "sscha"
3739
__TYPE_RELAX__ = "relax"
@@ -203,6 +205,14 @@ def setup_from_namelist(self, namelist):
203205
if __RELAX_FIXVOLUME__ in keys:
204206
self.fix_volume = bool(c_info[__RELAX_FIXVOLUME__])
205207

208+
# ****Diegom_test****
209+
self.sobol = False
210+
if __RELAX_SOBOL__ in keys:
211+
self.sobol = bool(c_info[__RELAX_SOBOL__])
212+
213+
self.sobol_scatter = 0.0
214+
if __RELAX_SOBOL_SCATTER__ in keys:
215+
self.sobol_scatter = np.float64(c_info[__RELAX_SOBOL_SCATTER__])
206216

207217
# Check the allowed keys
208218
for k in keys:
@@ -257,7 +267,7 @@ def setup_custom_functions(self, custom_function_pre = None,
257267

258268

259269
def relax(self, restart_from_ens = False, get_stress = False,
260-
ensemble_loc = None, start_pop = None, sobol = False, sobol_scramble = False, sobol_scatter = 0.0):
270+
ensemble_loc = None, start_pop = None, sobol = self.sobol, sobol_scramble = False, sobol_scatter = self.sobol_scatter):
261271
"""
262272
COSTANT VOLUME RELAX
263273
====================
@@ -382,7 +392,7 @@ def relax(self, restart_from_ens = False, get_stress = False,
382392
def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
383393
restart_from_ens = False,
384394
ensemble_loc = None, start_pop = None, stress_numerical = False,
385-
cell_relax_algorithm = "sd", fix_volume = False, sobol = False, sobol_scramble = False, sobol_scatter = 0.0):
395+
cell_relax_algorithm = "sd", fix_volume = False, sobol_scramble = False, sobol_scatter = self.sobol_scatter):
386396
"""
387397
VARIABLE CELL RELAX
388398
====================
@@ -446,7 +456,7 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
446456
Set the optional scrambling of the generated numbers taken from the Sobol sequence.
447457
sobol_scatter : real (0.0 to 1) (Deafault = 0.0)
448458
Set the scatter parameter to displace the Sobol positions randommly.
449-
459+
450460
Returns
451461
-------
452462
status : bool

0 commit comments

Comments
 (0)