Skip to content

Commit be63b3c

Browse files
committed
Add test_fodo.py
1 parent 09ca2eb commit be63b3c

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

examples/TEAPOT/test_fodo.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from orbit.teapot import TEAPOT_Lattice
2+
from orbit.teapot import DriftTEAPOT
3+
from orbit.teapot import QuadTEAPOT
4+
5+
6+
# Parameters
7+
length = 5.0
8+
length_quad = 0.25 * length
9+
length_drift = 0.25 * length
10+
kq = 0.65
11+
nparts = 4
12+
13+
14+
# Method 1
15+
lattice = TEAPOT_Lattice()
16+
17+
node = DriftTEAPOT("drift1")
18+
node.setLength(length_drift * 0.5)
19+
node.setnParts(nparts)
20+
lattice.addNode(node)
21+
22+
node = QuadTEAPOT("quad1")
23+
node.setLength(length_quad)
24+
node.setnParts(nparts)
25+
node.setParam("kq", +kq)
26+
lattice.addNode(node)
27+
28+
node = DriftTEAPOT("drift2")
29+
node.setLength(length_drift)
30+
node.setnParts(nparts)
31+
lattice.addNode(node)
32+
33+
node = QuadTEAPOT("quad2")
34+
node.setLength(length_quad)
35+
node.setnParts(nparts)
36+
node.setParam("kq", -kq)
37+
lattice.addNode(node)
38+
39+
node = DriftTEAPOT("drift3")
40+
node.setLength(length_drift * 0.5)
41+
node.setnParts(nparts)
42+
lattice.addNode(node)
43+
44+
45+
# Method 2
46+
nodes = [
47+
DriftTEAPOT(length=length_drift * 0.5, nparts=nparts, name="drift1"),
48+
QuadTEAPOT(length=length_quad, kq=+kq, nparts=nparts, name="quad1"),
49+
DriftTEAPOT(length=length_drift, nparts=nparts, name="drift2"),
50+
QuadTEAPOT(length=length_quad, kq=-kq, nparts=nparts, name="quad2"),
51+
DriftTEAPOT(length=length_drift * 0.5, nparts=nparts, name="drift3"),
52+
]
53+
lattice = TEAPOT_Lattice()
54+
for node in nodes:
55+
lattice.addNode(node)

0 commit comments

Comments
 (0)