When you have a variable that can be both fixed and random, is there a right way to define it in lme4? I have an outcome variable painRating which represents how painful a participant found a sensation. I can reasonably expect ratings to be affected by a painful stimulation. Thus I would like to run a mixed-effects model (lme4) to test that.
In my experiment I have various stimulation levels which were acquired individually for each participant ** but following a predetermined protocol **, thus I have limited and influenced the stimulation levels. Let's call my painful stimulation variable stimulationValue. It is continuous numerical variable that ranges between 5 and 15.
In my understanding, stimulationValue could be:
A) a random effect because the actual value of the stimulation is due to a participant variability (another random effect participant) and whether or not a participant held a diagnosis (diagnosis). So my model could look like:
painRating ~ diagnosis + (1 | stimulationValue) + (1 | diagnosis/participant)

B) a fixed effect because despite participant variability, I have limited the actual value to a range:
painRating ~ diagnosis + stimulationValue + (1 | diagnosis/participant)

Question: Am I wrong that 'stimulationValue' could be both a RE and a FE? If not, is there one way that I should choose over the other?
** If needed clarification - Before the experiment, I determined 6 various stimulation levels based on each participant's pain threshold and pain tolerance. Both measures differ between participants thus the resulting stimulation levels also differ.
 A: Sometimes the difference between 'fixed' and 'random' depends on purpose and point of view. One study, two perspectives:
Fixed. Suppose I have 10 new machines of a popular type made by Mfg A in my factory.
I wonder if they are all going to perform according to my needs.
As an experiment I run difficult jobs on all 10 machines. I do an ANOVA
see if the machines differ as to quality of output. For me this is a random effects model. I care only about my 10 machines and a significant effect
with ad hoc analysis is important to me. I now know that machines A, D, and H are not quite up to my most demanding standards, and the B, C, and J are
especially good. For me Machine is a fixed effect.
Random. I discuss results of my experiment with a representative from Mfg A who visits my company regularly. She finds them interesting and wants a copy of my data and analysis for company engineers to study. For Mfg A, my ten machines are a random sample from
an essentially infinite pool of such machines. For Mfg A, my study of
ten machines should be viewed according to a random effects model.
 Mfg A will want to estimate the variance of my main effect.
A: This is an interesting design! 
One thing before getting to your question. You have diagnosis as both a fixed and then a nested random intercept. That does not make a lot of sense. My initial thought, without knowing a lot about your data, is that diagnosis would be better left in the fixed part of the model and not included as a random intercept. 
I would encourage you to treat stimulationValue in a way that is consistent with your research question(s) and theory. Theoretically, what is its role in a patient's painRating? Do you expect the effect of stimulationValue on painRating to be the same across individuals? If not, then you may consider a third alternative model in which you treat stimulationValue as a continuous predictor that has a varying effect on painRating depending on the participant. That model would be as follows:
m3 <- painRating ~ diagnosis + stimulationValue + (1 + stimulationValue | participant), data=df

Since diagnosis is presumably a participant-level variable, you might further be interested in whether diagnosis at all shifts the strength of the association between stimulationValue and painRating. That would involve you interacting the two variables.
This is just to show that you have lots of options for how to treat stimulationValue and the option you choose should be based on theory and other considerations as much as possible and less on purely statistical considerations.
