Skip to content

Commit 051ced1

Browse files
committed
Added the possibility to set the elements of Relax with kwargs
1 parent 339853e commit 051ced1

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Modules/Relax.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
class SSCHA(object):
4848

4949
def __init__(self, minimizer = None, ase_calculator=None, N_configs=1, max_pop = 20,
50-
save_ensemble = False, cluster = None):
50+
save_ensemble = False, cluster = None, **kwargs):
5151
"""
5252
This module initialize the relaxer. It may perform
5353
constant volume or pressure relaxation using fully anharmonic potentials.
@@ -69,6 +69,7 @@ def __init__(self, minimizer = None, ase_calculator=None, N_configs=1, max_pop =
6969
cluster : Cluster.Cluster, optional
7070
If different from None, the ensemble force and energy calculations
7171
will be runned in the provided cluster.
72+
**kwargs : any other keyword that matches an object of this structure
7273
"""
7374

7475
if minimizer == None:
@@ -85,7 +86,7 @@ def __init__(self, minimizer = None, ase_calculator=None, N_configs=1, max_pop =
8586
# If the ensemble must be saved at each iteration.
8687
#
8788
self.save_ensemble = save_ensemble
88-
self.data_dir = ""
89+
self.data_dir = "data"
8990

9091

9192

@@ -109,6 +110,11 @@ def __init__(self, minimizer = None, ase_calculator=None, N_configs=1, max_pop =
109110
self.__total_attributes__ = [item for item in self.__dict__.keys()]
110111
self.fixed_attributes = True # This must be the last attribute to be setted
111112

113+
114+
# Setup any other keyword given in input (raising the error if not already defined)
115+
for key in kwargs:
116+
self.__setattr__(key, kwargs[key])
117+
112118
def __setattr__(self, name, value):
113119
"""
114120
This method is used to set an attribute.

0 commit comments

Comments
 (0)