Dcgun Example - Emittance/Bunch Charge

Beamline Setup

Cornell Dcgun and one Solenoid

Field Map for setup along z direction:


Input Files

Electric Field Map (gdf) : gun_0mm.gdf

Electric Field Map (txt) : gun_0mm.txt

Solenoid Field Map: solenoid_SLA_L60.gdf

GPT .in file: gpt.in



Minimize Emittance (max_enxy)

Maximize bunch charge (qb)


Stdxy < 10


Total Charge = [-300 , 0]

Particle Count = 200

MTE= 120

Gun Voltage= 300

Solenoid Current [0,4]

Sigma_t = 10

Sigma_xy= [0,10]

r_tail = [0,1]



t_tail = [0,1]

t_dip = [0,1]

t_ellips = [0,1]

t_slope = [-1,1]

Running the Optimizer

1) Go to /inopt/examples/dcgun. Start the optimization by running the command:


You should see the following output:


2) If you want to see the progress of the optimization, run the command:

tail -f var_diag.log

If you want to visualize the results as they happen, run gnuplot. When prompted by the line "gnuplot>", enter the line:

p [0:300] [0:5] "./optexch/RUN01_his" u (-1*$15):16

The reason the last two input parameters of the above line reads 15 and 16 is evident when one ones the RUN01_his file. On the top of the file, it says " # variables (14) objectives (2) constraints (1) ".

Therefore, column 15 and 16 are the two competing objectives that we are trying to optimize.

This will plot the emittance as a function of bunch charge in [pC] and [um]. Your plot should look like the following:


Injector Optimization Home

Topic attachments
I Attachment Action Size Date Who Comment
gnuplot.JPGJPG gnuplot.JPG manage 65 K 03 Mar 2019 - 23:00 UnknownUser  
howtorun.JPGJPG howtorun.JPG manage 19 K 03 Mar 2019 - 23:00 UnknownUser  
test.dcgun.JPGJPG test.dcgun.JPG manage 22 K 03 Mar 2019 - 23:00 UnknownUser  
This topic: PhotocathodeBrightBeams/Private > WebHome > InjectorOptimization > DcgunExample
Topic revision: 03 Mar 2019, el535
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback