Dear @kwlibuaa,

Thank you for your question. First of all, would you mind sharing some of the results that you find incorrect, together with the beam shape dependance? It would be very useful to me in order to pinpoint the differences.

Using as a reference this post with the canonical definition of LETt and LETd, it seems to me that your LETt calculation is coherent. However, the way you define LETd is different since dose is used, which is proportional to the deposited energy. You are somehow combining the second and third definitions in the post. Possibly your definition and the canonical one may coincide under certain conditions, but formally speaking they are different. I propose you use the following:

21bin - Proton fluence,

22bin - Proton fluence weighted by LET via fluscw,

23bin - Proton fluence weighted by LET^2 via fluscw,

Hence: LETt = 22bin/21bin ---- LETd = 23bin/22bin.

Lastly, I understand you ask about using either the initial or final LET for each step in the USRBIN calculations. In general, using the initial values of the particle (ETRACK and PLA) in each step for GETLET yields accurate results. In your code, this is obtained via:

```
ENDLET = GETLET(JTRACK,EKIN,PLA,ZERZER,26)
```

Please remember that the accesible values in the variables are always the initial ones, which are used to determine the values of the next step. Also, take into account that depending on the voxel size of USRBIN, more than one particle step can take place inside. In such case, fluence values with their weights are properly averaged.

I hope this helps.

Mario Sacristán Barbero