-
Notifications
You must be signed in to change notification settings - Fork 38
Access to the lattice energy in integrators #816
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
Conversation
|
Added 2 new test lattices identical to hmba:
Note: the |
|
I'll be away for 2 weeks. There is still a Matlab function
Please test… |
|
Hello Laurent, |
|
And my second comment is about the mexFunction. I think we could consider to get rid completely of the mexFunctions. The elempass Matlab function is a nice development, but it could probably be written using the standard atpass.c and so using the trackFunction instead of the mexfunction. We could insert a ringparam element in the Matlab function elempass, in front of the element we want to track through, so we would have the energy available. |
|
Hi Nicola. You are right, we miss a test on energy. This could be inserted in atEnergy (Matlab version): in the end, energy must not be zero. I can’t do anything for the moment but If you want, you can take the control of this PR and go on. You may also have a better idea !
|
|
2nd comment : I fully agree. But atpass has a large overhead, useless in this case. Another simpler mex-function calling trackFunction would be better. But then, we would duplicate the loading of integrators… unless we put this in a common shared library used by both… I suggest to take note of that and solve this in another PR.
|
|
I modified the atEnergy for Matlab, but I wrote it as a function, not within the #define. If energy is 0.0 we get an error. |
c3383f4 to
0e28dbb
Compare
|
@carmignani : the 2 Matlab functions computing the diffusion matrix ( I added automatic tests for emittances and damping rates. Everything looks correct for me. |
|
@lfarv @carmignani this look OK for me, shall we merge this? I think it is a pre-requisit for #810 right? |
…Param in .mat files
…e.m and quantumDiff.m
9fe3eb6 to
e235a78
Compare
|
I rebased this branch on master, and backported a few evolutions from #742. Since the number of modified files is very large, here is a summary of the modifications:
For me, it's ready for merging. |
|
Hello, I had a look again to the modifications and all seem good to me. |
As discussed here, the origin of the
energyparameters in the integrators is ambiguous. To make that simpler and clearer, the strategy in this PR is the following:For the entry point common to Matlab and python (
trackFunction): this is the only entry point in python, and the one used for lattice tracking in Matlab.parametersstructure and the element's energy attribute is always ignored,parametersstructure if available, and otherwise from the element's energy attribute.This is implemented by a new
atEnergymacro and is generalized in all the integrators requiring energy. The previous behavior was giving priority to the element's attribute.The energy is taken from the parameters on each call, rather than being stored on the elements parameters, which make it suitable for ramping (Energy ramp #810).
For the Matlab-specific entry point (
MexFunction): it is used in Matlab for tracking in a single element (findelemm66,findelemm44). It is now necessary to provide the energy to the function. So a 3rd optional argument is introduced, as a structure containingEnergy,Particle, and possibly others in the future. Unfortunately, allowing this 3rd argument implied the modification of all integrators (nrhs >= 2instead ofnrhs == 2), though only some of them use this 3rd argument. On top of that, a new Matlab function is created:rout=elempass(elem,rin), with optional keyword argumentsEnergyandParticle. It is similar to the pythonelement_trackfunction.Consequences:
Removing the
Energyattribute of all elements was tested in both Matlab and python. Such a new lattice is added in the automatic test sequence.Though the modifications are moderate, any intervention on integrators is critical and requires a lot of testing. Please help!