24 if not(value
in options):
26 print(
'Error: Invalid input \'{:}={:}\'. The program is expecting one of the following inputs:'.format(tag,value))
38 print(
'Note: Tag \'{:}\' is not set. Program will use the default \'{:}={:}\'.'.format(tag,tag,dval))
41 print(
'Note: Tag \'{:}\' is not set. Program will use the following default \'{:}\' grid.'.format(tag,tag))
57 if not(type(val)
is int):
59 print(
'Error: Invalid input \'{:}={:}\': The program is expecting positive integer for tag \'{:}\'.'.format(tag,val,tag))
82 if not(type(val)
is float):
84 print(
'Error: Invalid input \'{:}={:}\': The program is expecting positive float for tag \'{:}\'.'.format(tag,val,tag))
102 length = len(params[tag])
104 mini, maxi, num = params[tag]
105 if not(type(mini)
is float):
107 print(
'Error: Invalid input \'{:}\' min = {:}: The program is expecting positive float for \'{:}\' grid minimum.'.format(tag,mini,tag))
109 elif not(type(maxi)
is float):
111 print(
'Error: Invalid input \'{:}\' max = {:}: The program is expecting positive float for \'{:}\' grid maximum.'.format(tag,maxi,tag))
115 print(
'Error: Invalid input: The program requires minimum < maximum for \'{:}\' grid.'.format(tag))
117 elif not(type(num)
is int):
119 print(
'Error: Invalid input \'{:}\' num = {:}: The program is expecting positive integer number of points in \'{:}\' grid.'.format(tag,num,tag))
123 print(
'Error: Invalid input \'{:}\' num = {:}: The program is expecting positive integer number of points in \'{:}\' grid.'.format(tag,num,tag))
125 elif mini==maxi
and num!=1:
127 print(
'Error: Invalid input: For \'{:}\' grid, if minimum=maximum, The program is expecting num=1.'.format(tag))
131 print(
'Error: Invalid input: The program is expecting three input values (minimum, maximum, number of points) for grid \'{:}\'.'.format(tag))
154 headers = [header
for header
in nml]
155 if not (
'control' in headers):
157 print(
'Error: Invalid format: CONTROL namelist is missing.')
161 control = nml[
'control']
162 tags = [tag
for tag
in control]
166 invalid_tags = [tag
for tag
in ctags
if not(tag
in corder)]
167 if len(invalid_tags)!=0:
169 print(
'Error: Invalid tags present in the CONTROL namelist tags.')
170 print(
'Remove the following invalid tags:')
171 for tag
in invalid_tags:
176 order = [tag
for tag
in corder
if tag
in ctags]
177 if not(ctags==order):
179 print(
'Error: Invalid format. The CONTROL namelist tags need to be in the following order:')
188 print(
'Incomplete params.txt: The \'{:}\' tag is missing.'.format(tag))
190 p_system = control[tag]
194 sys_idx = systems.index(p_system)
197 if p_system ==
'test':
201 if not (
'parameters' in headers):
203 print(
'Error: Invalid format: PARAMETERS namelist is missing.')
228 tag =
'write_restart'
242 if not(type(rnum)
is int):
244 print(
'Error: Invalid input \'{:}={:}\': The program is expecting integer >=0 for tag \'{:}\'.'.format(tag,rnum,tag))
248 print(
'Error: Invalid input \'{:}={:}\': The program is expecting a positive integer for tag \'{:}\'.'.format(tag,rnum,tag))
262 print(
'Error: Cannot set write_chain=.TRUE. for equilibration runs.')
263 print(
' Equilibration runs (run_equil=.TRUE.) automatically output the Markov chains.')
264 print(
' It is hence redundant to set write_chains=.TRUE. along with run_equil=.TRUE.')
265 print(
' Please remove the tag "write_chains" from this CONTROL namelist.')
281 parameters = nml[
'parameters']
282 sys_small = [
'qho',
'h2plus',
'h2',
'test']
283 par_sys = [sys
for sys
in parameters]
287 print(
'Note: PARAMETERS namelist is empty.')
289 print(
'The program will use the following default parameters for equilibration mode.')
290 print(
'steps=',d_equi_steps[sys_idx],
', burn_step=0, thin_step=1')
292 print(
'The program will use the following default parameters for VQMC simulation mode.')
293 print(
'steps=',d_vqmc_steps[sys_idx],
', burn_step=',d_bstep[sys_idx],
', thin_step=',d_tstep[sys_idx])
294 print(
'rcut=',d_rcut[sys_idx],
', sigma=',d_sigma[sys_idx])
296 print(
'alpha=[{:},{:},{:}]'.format(d_alpha[0],d_alpha[1],d_alpha[2]))
297 elif p_system==
'H2plus':
298 print(
'auto_params=',d_auto_h2plus)
299 if d_auto_h2plus==
'.TRUE.':
302 print(
'c_grid=[{:},{:},{:}]'.format(d_c_grid[0],d_c_grid[1],d_c_grid[2]))
303 print(
'bond=[{:},{:},{:}]'.format(d_bond_h2plus[0],d_bond_h2plus[1],d_bond_h2plus[2]))
305 print(
'auto_params=',d_auto_h2)
306 if d_auto_h2==
'.TRUE.':
307 print(
'beta=',d_beta)
309 print(
'beta_grid=[{:},{:},{:}]'.format(d_beta_grid[0],d_beta_grid[1],d_beta_grid[2]))
310 print(
'bond=[{:},{:},{:}]'.format(d_bond_h2[0],d_bond_h2[1],d_bond_h2[2]))
314 print(
'Error: Invalid input: Either multiple or no system defitions present in PARAMETERS namelist tags.')
315 print(
'The program is expecting one, and only one, of the following strings before a percent symbol:')
318 elif not (par_sys[0]
in sys_small):
320 print(
'Error: Invalid system definition in PARAMETERS namelist tags. The program is expecting one of the following strings before a percent symbol:')
325 params = parameters[par_sys[0]]
326 tags = [tag
for tag
in params]
331 porder = porder_qho.copy()
332 elif p_system==
'H2plus':
333 porder = porder_h2plus.copy()
335 porder = porder_h2.copy()
336 invalid_tags = [tag
for tag
in ptags
if not(tag
in porder)]
337 if len(invalid_tags)!=0:
339 print(
'Error: Invalid tags present in the PARAMETERS namelist tags.')
340 print(
'Remove the following invalid tags:')
345 order = [tag
for tag
in porder
if tag
in ptags]
346 if not(ptags==order):
348 print(
'Error: Invalid format. The PARAMETERS namelist tags need to be in the following order:')
355 steps =
check_step(
'steps',tags,params,d_steps,sys_idx)
358 bstep =
check_step(
'burn_step',tags,params,d_bstep,sys_idx)
361 tstep =
check_step(
'thin_step',tags,params,d_tstep,sys_idx)
366 print(
'Error: Incompatable inputs steps={:} and burn_step={:}. The program is expecting burn_step < step.'.format(steps,bstep))
368 if tstep >= steps-bstep:
370 print(
'Error: Incompatable inputs steps={:}, burn_step={:} and thin_step={:}. The program is expecting thinstep < steps - burn_step.'.format(steps,bstep,tstep))
372 if (equi
and bstep!=0)
or (equi
and tstep!=1):
374 print(
'Error: Invalid inputs: For equilibration run, the program requires (defaults) burn_step=0 and thin_step=1.')
375 print(
'Either specify these values, or just do not specify these tags so that the program uses the defaults.')
393 elif p_system==
'H2plus':
432 check_grid(
'beta_grid',tags,params,d_beta_grid)
438 invalid_tags = [tag
for tag
in ctags
if not(tag
in corder)]
439 if len(invalid_tags)!=0:
441 print(
'Error: Invalid tags present in the CONTROL namelist tags.')
442 print(
'Remove the following invalid tags:')
447 order = [tag
for tag
in corder
if tag
in ctags]
448 if not(ctags==order):
450 print(
'Error: Invalid format. The CONTROL namelist tags need to be in the following order:')
Contains default values for input parameters of Dice QMC.
def check_float(tag, tags, params, defaults, idx=None)
Checks the input value of a parameter that is expected to be a float.
def isvalid(tag, value, options)
Checks the validity of the input value given for a tag present in params.txt.
def check_step(tag, tags, params, defaults, idx=None)
Checks the input value of a parameter that is expected to be an integer step.
def check_grid(tag, tags, params, default_grid)
Checks the input values for a grid parameter.
def check_inputs(nml)
Major subroutine that checks the inputs of file params.txt.
def default_message(tag, dval)
Subroutine that notifies the user when defaults are being used for a certain parameter.