Package: transmutagen
# TransmutagenTransmutation SymPy Code Generator[![Build Status](https://travis-ci.org/ergs/transmutagen.svg?branch=master)](https://travis-ci.org/ergs/transmutagen)# UsageFirst, get the git master version of SymPy and set `PYTHONPATH` to point toit.Transmutagen also depends on- mpmath- sympy >= 1.1- matplotlib- numpy- scipy- pyne- jinja2- gmpy2- Cython## Generating the CRAM approximation to exp(-x) on [0, oo)Runpython -m transmutagen.cram D Nwhere `D` is the degree of the approximation and `N` is the number of digits.A typical run would be something likepython -m transmutagen.cram 14 200Note that the digits returned are not necessarily all accurate. To compute `N`correct digits one generally needs to many more working digits in thecomputation. Furthermore, when roots are taken, the precision may decreaseeven further. So it is recommend to always compute the CRAM expression with avery high number of digits.There are many options, but it is not recommending changing them unless youknow what you are doing. See `python -m transmutagen --help`. Toincrease/reduce the verbosity of the output, use the `--log-level` flag.If you use iTerm2, install `iterm2-tools` (from conda-forge) to get plots inthe terminal.Note: all output and plots are logged to the `logs` and `plots` directories.## Generating solver codeTo generate solver code, usepython -m transmutagen.gensolveThis will generate ``solve.c`` and ``solve.h``. Usepython -m transmutagen.gensolve --helpto see various options, such as how to change the degrees that are generated,and the namespace of the generated functions.This will use a default list of nuclides and sparsity pattern. To add orremove nuclides, modify the JSON file, and pass it in withpython -m transmutagen.gensolve --json-file gensolve.jsonThe format of the JSON file is``` json{"nucs": ["H1", "H2", ...],"fromto": [["H1", "H1"], ["H1", "H2"], ...]}```Where ``"nucs"`` is a list of nuclides and ``"fromto"`` is a list of lists ofevery possible reaction product pair. Every nuclide should be listed as areaction with itself.To generate a JSON file from ORIGEN libraries, runpython -m transmutagen.generate_json /path/to/origen/libs/ --outfile gensolve.jsonThis will save the JSON to ``gensolve.json``. Note that transmutagen comeswith a a JSON file generated from ORIGEN in``transmutagen/data/gensolve_origen.json`` as well as one generated from PyNEin ``transmutagen/data/gensolve.json``.The resulting solve.c will have functions``{namespace}_expm_multiply{N}(double* A, double* b, double* x)``, where``{namespace}`` is the namespace specified by the ``--namespace`` flag to``python -m transmutagen.gensolve`` (the default is ``transmutagen``), and``{N}`` is the degree of the approximation used in the solve, specified by the``--degree`` flag (the default is ``14``). The function computes ``exp(A)*b``and stores the result in ``x``.  ``A`` should be in a flattened format,according to the sparsity pattern the solver was generated from.## Converting ORIGEN libraries to a sparse matrix representationIf you'd like to convert an origen file to a matrix representation, pleaseuse something like:python -m transmutagen.tape9sparse ~/origen22/libs/pwru50.lib --decay ~/origen22/libs/decay.libSee `--help` and the `transmutagen.tape9utils` docs for more details.## Running tests against ORIGENPut `ORIGEN.zip` in the `docker/` directory. Then run./docker/origen_all/build_and_run.shThis requires the docker daemon to be running, and may require `sudo`. Thereare various options, which you can see with./docker/origen_all/build_and_run.sh --helpThis will run both ORIGEN and transmutagen (CRAM) on a suite of ORIGENlibraries, starting nuclides, and times, writing the results to`data/results.hdf5`. The output will also be logged to `logs/origen_all.log`.Be warned total suite takes over 24 hours to run.