simba.Codes.GPT package
Submodules
simba.Codes.GPT.GPT module
Simframe GPT Module
Various objects and functions to handle GPT lattices and commands.
- Classes:
gptLattice: The GPT lattice object, used for
converting the
frameworkObjects defined in theframeworkLatticeinto a string representation of the lattice suitable for GPT input and lattice files.gpt_element: Base class for defining
commands in a GPT input file.
gpt_setfile: Class for defining the
input files for the GPT input file.
gpt_charge: Class for defining the
bunch charge for the GPT input file.
gpt_setreduce: Class for reducing the
number of particles for the GPT input file.
gpt_accuracy: Class for setting the
accuracy for GPT tracking.
gpt_spacecharge: Class for defining the
space charge setup for the GPT input file.
gpt_tout: Class for defining the
number of steps for particle distribution output for the GPT input file.
gpt_csr1d: Class for defining the
CSR calculations for the GPT input file.
gpt_writefloorplan: Class for setting up the
writing of the lattice floor plan for the GPT input file.
gpt_Zminmax: Class for defining the
minimum and maximum z-positions for the GPT input file.
gpt_forwardscatter: Class for defining
scattering parameters for the GPT input file.
gpt_scatterplate: Class for defining a
scattering object for the GPT input file.
gpt_dtmaxt: Class for defining the
step size(s) for the GPT input file.
- class gptLattice(*args, **kwargs)[source]
Bases:
frameworkLatticeClass for defining the GPT lattice object, used for converting the
frameworkLatticeinto a string representation of the lattice suitable for a GPT input file.- Parameters:
args (
Any)kwargs (
Any)
-
accuracy:
int= 6 Tracking accuracy
-
allow_negative_drifts:
bool= True Flag to indicate whether negative drifts are allowed
-
bunch_charge:
float|None= None Bunch charge
-
code:
str= 'gpt' String indicating the lattice object type
-
dtmin:
float|None= None Integration time step size
-
endScreenObject:
Any= None Final screen object for dumping particle distributions
- gdf_to_hdf5(screen, gptbeamfilename, cathode=False, gdf=None, t0=0.0, sval=0.0)[source]
Convert the GDF beam file to HDF5 format and write the beam file.
- Parameters:
screen (laura.models.diagnostic.DiagnosticElement) – Diagnostic element
gptbeamfilename (str) – Name of GPT beam file
cathode (bool) – True if beam was emitted from a cathode
gdf (gdfbeam or None) – GDF beam object
t0 (float) – Initial time co-ordinate
sval (float) – S-position of screen
- Return type:
None
- hdf5_to_gdf(prefix='')[source]
Convert the HDF5 beam distribution to GDF format.
Certain properties of this class, including
sample_interval,override_meanBz,override_toutare also used to updateheaders.- Parameters:
prefix (str) – HDF5 file prefix
- Return type:
None
-
headers:
Dict= {} Headers to be included in the GPT lattice file
-
ignore_start_screen:
Any= None Flag to indicate whether to ignore the first screen in the lattice
-
override_meanBz:
float|int|None= None Set the average particle longitudinal velocity manually
-
override_tout:
float|int|None= None Set the time step output manually
-
particle_definition:
str= None Initial particle definition
- postProcess()[source]
Convert the beam file(s) from the GPT output into HDF5 format, see
gdf_to_hdf5().- Return type:
None
- preProcess()[source]
Convert the beam file from the previous lattice section into GPT format and set the number of particles based on the input distribution, see
hdf5_to_astra().- Return type:
None
- run()[source]
Run the code with input ‘filename’
GPTLICENSE must be provided in
global_parameters.Average properties of the distribution are also calculated and written to an <>emit.gdf file in master_subdir.
- Return type:
None
-
screen_step_size:
float= 0.1 Step size for screen output
- property space_charge_mode: str | None
Get the space charge mode based on
globalSettingsorfile_block.- Returns:
Space charge mode as string, or None if not provided.
- Return type:
str
-
time_step_size:
float= 1e-11 Step size for output data during tracking
- write()[source]
Writes the GPT input file from
writeElements()to <master_subdir>/<self.objectname>.in.- Return type:
None
- writeElements()[source]
Write the lattice elements defined in this object into a GPT-compatible format; see
elementObjects.The appropriate headers required for GPT are written at the top of the file, see the write_GPT function in
gpt_element.- Returns:
The lattice represented as a string compatible with GPT
- Return type:
str