You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe the way the code should work when you turn on macro-atom line transfer mode but don't give the required atomic data (i.e. use say standard77) is that the code should detect no macro-atom levels and treat all line transitions using the "simple-ion" approach.
At the moment, one gets a segfault when this happens because the macromain structure is not allocated when nlevels_macro is zero. It's fine for the estimators not to be allocated, but the general structure still needs to be. A couple of problems here:
first, the variable geo.nmacro is always initialised to 0. When we call calloc_macro it doesn't allocate memory if the following condition is entered:
if (nlevels_macro==0&&geo.nmacro==0)
{
Log
("calloc_macro: Allocated no space for macro since nlevels_macro==0 and geo.nmacro==0\n");
return (0);
}
Second, there is also a line in resonate.c which sets mplasma to NULL if (geo.nmacro > 0) - this is what actually causes the current segfault, I believe, but if you remove this you get a segfault caused by the first problem.
I think the easiest solution is that we always set geo.nmacro to NPLASMA if geo.rt_mode = 2 - i.e. we want to use the macro-atom machinery for line transfer but treat everything as simple ions.
Longer term, we could probably tidy up the variables which define all this stuff to make it simpler and more obvious what is happening.
The text was updated successfully, but these errors were encountered:
I believe the way the code should work when you turn on macro-atom line transfer mode but don't give the required atomic data (i.e. use say standard77) is that the code should detect no macro-atom levels and treat all line transitions using the "simple-ion" approach.
At the moment, one gets a segfault when this happens because the macromain structure is not allocated when nlevels_macro is zero. It's fine for the estimators not to be allocated, but the general structure still needs to be. A couple of problems here:
first, the variable geo.nmacro is always initialised to 0. When we call calloc_macro it doesn't allocate memory if the following condition is entered:
Second, there is also a line in resonate.c which sets mplasma to NULL if (geo.nmacro > 0) - this is what actually causes the current segfault, I believe, but if you remove this you get a segfault caused by the first problem.
I think the easiest solution is that we always set geo.nmacro to NPLASMA if geo.rt_mode = 2 - i.e. we want to use the macro-atom machinery for line transfer but treat everything as simple ions.
Longer term, we could probably tidy up the variables which define all this stuff to make it simpler and more obvious what is happening.
The text was updated successfully, but these errors were encountered: