Exemplo n.º 1
0
 def fodo(k1, k2):
     """Create FODO lattice. k1 and k2 are the focusing strengths of the
     focusing (1st) and defocusing (2nd) quads, respectively.
     """
     # Instantiate elements
     lattice = TEAPOT_Lattice()
     drift1 = teapot.DriftTEAPOT('drift1')
     drift2 = teapot.DriftTEAPOT('drift2')
     drift_half1 = teapot.DriftTEAPOT('drift_half1')
     drift_half2 = teapot.DriftTEAPOT('drift_half2')
     qf = teapot.QuadTEAPOT('qf')
     qd = teapot.QuadTEAPOT('qd')
     qf_half1 = teapot.QuadTEAPOT('qf_half1')
     qf_half2 = teapot.QuadTEAPOT('qf_half2')
     qd_half1 = teapot.QuadTEAPOT('qd_half1')
     qd_half2 = teapot.QuadTEAPOT('qd_half2')
     # Set lengths
     half_nodes = (drift_half1, drift_half2, qf_half1, qf_half2, qd_half1,
                   qd_half2)
     full_nodes = (drift1, drift2, qf, qd)
     for node in half_nodes:
         node.setLength(L * fill_fac / 4)
     for node in full_nodes:
         node.setLength(L * fill_fac / 2)
     # Set quad focusing strengths
     for node in (qf, qf_half1, qf_half2):
         node.addParam('kq', +k1)
     for node in (qd, qd_half1, qd_half2):
         node.addParam('kq', -k2)
     # Create lattice
     if start == 'drift':
         lattice.addNode(drift_half1)
         lattice.addNode(qf)
         lattice.addNode(drift2)
         lattice.addNode(qd)
         lattice.addNode(drift_half2)
     elif start == 'quad':
         lattice.addNode(qf_half1)
         lattice.addNode(drift1)
         lattice.addNode(qd)
         lattice.addNode(drift2)
         lattice.addNode(qf_half2)
     # Other
     if reverse:
         lattice.reverseOrder()
     lattice.set_fringe(fringe)
     lattice.initialize()
     for node in lattice.getNodes():
         name = node.getName()
         if 'qf' in name:
             node.setTiltAngle(+angle)
         elif 'qd' in name:
             node.setTiltAngle(-angle)
     return lattice
Exemplo n.º 2
0
def getLattice(lattice_length, n_parts):
    elem = teapot.DriftTEAPOT("a drift")
    elem.setLength(lattice_length)
    elem.setnParts(n_parts)
    teapot_lattice = teapot.TEAPOT_Lattice("teapot_lattice")
    teapot_lattice.addNode(elem)
    teapot_lattice.initialize()
    return teapot_lattice
Exemplo n.º 3
0
def getLattice(lattice_length,n_parts,spaceChargeCalculator2p5D):
	elem = teapot.DriftTEAPOT("my_drift")
	elem.setLength(lattice_length)
	elem.setnParts(n_parts)	
	teapot_lattice = teapot.TEAPOT_Lattice("teapot_lattice")
	teapot_lattice.addNode(elem)
	teapot_lattice.initialize()
	# we will put SC nodes as frequently as possible.
	# In this case one for each part of the Drift node
	sc_path_length_min = 0.00000001
	scNodes_arr = scLatticeModifications.setSC2p5DAccNodes(teapot_lattice, sc_path_length_min,spaceChargeCalculator2p5D)
	return (teapot_lattice,scNodes_arr)
Exemplo n.º 4
0
from orbit.teapot_base import MatrixGenerator
from orbit.lattice import AccLattice, AccNode, AccActionsContainer
from bunch import Bunch
from orbit_utils import Matrix

print "Start."

b = Bunch()

syncPart = b.getSyncParticle()
energy = 1.0  #energy in GeV
syncPart.kinEnergy(energy)

lattice = TEAPOT_Lattice("test_lattice")

elem1 = teapot.DriftTEAPOT("drift1")
elem2 = teapot.QuadTEAPOT("quad")
elem3 = teapot.DriftTEAPOT("drift1")

#lattice.addNode(elem1)
lattice.addNode(elem2)
#lattice.addNode(elem3)

#-----------------------------
# Set TEAPOT nodes parameters
#-----------------------------
elem1.setLength(1.0)
elem2.setLength(1.0)
elem3.setLength(1.0)

elem2.setnParts(5)
Exemplo n.º 5
0
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.6, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.9, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.2, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.5, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.8, 0.0)
b.compress()

syncPart = b.getSyncParticle()
energy = 1.0  #energy in GeV
#p = syncPart.energyToMomentum(energy)
#syncPart.pz(p)
syncPart.kinEnergy(energy)

lattice = AccLattice("test_lattice")

elem0 = teapot.DriftTEAPOT("drift0")

lattice.addNode(elem0)

#-----------------------------
# Set TEAPOT nodes parameters
#-----------------------------

elem0.setLength(4.0)

lattice.initialize()

#///////////////////////////////////////////////////////////
ZtoPhi = 2.0 * math.pi / lattice.getLength()
RFVoltage = 0.1
RFPhasep = 150.0
Exemplo n.º 6
0
    f = open("HEBT_lattice.txt", 'r')
    while 1:
        arr = f.readline().split()
        if (len(arr) == 0): break
        elem = None

        if (arr[0] == "IdealMagSteeringDipole"):
            elem = teapot.KickTEAPOT(arr[1])
            if ("DCH" in arr[1]):
                elem.addParam("kx", 0)
            if ("DCV" in arr[1]):
                elem.addParam("ky", 0)

        if (arr[0] == "IdealDrift"):
            elem = teapot.DriftTEAPOT(arr[1])
            elem.setLength(float(arr[2]))

        if (arr[0] == "IdealMagQuad"):
            elem = teapot.QuadTEAPOT(arr[1])
            elem.setLength(float(arr[2]))
            elem.addParam("kq", q * 0.299792458 * float(arr[3]) / pz)

        if (arr[0] == "IdealMagWedgeDipole2"):
            elem = teapot.BendTEAPOT(arr[1])
            elem.setLength(float(arr[2]))
            elem.addParam("kls", [-q * float(arr[3]) * elem.getLength()])
            elem.addParam("theta", float(arr[4]))
            elem.addParam("ea1", float(arr[5]))
            elem.addParam("ea2", float(arr[6]))
            elem.addParam("poles", [1])