Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large epsrel gives unclear errors in .get_process_tensor and .tempo_compute; also dkmax=0 #89

Open
piperfw opened this issue Mar 10, 2023 · 0 comments
Assignees
Labels
tidy up Something needs to be tidied up

Comments

@piperfw
Copy link
Collaborator

piperfw commented Mar 10, 2023

If argument esprel is large e.g. epsrel=1.0 a call to pt.get_process_tensor fails with a long stack trace ending IndexError, and similarly in a call to tempo_compute. We probably want to catch this earlier on and throw a human readable exception.

On a related note setting dkmax=0 (or tcut very small) causes the PT computation to fail in an unclear way (TEMPO is fine). We could ether assert dkmax is greater than 0 for any TempoParameters, or just check this when TempoParameters are used in a PT computation and throw an Error there.

Attached is a snippet (taken from bath_dynamics.ipynb) showing both kinds or failure.

import sys
sys.path.insert(0, '.')
import oqupy

#epsrel = 1e-5; tcut = 2.0 # values from tutorial (fine)
epsrel = 1.0; tcut = 2.0 # IndexError
#epsrel = 1.0; tcut = 1.0e-5 # ValueError

spin_down = oqupy.operators.spin_dm("down")
s_z = 0.5*oqupy.operators.sigma("z")
s_x = 0.5*oqupy.operators.sigma("x")
Omega = 1
alpha = 0.05
w_cutoff = 10 * Omega
epsilon = 2 * Omega
final_t = 20
delta_t = 0.2
initial_state = spin_down
corr = oqupy.PowerLawSD(alpha, 1, w_cutoff, temperature = 1)
pars = oqupy.TempoParameters(delta_t, epsrel, tcut)
system = oqupy.System(Omega*s_x + epsilon*s_z)
bath = oqupy.Bath(s_z, corr)
pt = oqupy.PtTempo(bath, 0.0, final_t, pars)
pt = pt.get_process_tensor(progress_type='bar')

# Large epsrel breaks TEMPO, but small tcut doesn't
#dynamics = oqupy.tempo_compute(system=system,
#                               bath=bath,
#                               initial_state=initial_state,
#                               start_time=0.0,
#                               end_time=15.0,
#                               parameters=pars)
@piperfw piperfw changed the title Large epsrel gives unclear errors in pt.get_process_tensor and .tempo_compute; also dkmax=0 Large epsrel gives unclear errors in .get_process_tensor and .tempo_compute; also dkmax=0 Mar 10, 2023
@gefux gefux added the tidy up Something needs to be tidied up label Jan 27, 2024
@gefux gefux self-assigned this Jan 27, 2024
@gefux gefux added this to the version 0.5 milestone Jan 27, 2024
@gefux gefux removed this from the version 0.5 milestone Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tidy up Something needs to be tidied up
Projects
None yet
Development

No branches or pull requests

2 participants