Skip to main content

Python-based version of the Barbieri/Van Hove phase shift calculation package for LEED/XPD modelling

Project description

This package is a Python-based implementation of the Barbieri/Van Hove phase shift (a.k.a. phshift) calculation package needed to produce phase shifts for various LEED packages (including CLEED), as well as for certain XPD packages. To quote the original authors’ site:

“The phase shift calculation is performed in several steps:

  1. Calculation of the radial charge density for a free atom.

  2. Calculation of the radial muffin-tin potential for atoms embedded in a surface defined by the user (the surface is represented by a slab that is periodically repeated in 3 dimensions, within vacuum between the repeated slabs); various approximations to the exchange potential are available; relativistic effects are taken into account.

  3. Calculation of phase shifts from the muffin-tin potential.

  4. Elimination of pi-jumps in the energy dependence of the phase shifts.”

The phsh.py script aims to simplify these steps with a single command. For more information please read the documentation at http://pythonhosted.org//phaseshifts/

Install

The phaseshifts package requires CPython 2.6 or later and also uses the numpy, scipy and periodictable packages. Currently, it has only been tested extensively with Python 2.7 on Windows, so there are no guarantees with other platforms. To perform a setup follow the steps below.

  1. Install the numpy, scipy and periodictable packages.

    On systems compatible with PyPI this can be done using the command:

    pip install numpy scipy periodictable

    Or if you have the easy_install package:

    easy_install install numpy scipy periodictable

    Older versions of numpy & scipy did not allow simultaneous installation - if you experience problems then try first installing numpy before attempting to install scipy.

    The periodictable package allows lookup of the most common crystal structure for a given element and is instrumental in many of the convenience functions contained in the model module.

    Alternatively download and install these packages manually following the instructions provided for the respective packages.

  2. To install the phaseshifts package:

    python setup.py install

    With any luck the package has been installed successfully. A set of test scripts are provided, however a few simple checks may suffice using the command and an interactive session of the python interpreter:

    phsh.py --help
    python
    >>> import phaseshifts
    >>> from phaseshifts.lib import libphsh  # compiled FORTRAN .pyd or .so using f2py
    >>> libphsh.hartfock
    <fortran object>
    >>> exit(0) # okay if no errors found above

    If these execute without errors then it is likely that all is well, but in case of problems or bugs please use the contact provided below and I will do my best to address the problem quickly.

Ubuntu

On Ubuntu (14.04 LTS) some dependencies were needed, which can be installed using the following bash commands:

$ sudo apt-get install python-pip python-numpy python-scipy python-dev libblas-dev gfortran # should install f2py as a dependency of numpy/scipy
$ sudo pip install phaseshifts==0.1.5-dev | tee phaseshifts.log # explicit version needed
$ sudo ln -s /usr/bin/python2.7 /usr/bin/python # can skip if only a single version of python is installed

You may need to verifiy whether the phsh.py script is installed on the system $PATH and therefore please check by typing:

$ python /usr/local/bin/phsh.py --help # should work okay
$ phsh.py --help # may not work: phsh.py should be on the $PATH and executable

About the code

The example source codes provided in this package are intended to be instructional in calculating phase shifts. While it is not recommended to use the example code in production, the code should be sufficient to explain the general use of the library.

If you aren’t familiar with the phase shift calculation process, you can read further information in doc/ folder:

  • phshift2007.rst - a brief user guide/documentation concerning the input files (& details of the original fortran phshift package).

  • phaseshifts.pdf - a more detailed overview of the library functions and how to calculate phase shifts using the convenience functions in this package. This is not yet finished and so the reader is referred to the above document for the time being.

For those wanting a crash course of the Van Hove / Tong programs, I advise reading the phsh2007.txt document. See the examples/ directory to get an idea of the structure of the input files (for a random selection of models & elements). In particular see the cluster_Ni.i file for helpful comments regarding each line of input.

Those of you who are eager to generate phase shifts - first look at the example cluster files for a bulk and slab calculation, noting that the atoms in the model are in fractional units of the a basis vector for the unitcell (SPA units). Next, after creating a bulk and slab model in the cluster.i format, simply use the following python code:

>>> from phaseshifts.phsh import Wrapper as phsh
>>> phsh.autogen_from_inputs(bulk_file, slab_file)

This will hopefully produce the desired phase shift output files (at least for simple models) and works by assessing the two models to determine what output to produce. For more detailed documentation and function use refer to the pdf manual.

Development

For those wishing to see the latest code, please visit: https://bitbucket.org/Liam_Deacon/phaseshifts/overview

Disclaimer: The latest code is actively developed and may potentially be bug ridden… It is recommended that you use it with caution and a great deal of skepticism!

Acknowledgements

As with all scientific progress, we stand on the shoulders of giants. If this package is of use to you in publishing papers then please acknowledge the following people who have made this package a reality:

  • A. Barbieri and M.A. Van Hove - who developed most of the original fortran code. Use A. Barbieri and M.A. Van Hove, private communication. (see doc/phsh2007.txt for further details).

  • E.L. Shirley - who developed part of the fortran code during work towards his PhD thesis (refer to the thesis: E.L. Shirley, “Quasiparticle calculations in atoms and many-body core-valence partitioning”, University of Illinois, Urbana, 1991).

  • Christoph Gohlke - who developed the elements.py module used extensively throughout for the modelling convenience functions (see ‘elements.py’ for license details).

I would also be grateful if you acknowledge this python package (phaseshifts) as: L.M. Deacon, private communication.

Thanks

I wish to personally add a heart-felt thanks to both Eric Shirley and Michel Van Hove who have kindly allowed the use of their code in the libphsh.f file needed for the underlying low-level functions in this package.

Contact

This package is developed/maintained in my spare time so any bug reports, patches, or other feedback are very welcome and should be sent to: liam.deacon@diamond.ac.uk

The project is in the early developmental stages and so anyone who wishes to get involved are most welcome (simply contact me using the email above).

To do

  1. Documentation - the manual has been started, but is not complete and thus is a high priority. The current aim is to use sphinx to generate html and latex documents for semi-automated generation of both the tutorial and supporting website. If you have the phaseshifts source and the sphinx and the numpydoc PyPi packages then you can try making html or latex manuals using make html or make latexpdf commands from the doc/ directory.

  2. Test suit to verify the package is working as expected.

  3. GUI frontend (Qt ui files are provided in the gui/ directory for anyone wishing to undertake this challenge). Other frontends are welcome (I use Qt due to familiarity/experience). For those wishing a sneak preview, try executing main.pyw

See TODO.rst for more information.

Author list

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

phaseshifts-0.1.5-dev.zip (2.8 MB view details)

Uploaded Source

Built Distributions

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

phaseshifts-0.1.5_dev-py2.7-win32.egg (551.0 kB view details)

Uploaded Egg

phaseshifts-0.1.5-dev.win32-py2.7.exe (567.3 kB view details)

Uploaded Source

File details

Details for the file phaseshifts-0.1.5-dev.zip.

File metadata

  • Download URL: phaseshifts-0.1.5-dev.zip
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for phaseshifts-0.1.5-dev.zip
Algorithm Hash digest
SHA256 a1f869e03673f4f7b7704fac1bb6b4224c2cf00f6b573b7ef23063bd9ef6848f
MD5 01302e250e4e310faf252395cc4fdc4c
BLAKE2b-256 69c2d9ba5a61a37208a68a937bfacfb6f8c1b1a0698472e47f6d59b476c4414f

See more details on using hashes here.

File details

Details for the file phaseshifts-0.1.5_dev-py2.7-win32.egg.

File metadata

File hashes

Hashes for phaseshifts-0.1.5_dev-py2.7-win32.egg
Algorithm Hash digest
SHA256 4583e4e468060476fe084205f2e1bc35721fba3313fc78887c64685a03c423c4
MD5 7c479b691c41bbc838ba9fbf9aa10f76
BLAKE2b-256 41c25ebe909e105cc54e9db31e48176b442798f434ed12b62d50d1918c680a20

See more details on using hashes here.

File details

Details for the file phaseshifts-0.1.5-dev.win32-py2.7.exe.

File metadata

File hashes

Hashes for phaseshifts-0.1.5-dev.win32-py2.7.exe
Algorithm Hash digest
SHA256 6e11047529ef65dba85fd0263f9b292bbc39e15a40555e96e3714db16fd0395e
MD5 828ee07faf8bd8ffd4d8651547d11c86
BLAKE2b-256 8351b88b79a48e99453fd7ed978ea6ad4f331c36877bf928ef995ad5a1ae8d37

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