Beispiel #1
0
# Generate Lattice (MADX + PTC)
#----------------------------------------------
if not rank:
	os.system("/afs/cern.ch/eng/sl/MAD-X/pro/releases/5.02.00/madx-linux64 < Input/SIS18.madx")
orbit_mpi.MPI_Barrier(comm)

#----------------------------------------------
# Initialize a Teapot-Style PTC lattice
#----------------------------------------------
PTC_File = "SIS_18_BENCHMARK.flt"
Lattice = PTC_Lattice("MACHINE")
Lattice.readPTC(PTC_File)
readScriptPTC('Input/time.ptc')

paramsDict = {}
paramsDict["length"]=Lattice.getLength()/Lattice.nHarm

#----------------------------------------------
# Add apertures
#----------------------------------------------
position = 0
for node in Lattice.getNodes():
	myaperturenode = TeapotApertureNode(1, 10, 10, position)
	node.addChildNode(myaperturenode, node.ENTRANCE)
	node.addChildNode(myaperturenode, node.BODY)
	node.addChildNode(myaperturenode, node.EXIT)
	position += node.getLength()

#----------------------------------------------
# Add the main bunch and lost particles bunch
#----------------------------------------------
Beispiel #2
0
from ext.ptc_orbit import PTC_Lattice
from ext.ptc_orbit import PTC_Node
from ext.ptc_orbit.ptc_orbit import setBunchParamsPTC, readAccelTablePTC,\
     readScriptPTC, updateParamsPTC, synchronousSetPTC, synchronousAfterPTC,\
     trackBunchThroughLatticePTC, trackBunchInRangePTC

PTC_File = "MAIN_1_5_KIND7_1"

length_of_name = len(PTC_File)
ptc_init_(PTC_File, length_of_name - 1)

Lattice = PTC_Lattice("TestCase")

Lattice.readPTC(PTC_File)

print Lattice.getLength(
), Lattice.betax0, Lattice.betay0, Lattice.alphax0, Lattice.alphay0, Lattice.etax0, Lattice.etapx0
PhaseLength = Lattice.getLength()
print Lattice.getLength(), PhaseLength
"""
for node in Lattice.getNodes():
    print node.getType(), node.getLength(), node.getParam("node_index"), node.getParam("betax"), node.getParam("betay"), node.getParam("alphax"), node.getParam("alphay"), node.getParam("etax"), node.getParam("etapx")
"""

b = Bunch()
print "Read Bunch."
runName = "PTC Test"

setBunchParamsPTC(b)
kin_Energy = b.getSyncParticle().kinEnergy()
print kin_Energy, b.charge(), b.mass()
# Initialize a Teapot-Style PTC lattice
#----------------------------------------------
PTC_File = 'Input/PSB_FLAT_Pert_r0.TXT'
Lattice = PTC_Lattice("PSB")
Lattice.readPTC(PTC_File)
readScriptPTC('ptc/fringe.txt')
readScriptPTC('ptc/time.txt')
readScriptPTC('ptc/chrom.txt')
readScriptPTC('ptc/ramp_magnet.ptc')
readScriptPTC('ptc/ramp_cavities.ptc')
readScriptPTC('ptc/energize_lattice.ptc')
readScriptPTC('ptc/twiss_script.ptc')
readScriptPTC('ptc/write_FINAL_SETTINGS.ptc')

paramsDict = {}
paramsDict["length"] = Lattice.getLength() / Lattice.nHarm
print '\nLattice parameters ...'
print '  circumference: \t', Lattice.getLength(), 'm'
print '  alphax0: \t\t', Lattice.alphax0
print '  betax0: \t\t', Lattice.betax0, 'm'
print '  alphay0: \t\t', Lattice.alphay0
print '  betay0: \t\t', Lattice.betay0, 'm'
print '  Dx0: \t\t\t', Lattice.etax0, 'm'
print '  Dpx0: \t\t', Lattice.etapx0, 'm'
print '  harm. number: \t', Lattice.nHarm
print '  nodes: \t\t', Lattice.nNodes

#----------------------------------------------
# Add apertures
#----------------------------------------------
position = 0
Beispiel #4
0
from ext.ptc_orbit import PTC_Lattice
from ext.ptc_orbit import PTC_Node
from ext.ptc_orbit.ptc_orbit import setBunchParamsPTC, readAccelTablePTC,\
     readScriptPTC, updateParamsPTC, synchronousSetPTC, synchronousAfterPTC,\
     trackBunchThroughLatticePTC, trackBunchInRangePTC

PTC_File = "ptc_data_test_0.txt"

length_of_name = len(PTC_File)
ptc_init_(PTC_File, length_of_name - 1)

Lattice = PTC_Lattice("TestCase")

Lattice.readPTC(PTC_File)

print Lattice.getLength(), Lattice.betax0, Lattice.betay0, Lattice.alphax0, Lattice.alphay0, Lattice.etax0, Lattice.etapx0
PhaseLength = Lattice.getLength()
print Lattice.getLength(), PhaseLength

"""
for node in Lattice.getNodes():
    print node.getType(), node.getLength(), node.getParam("node_index"), node.getParam("betax"), node.getParam("betay"), node.getParam("alphax"), node.getParam("alphay"), node.getParam("etax"), node.getParam("etapx")
"""

b = Bunch()
print "Read Bunch."
runName = "PTC Test"

setBunchParamsPTC(b)
kin_Energy = b.getSyncParticle().kinEnergy()
print kin_Energy, b.charge(), b.mass()