Page 1 of 1

Help with generating sdds_bunch

Posted: 12 Jun 2018, 09:56
by Neeraj
Hi all,

I have the phase space of bunches after degradation and collimation, generated by Geant4 code (in .root, .csv or .txt format). I need a little help feeding these distributions to sdds_bunch to track them through a transport line. Is there a conversion tool or C++ library that can convert CSV files to sdds format? Or is there a manual way to go about it by imitating the parameter and column names?

Thanks
-Neeraj

Re: Help with generating sdds_bunch

Posted: 12 Jun 2018, 13:13
by michael_borland
Neeraj,

You can use the program csv2sdds for comma-separated-values data, or plaindata2sdds for more general data. Following that, you will probably need to use sddsprocess to convert to the quantities and units needed by elegant
  • t --- arrival time in seconds
  • p --- momentum (beta*gamma)
  • x, y --- horizontal and vertical coordinates in meters
  • xp, yp --- horizontal and vertical slopes (dx/dz, dy/dz). Dimensionless.
--Michael

Re: Help with generating sdds_bunch

Posted: 14 Jun 2018, 09:04
by Neeraj
Michael,

Thanks for the instructions. I have converted a csv file into sdds with the column names and units as specified in the csv2sdds section of the sdds toolkit manual. However, loading the bunch to elegant file gives me problems. I get the error:
------------
File bunch1.sdds opened and checked.
Read page 1 from file
0 particle ID slots per bunch
60 rows in page 1
File bunch1.sdds was used up and closed.
a total of 60 data points were read

No particles left in input file(s)
error: no particles in input file
------------

I do not have a particle ID column. Could this be the problem?
Truncated versions of files and scripts that I am using are attached.
In my text file (bunch1.txt), the columns are: TOF [s], p[beta*gamma], x[m], xp, y[m], yp, z[m], zp

Best,
Neeraj

Re: Help with generating sdds_bunch

Posted: 15 Jun 2018, 08:43
by michael_borland
Neeraj,

The problem is with our .ele file. You need to set reuse_bunch=1 in the &sdds_beam command, so that the optimization tracking will use the same page of the file repeatedly.

--Michael

Re: Help with generating sdds_bunch

Posted: 18 Jun 2018, 03:26
by Neeraj
It works now. Thanks Michael.

Re: Help with generating sdds_bunch

Posted: 09 Mar 2019, 04:31
by Akhyani
Dear Michael,

I have faced the same issue while I wanted to scan bunch current for multi-bunch tracking. I added reuse_bunch = 1 in &sdds_beam. Everything is OK, but it sticks in tracking the particles, writing:

tracking 1400000 particles

and nothing happens then. I attached the files for you. Any help will be appreciated.

Re: Help with generating sdds_bunch

Posted: 11 Mar 2019, 11:05
by michael_borland
Reusing the bunch is incompatible with duplicating the bunch for multi-bunch tracking; I'll try to fix this for the next release in a few months.

However, since multi-bunch tracking is very time-consuming, I suggest breaking the run up into several runs. The easy way to do this is with the macro substitution option. E.g., instead of

Code: Select all

&vary_element name=Q, item=TOTAL, enumeration_file = scan1.sdds, enumeration_column = I, index_number=0, index_limit=6 &end
use

Code: Select all

&alter_elements name=Q, item=TOTAL, value="(<QnC> 1e9 /)" &end
then

Code: Select all

mpiexec -np 128 Pelegant MBITemplate.ele -macro=QnC=176
See attached file.

--Michael

Re: Help with generating sdds_bunch

Posted: 12 Mar 2019, 10:16
by Akhyani
Hi Michael,

Thank you very much. It worked.

--Mina