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

Possible to have correlated pulses? #73

Closed
adasie opened this issue Jun 12, 2020 · 4 comments
Closed

Possible to have correlated pulses? #73

adasie opened this issue Jun 12, 2020 · 4 comments
Labels
question Further information is requested

Comments

@adasie
Copy link

adasie commented Jun 12, 2020

Hi,

I have a Hamiltonian of the form H = epsilon(t) * H0 + f(epsilon(t)) * H1, where epsilon(t) is the control pulse and f is a defined function. Is it possible to implement it via krotov? As the two terms are not independent, I am not sure it is.

Thank you very much for your help!

@goerz
Copy link
Member

goerz commented Jun 13, 2020

It is possible in principle, but to the extent that f is non-linear, this depends on #23.

How is f defined, specifically, in your case?

@adasie
Copy link
Author

adasie commented Jun 13, 2020

f is a non-linear function of epsilon, I can't really make it explicit here since it depends on several (fixed) parameters of my system.

I managed to change the value of my second pulse at each iteration using modify_params_after_iter and the function below, but I don't know if it's the best way to do it. The first pulse is epsilon(t), the second pulse is f(epsilon(t)), associated with a zero-shape function (so that it is not optimized, just updated at each iteration thanks to the function below).

def _modify_second_pulse(**kwargs):
       
        pulses = kwargs['optimized_pulses']
        shape_arrays = kwargs['shape_arrays']
        
        pulse1, shape1 = pulses[0], shape_arrays[0]
                
        pulse2, shape2 = pulses[1], shape_arrays[1]
        pulse2 = [f(p) for p in pulse1]
            
    return _filter

@goerz
Copy link
Member

goerz commented Jun 14, 2020

If f is non-analytic (which seems to be what you're saying), then there's no good way to include it in the optimization. If I understand correctly what you're doing then is to use ∂H/∂ϵ=H0 for the update, ignoring f and H1? That seems sensible, although mathematically all bets are off: there's no guarantee that the optimization will succeed, much less converge monotonically. It's probably best to only allow small changes for ϵ in each iteration (by choosing a large value for λ_a).

Using modify_params_after_iter to update ϵ inside of f after each iteration as you're doing is ok, assuming you cannot update f after each time step. That means of course that you're using the ϵ from the previous iteration inside of f, so your forward propagation will be off a bit. Again, make sure Δϵ is small if you don't want this to blow up in your face.

In any case, one nice thing with optimal control is that you can do anything at all to try to get results, even if it's mathematically wrong or doesn't converge monotonically, as long as you get a fidelity that you're happy with in the end. It doesn't seem like there's much in the krotov library that we can do to help with your use case, though, so I'm inclined to close this issue.

@adasie
Copy link
Author

adasie commented Jun 14, 2020

Thank you very much for your answer. f is an analytical function, sorry if it was not clear.

Considering ∂H/∂ϵ=H0 is exactly what I've done, knowing it was imperfect. I hoped large value of λ_a would be fine. Is there another way to solve the problem with f analytical?

@goerz goerz added the question Further information is requested label Aug 6, 2020
@goerz goerz closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants