Skip to main content

Tools to interact with the Serpent2 Monte Carlo code

Project description

pysss2

Python tools to interact with Serpent 2 Monte Carlo code

Pysss2 C-side code is expected to be released with Serpent 2.1.32. Until then, the Serpent 2 development version is needed.

The key resource provided by this package is the GUI to inspect Serpent 2 geometries interactively. The program allows interactive plotting of various cross sections: xy, xz or yz slices. The plot limits and the number of pixels can be chosen and the resulting figures can be saved. Also the material, cell and universe of a point can be checked.

Usage (buttons on the right)

  • Gray buttons change the view limits on the bar on top
    • Geom. Limits resets the default limts
    • View to limits moves the current zoomed in/out limits to the top bar
  • Green buttons updates the plots in addition to changing the values
    • View to limits & Upd is just updating version of the gray button
    • V2L & P1:1 & Upd does the same as above, but also tries to set the number of pixels to match the number of pixels on the displaying screen
    • V2L & P1:10 & Upd does the same as above, but only has one calculated pixel for each 10x10 screen pixels
  • Yellow buttons change the slice (XY, XZ or YZ) to view:
    • to ?? & Upd After clicking a yellow button, click on the plot to choose the location for the new slice
  • The blue button:
    • eval pos Evaluates the material, cell and universe in the point clicked with mouse. The results are shown in the status bar and printed in the terminal.
  • The red buttons:
    • Reload Restarts the plotter, forcing Serpent to regenerate the geometry (e.g. after the input has been changed).
    • Quit Exits the program.

When the python program launches, it launches serpent as a library using ctypes. The python side of the code only accepts a single optional first parameter: "--libsss2so /path/to/libsss2.so". All the rest are passed on to serpent un-parsed. In other words, the other parameters are serpent's parameters, not for the python.

How to install and run the GUI:

  1. Install pysss2 with pip, as explained in the pypi page of the project.

    1. The code uses python 3. It is known to work at least with version 3.6.7. You can check the current with e.g. "python3 -c "import sys; print(sys.version)".
    2. There was a bug in matplotlib, so 'matplotlib>=3.1.1' is needed. You can check the current version with e.g. "python3 -c "import matplotlib; print(matplotlib.version)"
  2. Compile the "lib" target (possibly in a dedicated folder) with the -fpic setting enabled in Makefile. (That is, uncomment the line "CFLAGS += -fpic". Then run "make clean" and then "make lib". The result should be a shared library called libssss2.so. This file includes all the routines of serpent, but they can be called from other programs.

  3. In your serpent input file you need to define colors for all materials (e.g. "rgb 10 20 30").

  4. When running pysss2, the python code must know where to find the libssss2.so shared library. Thus, you need to either add the folder of libsss2.so in LD_LIBRARY_PATH environment or specify the absolute path to the file as the first two parameters: "pysss2 --libsss2so /absolute/path/to/libsss2.so ...". Rest of the parameters are passed to serpent. Here is a full example: "pysss2 --libsss2so /absolute/path/to/libsss2.so -interactiveplotter model -omp 4".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysss2-0.3.dev2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pysss2-0.3.dev2-py3.6.egg (57.1 kB view details)

Uploaded Egg

pysss2-0.3.dev2-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file pysss2-0.3.dev2.tar.gz.

File metadata

  • Download URL: pysss2-0.3.dev2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7

File hashes

Hashes for pysss2-0.3.dev2.tar.gz
Algorithm Hash digest
SHA256 f68c7d52ad59594e5dabbcb6bdc3d0063cad8fcf181e71272306633c351202f6
MD5 b8200bac881f2a810c5a0329c2a2c1b8
BLAKE2b-256 f3dd16b0b10acc445d5d1a613446cf600695853784b33275910f8d9985ad5fbb

See more details on using hashes here.

File details

Details for the file pysss2-0.3.dev2-py3.6.egg.

File metadata

  • Download URL: pysss2-0.3.dev2-py3.6.egg
  • Upload date:
  • Size: 57.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7

File hashes

Hashes for pysss2-0.3.dev2-py3.6.egg
Algorithm Hash digest
SHA256 0288a6baac7b72527011ff050192ec7b734773201b9900fe69d0bdf715a5d4f2
MD5 aba4d177341536840e4d616cac7bfd28
BLAKE2b-256 e1cb381ca6dda81fc7c399624cc1a7943a5f6f791171a6835b2de15332c746eb

See more details on using hashes here.

File details

Details for the file pysss2-0.3.dev2-py3-none-any.whl.

File metadata

  • Download URL: pysss2-0.3.dev2-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7

File hashes

Hashes for pysss2-0.3.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f5d7b0c6a8475b142359739d300bd38d9c47609f0a445d2dee33b32a6ee5bb7
MD5 9887494ea04fe11a8d39e0f9a9228202
BLAKE2b-256 a8b6acbbe93c5b5ff1c0b3b7dad2c410225b1ad0a7b58a99fcbb8fe17c3d4fbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page