# Charging of material

**URL:** <https://fluka-forum.web.cern.ch/t/charging-of-material/8323>\
**Category:** Advanced Features and User Routines\
**Created:** [21 April 2026 00:21 UTC](https://fluka-forum.web.cern.ch/t/charging-of-material/8323 "2026-04-21T00:21:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgancarc](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/d/43a26b/32.png) [@dgancarc](https://fluka-forum.web.cern.ch/u/dgancarc)\
**Post date:** [21 April 2026 00:21 UTC](https://fluka-forum.web.cern.ch/t/charging-of-material/8323/1 "2026-04-21T00:21:01Z")

</div>

### 

> _FLUKA_: 4-4.1  
> _Flair_: 3.3-1  
> _Operating system_: macOS Tahoe, version 26.2
> 
> Dear FLUKA experts,
> 
> I am studying the charging of a small object exposed to a proton beam. The geometry is a copper sphere with a radius of 50 µm. As a first approach, I used USRBDX to score electrons crossing from the material into vacuum, normalized by (1/4π) to account for solid angle.
> 
> However, I realized that not every escaping electron necessarily contributes −1e to the net charge of the object. For example, electrons produced in pair production or other processes may be accompanied by a corresponding positive charge (e.g. positrons or ions) that could also escape, partially compensating the charge balance. To investigate this, I implemented a USERDUMP with a custom mgdraw routine to record particles crossing into the VOID region. I also included evtflg.inc and attempted to tag the interaction type using flags such as LPAIRP, LBRMSP, LCMPTN, etc. In addition, I tried to access ISPUSR(1) (via STUPRE) to store the interaction type, but this quantity is always zero in my output.
> 
> Any guidance would be greatly appreciated.  
> Best regards,
> 
> David

### Input files

[plot.pdf](https://fluka-forum.web.cern.ch/uploads/short-url/tXo454gYO7Spp4SXKR5VoH78ug5.pdf) (56.1 KB)

[mgdraw\_test.f](https://fluka-forum.web.cern.ch/uploads/short-url/A5w0iTgJFWKqetZHokTxy9c7Oe1.f) (2.5 KB)

[cu50.inp](https://fluka-forum.web.cern.ch/uploads/short-url/uYv7YFjFV9UNQDB0eUFqEbOs69A.inp) (1.3 KB)

---

<div class="post-metadata">

**Author:** ![jemancza](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/j/9fc348/32.png) [@jemancza](https://fluka-forum.web.cern.ch/u/jemancza)\
**Post date:** [22 April 2026 15:07 UTC](https://fluka-forum.web.cern.ch/t/charging-of-material/8323/3 "2026-04-22T15:07:21Z")

</div>

Hi @dgancarc

Thank you for your question.  
I am not exactly sure if I understand what you are trying to do. Maybe all you need is a `USRBIN` with `NET-CHRG` scoring quantity with a `Region` scoring option?  
Could you please also add your version of STUPRE that you were using?  
Also, in the `mgdraw_test.f` file that you posted I cannot see the way you were trying to use the event flags. However, I assume they are not supposed to be used the way you inteded. If you want to get the type of interaction in any of your `MGDRAW` subroutines, you should refer to ICODE variable. Please have a look at `mgdraw` routine manual, section `USDRAW`

> **[ICODE - 13.2.12. mgdraw.f — FLUKA Manual](https://flukafiles.web.cern.ch/manual/chapters/user_routines/user_routines/mgdraw.html#entry-usdraw)**
>
> General event interface

Cheers,  
Jerzy

---

<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:** [30 April 2026 09:50 UTC](https://fluka-forum.web.cern.ch/t/charging-of-material/8323/4 "2026-04-30T09:50:25Z")

</div>

Closed on 30 April 2026 09:50 UTC


