@@ -95,6 +95,8 @@ def __init__(
9595 setup_only = False ,
9696 ignore_warnings = False ,
9797 show_errors = True ,
98+ extra_options = {},
99+ extra_lines = [],
98100 property_map = {},
99101 ):
100102 """
@@ -139,6 +141,13 @@ def __init__(
139141 run file. This option is specific to GROMACS and will be ignored
140142 when a different molecular dynamics engine is chosen.
141143
144+ extra_options : dict
145+ A dictionary containing extra options. Overrides the defaults generated
146+ by the protocol.
147+
148+ extra_lines : [str]
149+ A list of extra lines to put at the end of the configuration file.
150+
142151 property_map : dict
143152 A dictionary that maps system "properties" to their user defined
144153 values. This allows the user to refer to properties with their
@@ -249,6 +258,23 @@ def __init__(
249258 raise ValueError ("'show_errors' must be of type 'bool." )
250259 self ._show_errors = show_errors
251260
261+ # Check the extra options.
262+ if not isinstance (extra_options , dict ):
263+ raise TypeError ("'extra_options' must be of type 'dict'." )
264+ else :
265+ keys = extra_options .keys ()
266+ if not all (isinstance (k , str ) for k in keys ):
267+ raise TypeError ("Keys of 'extra_options' must be of type 'str'." )
268+ self ._extra_options = extra_options
269+
270+ # Check the extra lines.
271+ if not isinstance (extra_lines , list ):
272+ raise TypeError ("'extra_lines' must be of type 'list'." )
273+ else :
274+ if not all (isinstance (line , str ) for line in extra_lines ):
275+ raise TypeError ("Lines in 'extra_lines' must be of type 'str'." )
276+ self ._extra_lines = extra_lines
277+
252278 # Check that the map is valid.
253279 if not isinstance (property_map , dict ):
254280 raise TypeError ("'property_map' must be of type 'dict'" )
@@ -856,6 +882,8 @@ def _initialise_runner(self, system):
856882 self ._protocol ,
857883 platform = platform ,
858884 work_dir = first_dir ,
885+ extra_options = self ._extra_options ,
886+ extra_lines = self ._extra_lines ,
859887 property_map = self ._property_map ,
860888 )
861889 if self ._setup_only :
@@ -871,6 +899,9 @@ def _initialise_runner(self, system):
871899 work_dir = first_dir ,
872900 ignore_warnings = self ._ignore_warnings ,
873901 show_errors = self ._show_errors ,
902+ extra_options = self ._extra_options ,
903+ extra_lines = self ._extra_lines ,
904+ property_map = self ._property_map ,
874905 )
875906 if self ._setup_only :
876907 del first_process
0 commit comments