Simulating a Masking Element in Elegant

Moderators: cyao, michael_borland

Post Reply
Roussel
Posts: 10
Joined: 16 May 2017, 08:00

Simulating a Masking Element in Elegant

Post by Roussel » 17 May 2017, 20:47

Hello all,
I am trying to simulate a transverse mask for beam shaping in an Emittance Exchange beamline. I would like to create an element that deletes electrons if they fall outside a certain arbitrary region defined by a function abs(y) > f(x). As I don't think this exists as an element currently I tried to create a python script to remove particles using a zero length elegant "SCRIPT" element which calls "python myScript.py -input %i -output %o" as the command. The python file takes in the sdds file "%i" and then writes a new sdds file "%o" with the correct particles. Elegant gives the error " 'csh' is not recognized as an internal or external command, operable program or batch file, Error: unable to find script output file". I tried wrapping the python script in a bash script which gave the same error.

Any help with this issue would be great, or if a masking element could be created using some other means I'm open to suggestions.

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Simulating a Masking Element in Elegant

Post by michael_borland » 22 May 2017, 08:27

Try setting the USE_CSH flag to zero on the SCRIPT element, and see if that helps. Your system appears not to have csh installed.

--Michael

Roussel
Posts: 10
Joined: 16 May 2017, 08:00

Re: Simulating a Masking Element in Elegant

Post by Roussel » 24 May 2017, 16:49

It worked well, thanks! Another question somewhat related is that I have tried to install the python SDDS module but I'm getting an error "ImportError: DLL load failed: The specified module could not be found" despite having all installed files in the same directory. Any ideas?

soliday
Posts: 393
Joined: 28 May 2008, 09:15

Re: Simulating a Masking Element in Elegant

Post by soliday » 25 May 2017, 09:52

Run ldd on the sddsdatamodule.so file to find out which library you are missing:

[root@head ~]# rpm -ql SDDSPython-3.0-1.x86_64
/usr/lib/python2.6/site-packages/sdds.py
/usr/lib/python2.6/site-packages/sddsdatamodule.so
[root@head ~]# ldd /usr/lib/python2.6/site-packages/sddsdatamodule.so
linux-vdso.so.1 => (0x00007fffa8d5e000)
libz.so.1 => /lib64/libz.so.1 (0x00002b4192988000)
libncurses.so.5 => /lib64/libncurses.so.5 (0x00002b4192b9f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b4192dc1000)
librt.so.1 => /lib64/librt.so.1 (0x00002b4192fde000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b41931e7000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b41933eb000)
libm.so.6 => /lib64/libm.so.6 (0x00002b41936f1000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b4193976000)
libc.so.6 => /lib64/libc.so.6 (0x00002b4193b8c000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00002b4193f20000)
/lib64/ld-linux-x86-64.so.2 (0x00000036b4a00000)

One of these will probably say "not found" on your system.

Roussel
Posts: 10
Joined: 16 May 2017, 08:00

Re: Simulating a Masking Element in Elegant

Post by Roussel » 25 May 2017, 13:39

Thanks for the reply. I tried finding the .so file but I could not. I installed using the SDDSPython3.3-x64 and it only has a pyd file and the dll's in the DLL folder.

soliday
Posts: 393
Joined: 28 May 2008, 09:15

Re: Simulating a Masking Element in Elegant

Post by soliday » 25 May 2017, 13:47

Oh, I didn't know you were running Windows. Let met look into it and get back to you.

soliday
Posts: 393
Joined: 28 May 2008, 09:15

Re: Simulating a Masking Element in Elegant

Post by soliday » 25 May 2017, 14:30

I suspect you don't have the Visual C++ 2012 Redistributable for Visual Studio 2012 Update 4 installed. The link I have provided no longer works. It looks like I'll have to rebuild this package with a current version of Visual C.

soliday
Posts: 393
Joined: 28 May 2008, 09:15

Re: Simulating a Masking Element in Elegant

Post by soliday » 25 May 2017, 15:33

I updated the Window's release. You will need to have Python 3.6 installed. When you install SDDSPython, make sure you install it into the same directory as Python 3.6. Also you may need the Visual C++ 2015 Redistributable for Visual Studio 2015 if you don't already have it.
http://www.microsoft.com/en-us/download ... x?id=48145

Roussel
Posts: 10
Joined: 16 May 2017, 08:00

Re: Simulating a Masking Element in Elegant

Post by Roussel » 25 May 2017, 17:59

Thanks for the help! I think there is a security issue though, I am forbidden from downloading it.

soliday
Posts: 393
Joined: 28 May 2008, 09:15

Re: Simulating a Masking Element in Elegant

Post by soliday » 20 Jun 2017, 12:57

Sorry about that. It should be downloadable now.

Post Reply