Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions source/element-kinds.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,6 @@ Element parameter groups associated with this element kind are:
- [**MetaP**](#s:meta.params): Meta parameters.
- [**ReferenceP**](#s:ref.params): Reference parameters.

%---------------------------------------------------------------------------------------------------
(s:foil)=
## Foil Element

Material that can strip electrons from a particle.
Will also cause energy loss and diffusion.

Under Construction...

Element parameter groups associated with this element kind are:
- [**ApertureP**](#s:aperture.params): Aperture parameters.
- [**BodyShiftP**](#s:bodyshift.params): Orientation of element with respect to its nominal position.
- [**FloorP**](#s:floor.params): Floor position and orientation.
- [**MetaP**](#s:meta.params): Meta parameters.
- [**ReferenceP**](#s:ref.params): Reference parameters.
- [**ReferenceChangeP**](#s:ref.change.params): Reference energy change and/or reference time correction.
- [**TrackingP**](#s:tracking.params): Tracking parameters.

The length of this element is considered to be zero so if `length` is specified, it must be zero.

%---------------------------------------------------------------------------------------------------
(s:fork)=
## Fork Element
Expand Down Expand Up @@ -358,6 +338,23 @@ Element parameter groups associated with this element kind are:

The length of this element is considered to be zero so if `length` is specified, it must be zero.

%---------------------------------------------------------------------------------------------------
(s:matter)=
## Matter Element

Materials which fully occupy the beamline, like targets, (stripper-)foils, vacuum windows, gas cells or degraders.
This element can cause energy-loss, angualar and energy straggling, as well as change of charge state or particle type.

Element parameter groups associated with this element kind are:
- [**ApertureP**](#s:aperture.params): Aperture parameters of the outer (blocking) aperture.
- [**BodyShiftP**](#s:bodyshift.params): Orientation of element with respect to its nominal position.
- [**FloorP**](#s:floor.params): Floor position and orientation.
- [**MetaP**](#s:meta.params): Meta parameters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume adding the MatterP paramter group is the whole idea of this element:

Suggested change
- [**MetaP**](#s:meta.params): Meta parameters.
- [**MatterP**](#s:matter.params): Matter parameters.
- [**MetaP**](#s:meta.params): Meta parameters.

- [**ReferenceP**](#s:ref.params): Reference parameters.
- [**ReferenceChangeP**](#s:refchange.params): Reference energy change and/or reference time correction.
- [**TrackingP**](#s:tracking.params): Tracking parameters.
- [**MaterialP**](#s:material.params): Matter parameters.
Copy link
Member

@ax3l ax3l Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah here it is. Then just alphabetic ordering :)

Suggested change
- [**MaterialP**](#s:material.params): Matter parameters.

I think you mean MatterP, not MaterialP.


%---------------------------------------------------------------------------------------------------
(s:multipole)=
## Multipole Element
Expand Down
3 changes: 3 additions & 0 deletions source/element-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ element-by-element.
```{include} parameters/master.md
```

```{include} parameters/material.md
```

```{include} parameters/meta.md
```

Expand Down
3 changes: 1 addition & 2 deletions source/parameters/aperture.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ApertureP:
shape: "" # [string] Aperture shape switch
location: ENTRANCE_END # [enum] Aperture location switch
vertices: [] # [array] Array of vertex points. See below.
material: "" # [string] Material of the Aperture
material: "" # [MaterialP] Material of the Aperture
Copy link
Member

@ax3l ax3l Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is not a string anymore:

Suggested change
material: "" # [MaterialP] Material of the Aperture
material: null # [MaterialP] Material of the Aperture

thickness: 0 # [m] Real number
aperture_shifts_with_body: false # [Boolean] See below.
aperture_active: true # [Boolean] false implies aperture is not operating.
Expand Down Expand Up @@ -106,7 +106,6 @@ The difference between the two lists is simply that lines 2 and 3 are switched a
### material

The `material` parameter sets the material of the aperture.
Using chemical formulas like `Cu` and `Fe` is the most portable.

### vertices component

Expand Down
65 changes: 65 additions & 0 deletions source/parameters/material.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(s:material.params)=
## MaterialP: Definition of materials

```{code} yaml
MaterialP:
- state: # ["solid", "liquid", "gas"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have all four states of matter for completeness? :)

Suggested change
- state: # ["solid", "liquid", "gas"]
- state: # ["solid", "liquid", "gas", "plasma"]

- material: # [CompoundP,ElementP] definiton of the material in terms of compounds or elements.
```

The definition of materials is inspired by Geant4's material handling. One can either use the name, which is the symbol of an element (`"Cu"`, `"H"`, ...) or compound (`"G4_STAINLESS-STEEL"`).
In the future all elements and materials in the [G4 Manual](https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Appendix/materialNames.html) will be supported, without the `G4_`-prefix for elements.

Alternatively custom elements can be defined by

```{code} yaml
ElementP:
- name: # [string] The name of the material
- density: # [kg/m^3] The density of the material
- Z: # [int] The atomic number
- A: # [int] The mass number (equals Z+N)
- N: # [int] The neutron number
- m: # [u] The atomic mass
Comment on lines +18 to +22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not only use the name? Something like #3He is should be sufficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like using the #... notation where sensible, so we keep that aspect compatible with openPMD species: https://github.com/openPMD/openPMD-standard/blob/upcoming-2.0.0/EXT_SpeciesType.md

(Material here describes more than what I linked)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be conflicts with # as begin-comment marker?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We should be ok if we define it as a quoted string.

Copy link
Member

@ax3l ax3l Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-# version is definitely easier to machine read, just more verbose to human write.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidSagan I have a very general question: Is the API which the translator exposes to the interface layer different from what is defined in the PALS standard? Is the PALS standard which we describe here only for the file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First there is the PALS schema which is language agnostic and defines things like parameter names and how to structure the information tree. Then there will be (in development) PALS standards for each language (YAML, etc.) that PALS lattice files can be written in that mirrors the schema. For the translators, what is exposed to the interface layer will be 1) the information in the lattice file and 2) what could be termed "lattice expansion" information which would be things like expression evaluation, floor coordinate evaluation, expanded beam lines, etc.

And yes, what the schema describes is only for the file. The individual translators will document their API. We could talk about trying to have some uniformity between translators but remember the translators will be in different languages so it will not be possible to have a completely uniform API.

Copy link
Member

@ax3l ax3l Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. It is sensible to try to mirror the PALS schema also in APIs, as much as possible/sensible, e.g., when defining properties/function/class names.

Does not prevent to add on top additional helper functions, e.g., to transform, query, convert values between each other, etc.

```

and compounds by

```{code} yaml
CompoundP:
- name: # [string] The name of the material
- density: # [kg/m^3] The density of the material
- elements: # List of MaterialP or CompoundP of which the compound consists
- ratio: # List of ratios of the elements
- mass_ratio: # List of mass-ratios of the elements
```

`ratio` describes the ratio in terms of atom/molecule count, while `mass_ratio` describes it int terms of mass fractions.
If density is not given it will be inferred form the densities and mass fractions of the elements.


### Examples
`material: "Cu"` or `material: "G4_STAINLESS-STEEL"` or define a new material.

Liquid deuterium can be defined with the `ElementP` parameters:
```{code} yaml
ElementP:
- name: "Deuterium(l)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the (l) suffix stand for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"liquid"

- density: 160
- Z: 1
- A: 1
Copy link
Member

@DavidSagan DavidSagan Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deuterium has A = 2.

Suggested change
- A: 1
- A: 2

- m: 2.01
```
and deuterated polyethylene (C2H4) can be defined based on the previous definition
```{code} yaml
CompoundP:
- name: "deutPE"
- density: 1050
- elements:
- "C"
- "Deuterium(l)"
- ratio:
- 2
- 4
```


10 changes: 10 additions & 0 deletions source/parameters/matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(s:matter.params)=
## MatterP: Definition of materials

```{code} yaml
MatterP:
- thickness: # [m] Thickness in meter
- area_density: # [kg/m^2] Density times thickness
- MaterialP: # [MatterP or name] the material
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting:

Suggested change
- MaterialP: # [MatterP or name] the material
- MaterialP: # [MatterP or name] the material

Copy link
Member

@ax3l ax3l Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean:

Suggested change
- MaterialP: # [MatterP or name] the material
- material: # [MaterialP] the material

Note that I also removed or name because we should uniformly allow (or disallow) referencing parameter groups by name (currently, we only do this for element kind). Let's keep it simple for now.

```
Only one of the parameters `thickness` or `area_density` is required.