UserWarnings differ for identical initializations when run several times

How do I use this algorithm? What does that parameter do?
Post Reply
xaver
Posts: 10
Joined: 23 Apr 2021, 07:51

UserWarnings differ for identical initializations when run several times

Post by xaver »

I have a frequent issue with UserWarnings regarding unused options in as such that they differ for identical(?) code, run several times. Typically this happens when initializing some tenpy algorithm. E.g.:

Code: Select all

import logging
logging.basicConfig(level=logging.INFO) # allow for some UserWarnings

# Next, prepare some MPS 'psi' and have some model 'h'. Now do

# --------------------------- snip ---------------------
dt = 0.01
dtmes = 0.05
EMEopt = {
    'compression_method': 'SVD',
    'dt': dt,
    'N_steps': int(np.ceil(dtmes/dt)),
    'preserve_norm': True,
    'trunc_params': {
        'chi_max': 50,
        'svd_min': 1.e-10,
        'trunc_cut': None        
    }
}
# set e.g. an evolution engine
eng = ExpMPOEvolution(psi,h,EMEopt)
# --------------------------- snap ---------------------
When run for the 1st time (i.e. with a freshly restarted python kernel), the last info by tenpy is

Code: Select all

INFO:tenpy.tools.params:ExpMPOEvolution: subconfig 'trunc_params'=Config(<3 options>, 'trunc_params')
However, running the code between '-- snip --' and '-- snap --' repeatedly, and starting with the 2nd run the info by tenpy changes into

Code: Select all

INFO:tenpy.tools.params:ExpMPOEvolution: subconfig 'trunc_params'=Config(<3 options>, 'trunc_params')
/home/xaver/.anaconda3/envs/py/lib/python3.9/site-packages/tenpy/tools/params.py:233: UserWarning: unused options for config ExpMPOEvolution:
['N_steps', 'compression_method', 'dt', 'preserve_norm']
  warnings.warn(msg.format(keys=sorted(unused), name=self.name))
/home/xaver/.anaconda3/envs/py/lib/python3.9/site-packages/tenpy/tools/params.py:233: UserWarning: unused options for config trunc_params:
['chi_max', 'svd_min', 'trunc_cut']
  warnings.warn(msg.format(keys=sorted(unused), name=self.name))
Why does
  • ExpMPOEvolution not use its options?
  • ExpMPOEvolution only complain about this starting with the 2nd run?
Post Reply