@@ -49,6 +49,35 @@ def str_param_checker(arg):
4949 """
5050 Handles the parameter files for STRUCTURE (or lack thereoff)
5151 """
52+ def _disable_STRUCUTRE_RANDOMIZE (extraparams_file ):
53+ """
54+ Checks if the RANDOMIZE option is set in the `extraparams` file.
55+ If it is, disable it (set to `0`)
56+ """
57+ infile = open (extraparams , "r" )
58+ params = ""
59+ overwrite = False
60+ for lines in infile :
61+ try :
62+ if lines .split ()[1 ] == "RANDOMIZE" :
63+ if lines .split ()[2 ] == "1" :
64+ lines = lines .replace ("1" , "0" )
65+ logging .warning ("The RANDOMIZE option was activated in"
66+ " the `extraparams` file. "
67+ " *Structure_threader* has disabled it"
68+ " since it handles this functionality "
69+ "internallly (random seed setting)." )
70+ overwrite = True
71+ except IndexError :
72+ pass
73+ params += lines
74+ infile .close ()
75+
76+ if overwrite :
77+ outfile = open (extraparams , "w" )
78+ outfile .write (params )
79+ outfile .close ()
80+
5281 os .chdir (os .path .dirname (arg .infile ))
5382 if arg .params is not None :
5483 mainparams = arg .params
@@ -60,6 +89,8 @@ def str_param_checker(arg):
6089 "that you fill one out." )
6190 touch = open (extraparams , 'w' )
6291 touch .close ()
92+ else :
93+ _disable_STRUCUTRE_RANDOMIZE (extraparams )
6394 arg .params = ["-m" , mainparams , "-e" , extraparams ]
6495
6596
0 commit comments