gevero / py_gmm

A Generalized Multiparticle Mie code, especially suited for plasmonics
GNU General Public License v3.0
22 stars 12 forks source link

py_gmm

Binder

A Fortran 90 implementation of the Generalized Multiparticle Mie method. If you find py_gmm useful for generating results included in publications, please consider citing the following paper:

Pellegrini G., Mattei G., Bello V. and Mazzoldi P. (2007) Interacting metal nanoparticles: Optical properties from nanoparticle dimers to core-satellite systems Materials Science and Engineering: C 27:1347–1350. doi:10.1016/j.msec.2006.07.025

Use it right away

Do you want to try py_gmm without even installing it? Well, just click this badge Binder or the one on top of the page! Then simply navigate to the examples folder and run one of the Jupyter Notebooks. Modify the examples to suite your needs and run it! Just one thing: please run only light calculations!!!

Use Docker

Another option is to use docker. The instructions below are for linux, but should work on other platforms with minor modifications:

  1. Install docker on your machine (do this, and the following, as root if using linux).
  2. In the py_gmm base folder, the one that contains the Dockerfile, run docker build --tag pygmm:1.0 . to build the py_gmm image.
  3. Run docker run --publish 8888:8888 --detach --name pygmm pygmm:1.0 to start a container named pygmm and forward the 8888 port from the container to your machine. A jupyter server is already running inside the container.
  4. Run docker exec -it pygmm jupyter notebook list to get the token that will give you access to the jupyter server.

Installation the hard way

Installing py_gmm should be fairly easy. First of all you need a python distribution on your system. The simplest thing to do, for any operating system (Windows, OSX or Linux), would be to install Anaconda, a beautiful, free, and easy to use python distribution: the relevant installations instructions are found here. Then you must also install The Jupyter Notebook, which is already bundled in Anaconda.

The second step would be installing a Fortran compiler. If you are not new to compilers, you're already covered here. If don't know much about compilers yet, my advice is to go for gfortran. While I strongly advise you to work under Linux (this code was developed under Linux), I will try to provide minimal informations for the installations under WIndows and OSX. Keep in mind that I never installed or tried my software under these platforms, so I offer no guarantee whatsoever. Nevertheless if you encounter any problem please open an Issue here on github and we'll try to work it out. Regarding installation on different platforms it goes as follows:

The third step would be to get py_gmm itself. If you are familiar with git and github you can simply clone the repository, otherwise just download the zipped version of the repo and unpack it wherever you like.

Then we finally come to compiling: if you are under Linux or OSX sh f2py.sh should be sufficient to build everything. Under Windows try and change f2py.sh to f2py.bat and see what happens. If it does not work open an issue and we'll work it out.

Usage

The best thing to do for the moment is to start from the .ipynb files in the examples folder. You can load them in your local Jupyter Notebook instance: they should give you a fair idea about how to proceed for your calculations. Each function in the code features a detailed documentation easily accessible with the Shift-Tab tool-tip shortcut from the Jupyter Notebook interface.