Here's a couple of minor suggestions for your "max cai" mod file--
It doesn't need to WRITE cai.
It's OK to declare cai in the PARAMETER block, but strictly speaking it's not a parameter--it's a variable whose value comes from NEURON's computational engine, so it would be conceptually more consistent with being declared in the ASSIGNED block.
Unfortunately, neither of these suggestions has anything to do with your question about accessing the values of RxD variables from NMODL.
Now, for your question. One workaround is to use Vector.record to capture the time course of the species of interest, then after the simulation find its maximum with Vector.max. But instead, you might find it better to try this:
In model setup, make sure your "max conc" "mechanism" is inserted before you execute any RxD code. The USEION statement in its NMODL code makes NEURON create a new species with whatever name and charge you specified. When your model setup code finally gets to the point where you're ready to execute RxD statements, use neuron.rxd.Species's
name and
charge parameters (see
https://www.neuron.yale.edu/neuron/stat ... xd.Species) to set the name that RxD will use to refer to the species, and the charge associated with that species. Do this before any statements that instantiate the reaction-diffusion model. This should ensure that the values calculated by RxD will be reflected in the value of the non-RxD variable that your NMODL file created.