svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
53 stars 26 forks source link

[ISSUE] Problem with labels using sequences #164

Closed mgracia9 closed 4 months ago

mgracia9 commented 4 months ago

I would like to report an issue with the current version of Genesis. I tried to use &sequence_const. I set the label name to label=test and &lattice value = @test, when running the code .. i get the error:

Unknown Sequence reference in &lattice: test.

I tried to run the Aramis.in as well from the benchmark/Benchmark4-UndErrors folder and I get the same error.

In an older version of the code, both the Benchmark4-UndErrors and my input file works.

(For reference, the older version of genesis was compiled and ran in a ubuntu-22.04 machine, the newer one that it is failing in MacOs-sonoma 14.1).

ZeugAusHH commented 4 months ago

Dear @mgracia9 ,

could you please provide us with:

Many thanks

svenreiche commented 4 months ago

I tested with the recent master branch and it works for me. I cannot reproduce the error. Note that the lattice is already parsed in the setup namelist, so you have to put the sequence definition before the set-up to make it work.

Best Sven


Input deck is:

&sequence_const label = test c0 = 0.84853 &end

&setup rootname=Example1 lattice=Example1.lat beamline=FEL lambda0=1e-10 gamma0=11357.82 delz=0.045000 shotnoise=0 nbins = 8 &end ....

and the lattice file:

D1: DRIFT = { l = 0.44}; D2: DRIFT = { l = 0.24}; QF: QUADRUPOLE = { l = 0.080000, k1= 2.000000 }; QD: QUADRUPOLE = { l = 0.080000, k1= -2.000000 }; UND: UNDULATOR = { lambdau=0.015000, nwig=266, aw= @test, helical= True}; COR: CORRECTOR = { l = 0.24, cx = 1e-6}; FODO: LINE={UND,D1,QF,D2,UND,D1,QD,COR};

FEL: LINE={6*FODO};

and I am getting the desired value for aw.

Output: Opened input file Test.in Adding sequence with label: test Parsing lattice file Example1.lat ... Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853 Ref to series test, result is: aw=0.85853

mgracia9 commented 4 months ago

The example is the one in the include Benchmark/Benchmark4-UndErrors, Git Commit ID: c05d1b5ea50eb95f59e6b6290151859098f83d68 (newer) and Older: d3ea22ce2b70f5305b85f9aba3a45e74e3a9cd21

&setup rootname=Benchmark lattice=Aramis.lat beamline=ARAMIS lambda0=1e-10 gamma0=11357.82 delz=0.045000 shotnoise=0 nbins=8 npart=65536 &end

&sequence_power label=test c0=0.843 dc=-0.01 alpha=1 n0=3 &end

&lattice zmatch=9.5 element=undulator field=aw instance = 0 value = @test add=false &end

&field power=5e3 dgrid=2.000000e-04 ngrid=255 waist_size=30e-6 &end

&beam current=3000 delgam=1.000000 ex=4.000000e-07 ey=4.000000e-07 &end

&track bunchharm=3 &end

Lattice:

D1: DRIFT = { l = 0.44}; D2: DRIFT = { l = 0.24}; QF: QUADRUPOLE = { l = 0.080000, k1= 2.000000 }; QD: QUADRUPOLE = { l = 0.080000, k1= -2.000000 };

UND: UNDULATOR = { lambdau=0.015000,nwig=266,aw=0.84853};

FODO: LINE={UND,D1,QF,D2,UND,D1,QD,D2};

ARAMIS: LINE={6*FODO};

svenreiche commented 4 months ago

This I can reproduce. I will have a look into it

Sven

svenreiche commented 4 months ago

I fixed the error and released a new master branch. I would like to mention that the feature of using the lattice namelist to alter values of the lattice will become obsolete in the future since it is much easier to include the reference to the sequence directly in the lattice file as shown in my first message in this thread.