Skip to content

HamishGBrown/py_multislice

Repository files navigation

DOI

py_multislice

Python multislice slice code

GPU accelerated using pytorch

Ionization based off Flexible Atomic Code (FAC).

Installation

  1. Clone or branch this repo into a directory on your computer
    $ git clone https://github.com/HamishGBrown/py_multislice.git
  1. (Optional) create a new conda environment for py_multislice:
    $ conda create --name py_multislice
    $ conda activate py_multislice
  1. In the command-line (Linux or Mac) or your Python interpreter (Windows) install pytorch, you will need to choose the conda version appropriate for your GPU (or CPU only version if required) see here, and in the root directory of your local copy of the repo run the install command for py_multislice
    $ conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
    $ pip install -e .

All necessary dependencies should also be installed, if you have issues try installing in a fresh anaconda environment (step 2).

  1. If you would like to perform ionization based TEM simulations, download and install the flexible atomic code (FAC), including the python interface (pfac), from here. I've only successfully got this working on Linux, your mileage may vary on Windows operating systems.

  2. As an added precaution, run the Test.py script to ensure everything is working as expected

    $ python Test.py
If you didn't instal PFAC in the last step then you will get error messages from the ionization routines, if you only want to perform non-ionization based TEM simulations then you can ignore these failed tests. You can also run run Orbital_normalization.py to test that the ionization cross-sections are being calculated appropriately.

Documentation and demos

Documentation can be found here, for demonstrations and walk throughs on common simulation types see the Jupyter Notebooks in the Demos folder. The Notebook for STEM-EELS is still under construction.

Bug-fixes and contributions

Message me, leave a bug report and fork the repo. All contributions are welcome.

Acknowledgements

A big thanks to Philipp Pelz for teaching me the ins and outs of pytorch and numerous other discussions on computing and electron microscopy. Credit to Colin Ophus for many discussions and much inspiration re the PRISM algorithm (of which he is the inventor). Thanks to my boss Jim Ciston for tolerating this side project! Thankyou to Thomas Aarholt for Python advice and testing of different libraries. Thanks to Adrian D'Alfonso, Scott Findlay and Les Allen (my PhD advisor) for originally teaching me the art of multislice and ionization.