ocelot-collab / ocelot

OCELOT is a multiphysics simulation toolkit designed for studying FEL and storage ring-based light sources.
GNU General Public License v3.0
84 stars 58 forks source link

First test with Ocelot #165

Closed hnakahara79 closed 1 year ago

hnakahara79 commented 1 year ago

Dear Developers,

This is going to be my first test with Ocelot. I have an electron beam with information of:

(1) x-position (2) y-position (3) z-position (4) Px, x-momentum (5) Py, y-momentum (6) Pz, z-momentum (7) Particles weight

I have to study the transportation of this beam with beam-optics (Quadrupoles).

However, as a start, I would like to inject this electron beam in the Ocelot and would like to see its evolution in vacuum. After that I would like to proceed with the beam optics (gradually).

Please, could you guide me how I can study the electron beam evolution in vacuum. I want to do this in order to find the optimum position of the first magnet.

Thank you.

st-walker commented 1 year ago

Hi @hnakahara79 , I would recommend you have a look at

https://github.com/ocelot-collab/ocelot#tutorials

Perhaps it also makes sense to first consider the linear optics without particle tracking.

hnakahara79 commented 1 year ago

Hi @st-walker , thank you for your quick reply.

I will go through the tutorials. However, I may have lots of questions .... I will start understanding the tutorials.

Thank you.

hnakahara79 commented 1 year ago

Hi @st-walker,

I installed Ocelot manually on ubuntu 22.04 (by downloading the last release zip file). Please note that I installed it with the command python3 setup.py install.

Then, I test the installation with the following line in a python script:

import ocelot print('ocelot:', ocelot.version)

I received an error message as shown below:

beam.py: module NUMEXPR is not installed. Install it if you want higher speed calculation. optics.py: module NUMEXPR is not installed. Install it if you want higher speed calculation. Traceback (most recent call last): File "/home/nakahara/Documents/ocelot-18.02.0/test1.py", line 13, in import ocelot File "/home/nakahara/Documents/ocelot-18.02.0/ocelot/init.py", line 29, in from ocelot.cpbd.magnetic_lattice import MagneticLattice File "/home/nakahara/Documents/ocelot-18.02.0/ocelot/cpbd/magnetic_lattice.py", line 122, in class MagneticLattice: File "/home/nakahara/Documents/ocelot-18.02.0/ocelot/cpbd/magnetic_lattice.py", line 129, in MagneticLattice def init(self, sequence, start=None, stop=None, method=MethodTM()): File "/home/nakahara/Documents/ocelot-18.02.0/ocelot/cpbd/optics.py", line 686, in init self.sec_order_mult = SecondOrderMult() File "/home/nakahara/Documents/ocelot-18.02.0/ocelot/cpbd/optics.py", line 36, in init self.tmat_multip = nb.jit(nopython=True, parallel=True)(self.numba_apply) File "/home/nakahara/.local/lib/python3.10/site-packages/numba/core/decorators.py", line 220, in wrapper raise TypeError( TypeError: The decorated object is not a function (got type <class 'method'>).

Please, could you tell me how to fix this error.

Thank you very much.

hnakahara79 commented 1 year ago

Hi @st-walker,

Once again I downloaded from GitHub zip file. Now, I can run tutorials.

hnakahara79 commented 1 year ago

Hi @st-walker,

just last question: I downloaded Ocelot from from GitHub zip file, but it is working without doing python3 setup.py install.

Is it OK ? Will it make any impact on its performance ?

Thank you.

sergey-tomin commented 1 year ago

Hi @hnakahara79,

This will not affect its performance. We often use it this way if there is no way to clone it from GitHub.

Sergey.

st-walker commented 1 year ago

python setup.py install is a means to put the library in your PYTHONPATH and install any dependencies. if you already have the dependencies installed and ocelot is already in your PYTHONPATH then strictly yeah it is not necessary. performance is unimpacted as sergey says. if you care about performance, install jit, numba, etc (as the warnings say I think) which setup.py will not take care of because they're optional dependencies

hnakahara79 commented 1 year ago

Hi @sergey-tomin and @st-walker,

thanks to both of you for quick reply and clarification.

Best regards, Naka