# Maybe a bug for Electric field

**URL:** <https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278>\
**Category:** Physics, Transport and Magnetic Fields\
**Created:** [2 April 2026 06:31 UTC](https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278 "2026-04-02T06:31:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![1561103570](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/1/d78d45/32.png) [@1561103570](https://fluka-forum.web.cern.ch/u/1561103570)\
**Post date:** [2 April 2026 06:31 UTC](https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278/1 "2026-04-02T06:31:43Z")

</div>

### Versions

> Please provide the used software versions.

_FLUKA_:3.4-5.2  
_Flair_:4-5.1

### Description

> Dear FLUKA developers and experts,  
> I am attempting to simulate electrons and protons passing through an electric field of a defined intensity. The particle energy is expected to increase, but the energy gain calculated by FLUKA is inconsistent with theoretical results—it is only about 70% of the theoretically predicted value. This issue occurs consistently across different field strengths. Have I missed any conditions, or is there a bug in the code?

> | | | Initial Electron Energy 1MeV | Electron Accelerated in Electric Field | Initial Proton Energy 10MeV | Proton Accelerated in Electric Field | | |
> | --- | --- | --- | --- | --- | --- | --- | --- |
> | E strength [kV/cm] | E [kV] | Eenrgy Increased Analytic [MeV] | Eenrgy Increased FLUKA [MeV] | Ratio | Eenrgy Increased Analytic [MeV] | Eenrgy Increased FLUKA [MeV] | Ratio |
> | 10 | 1000 | 1 | 0.6 | 0.6 | 1 | 0.6 | 0.6 |
> | 20 | 2000 | 2 | 1.4 | 0.7 | 2 | 1.4 | 0.7 |
> | 30 | 3000 | 3 | 2.1 | 0.7 | 3 | 2.1 | 0.7 |
> | 40 | 4000 | 4 | 2.8 | 0.7 | 4 | 2.8 | 0.7 |
> | 50 | 5000 | 5 | 3.5 | 0.7 | 5 | 3.5 | 0.7 |
> | 80 | 8000 | 8 | 5.6 | 0.7 | 8 | 5.6 | 0.7 |

### Input files

> [Electric.inp](https://fluka-forum.web.cern.ch/uploads/short-url/A8oEfqiTf1hxFfzi3ILNyHT3Nlt.inp) (2.0 KB)
> 
> For EZ=-10 kV/cm, Elength=100cm, through this field electron increased Energy should be 1MeV, and detector 2 should be 2MeV. While it’s ~1.6MeV.
> 
> ![image](https://fluka-forum.web.cern.ch/uploads/default/original/2X/6/63081fefe1a790ec2baaabf7fdf64a5a0c94f1fa.png)

---

<div class="post-metadata">

**Author:** ![dcalzola](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@dcalzola](https://fluka-forum.web.cern.ch/u/dcalzola)\
**Post date:** [2 April 2026 11:50 UTC](https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278/3 "2026-04-02T11:50:21Z")

</div>

Hello,

Thanks for this question, this is indeed a valid point. It is indeed a bug, which we have fixed and which will be solved in the upcoming release.

Without going into technicalities, the tracking algorithm was sometimes going into a different branch of the code that incorrectly calculated the particle energy while traveling in the electric field. As a result, only a fraction of the energy the particle was supposed to gain was actually accounted for.

Worry not, we will fix this issue in the upcoming release. I attach here the plot you would obtain after the next update:

 ![energy_spectrum](https://fluka-forum.web.cern.ch/uploads/default/original/2X/b/be6f9299d5c97e19269e6e44214dde6e3c0da20b.png)

Nice catch! Have a nice day.  
Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![1561103570](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/1/d78d45/32.png) [@1561103570](https://fluka-forum.web.cern.ch/u/1561103570)\
**Post date:** [4 April 2026 00:04 UTC](https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278/4 "2026-04-04T00:04:00Z")

</div>

Thank you very much for your explanation, Daniele. We look forward to the release of updated versions.

---

<div class="post-metadata">

**Author:** ![rversaci](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/r/cc9497/32.png) [@rversaci](https://fluka-forum.web.cern.ch/u/rversaci)\
**Post date:** [8 April 2026 15:23 UTC](https://fluka-forum.web.cern.ch/t/maybe-a-bug-for-electric-field/8278/5 "2026-04-08T15:23:50Z")

</div>

Closed on 8 April 2026 15:23 UTC


