radiasoft / jupyter.radiasoft.org

RadiaSoft public Jupyter Server announcements and global configuration
https://jupyter.radiasoft.org
Apache License 2.0
4 stars 0 forks source link

Synergia: code needs to be updated in docker container #20

Closed bruhwiler closed 6 years ago

bruhwiler commented 6 years ago

Input from a Synergia user:

"The synergia instance in the RadiaSoft jupyter server seems to be missing some electron lens functionality. This is the output from the attached elens_trouble.py script on on the jupyter server:

jupyter_screenshot

On my laptop:

terminal_screenshot

I think both chef and synergia2 probably need to be updated."

Here is the Python code that is being used:

coding: utf-8

In[120]:

get_ipython().run_line_magic('matplotlib', 'inline')

import numpy as np import matplotlib.pyplot as pt import synergia

elens_len = 2.0 # length [m] elens_current = 1.2 # current [A] elens_energy = 0.00001 # electron energy [GeV] elens_radius = 0.001 # RMS radius [m] longrms = 1.0 zoffset = 0.5 * longrms

beam_ke = 0.25

help(synergia.foundation.Reference_particle)

refpart = synergia.foundation.Reference_particle(1, synergia.foundation.pconstants.mp, beam_ke+synergia.foundation.pconstants.mp) print "refpart energy: ", refpart.get_total_energy() print "refpart momentum: ", refpart.get_momentum()

lattice = synergia.lattice.Lattice("foo") lattice.set_reference_particle(refpart)

elens = synergia.lattice.Lattice_element("elens", "lens") elens.set_double_attribute("l", 0.0) elens.set_double_attribute("eenergy", elens_energy1000.0) # element takes energy in MV elens.set_double_attribute("current", elens_currentelens_len) elens.set_double_attribute("radius", elens_radius) elens.set_double_attribute("longrms", longrms) elens.set_double_attribute("gaussian", 1.0)

lattice.append(elens)

stepper = synergia.simulation.Independent_stepper(lattice, 1, 1)

print synergia.lattice.chef_beamline_as_string(stepper.get_lattice_simulator().get_chef_lattice().get_beamline())

robnagler commented 6 years ago

Updated to synergia 7e6fad88ad714776cb138a009eb020acbfa74975 and chef 7324b5dc2e448e79fd25cfe4ae8cba9f7aa94747.

Your server must be restarted to take effect. Look in ~/rsmanifest.json to verify versions.