Fix maximum order vs. variable truncation order bug
mattsignorelli opened this issue · comments
For some simulations it could be convenient to set the maximum order for pairs like maximum order for (x, px). This is in addition to setting the maximum overall order. Is this doable with Laurent's code?
I can write code to make it do this, but I think I'd rather avoid giving preferences to things that are convenient in accelerator physics (for example what if someone else using GTPSA finds it convenient to set the order for triplets a,b,c ?) and just leave it general.
I've been struggling with how to best implement this maximum order though, because there is a bit of a limitation in the C code that this exposes; there is a maximum order for the entire GTPSA (mo) and a maximum order for the parameters(po) which has to be less than or equal to mo. But there is no separate maximum order for the variables.
So say I have 2 parameters and I'd like to keep each to order 2, but a maximum parameter order po=3. Then I get the combinations:
01
10
20
11
02
12
21
(NO 03 or 30 !)
That works fine. Now say I'd like to, in the same GTPSA, have 2 variables to order 1 but have a maximum variable order 2. So I would like
01
10
11
(NOT 20 or 02)
in the variables, paired with all combinations of the above parameter allowed orders. This is NOT allowed, because the variables strictly have a maximum order defined by mo, which must be >= po. There is a separate parameter truncation order, but not a separate variable truncation order.
Of course this is a corner case, but writing the Descriptor constructors in a way that allows this only when max variable order = mo >= po, and making this fact transparent in the Descriptor constructors, is challenging
Let me know if you have any good ideas
Actually, there is a realistic case where this is a problem, and it's something Etienne has been wanting to do: say you want first order in the variables but 2nd order in parameters. You can restrict the variables to each have their own truncation orders 1, but there will be cross terms in the phase space variables that are second order...
I have updated the descriptor constructors and explained this clearly in the documentation, will be in next release