Surfaxe

Surfaxe: Systematic surface calculations - Published in JOSS (2021)

https://github.com/SMTG-Bham/surfaxe

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 5 committers (40.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.8%) to scientific vocabulary

Keywords

computational-chemistry materials pymatgen python3 science surfaces vasp

Keywords from Contributors

materials-science materials-design

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 83% confidence
Engineering Computer Science - 80% confidence
Last synced: 4 months ago · JSON representation

Repository

Dealing with slabs for first principles calculations of surfaces

Basic Info
Statistics
  • Stars: 64
  • Watchers: 3
  • Forks: 14
  • Open Issues: 8
  • Releases: 5
Topics
computational-chemistry materials pymatgen python3 science surfaces vasp
Created over 5 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

Build status Documentation Status DOI

surfaxe logo header

Calculating the surface properties of crystals from first principles typically introduces several extra parameters including slab thickness, vacuum size, Miller index, surface termination and more. These factors all influence key properties of interest, making it a challenge to carry out simulations repeatably and draw reliable conclusions. Surfaxe is a Python package for automating and simplifying density functional theory (DFT) calculations of surface properties, as well as providing analytical tools for bulk and surface calculations.

The code is organised according to the best-practice workflow below:

drawing

The main features include:

  1. Slab generation: Automated generation of surface slabs from command line.
  • All unique zero-dipole symmetric terminations of slabs are cleaved from a bulk structure.
  • Slabs can be organised into separate folders, optionally with all the required input files to run each calculation.
  1. Raw data processing: Extracting data from convergence tests.
  • Parsing the convergence testing folders created using the slab generation scripts.
  • Producing dataframes and csv files of summary data.
  • Plotting scripts visualising convergence with respect to slab and vacuum thickness.
  1. Analysis: Various scripts for surface and bulk calculations.
  • Calculation of planar and macroscopic average of the electrostatic potential through the slab to determine absolute electron energies (ionisation potential, electron affinity).
  • Nearest neighbour atom determination and bond distance analysis (useful for geometry relaxation convergence checks).

Surfaxe primarily supports the VASP DFT code, however most of the generation module is code-agnostic. In the future we would like to add support for more periodic codes in the other modules.

Example outputs

Analysis of average bond lengths as a function of slab thickness Bond analysis example

Surface energy convergence checks with respect to vacuum and slab thickness Surface energy convergence example

See the tutorials directory for more examples.

Installation

Surfaxe is a Python 3 package and requires pymatgen and other standard scientific Python packages.

Recommended installation is to git clone and install with pip in a stable virtual environment:

sh git clone https://github.com/SMTG-UCL/surfaxe.git cd surfaxe pip install -e .

The -e option creates links to the source folder so any changes to the code are reflected on the path.

For the code to generate VASP input files along with the surface slabs, POTCARs need to be set up with pymatgen.

Usage

Quick start

Surfaxe can be used via the command line and via Python API. The docs include information on both, and the built-in -h option is available in the command line interface for each of the scripts.

We recommend starting off by looking at the dedicated tutorials. These Jupyter notebooks will guide you through most of the functionality of the package.

The tutorials can also be run interactively on Binder: Binder

Command line interface

The scripts can be separated into four modules that follow a typical surfaces workflow; these are generation, convergence, analysis and data, with added plotting functionality. The vast majority of surfaxe functionality is available via the command line interface, but the python API allows for more flexibility.

Generation:

  • surfaxe-generate: Generates all unique symmetric zero-dipole surface slabs for one or more specified Miller indices or up to a maximum Miller index specified, in any format supported by pymatgen. Optionally provides all VASP input files.

Convergence:

  • surfaxe-parse-energies: Extracts the relevant data from the convergence folders set up with surfaxe-generate where calculations were run with VASP. Plots convergence graphs of the variation of surface energy with respect to slab and vacuum thickness. Can optionally parse core atom and vacuum energies as well.
  • surfaxe-parse-structures: Collects the structures' metadata into a json file and optionally performs bond analysis as in surfaxe-bonds.

Analysis:

  • surfaxe-bonds: Parses the structure, looking for bonds between specified atoms.
  • surfaxe-simplenn: Predicts the coordination environment of atoms for simple structures.
  • surfaxe-complexnn: Predcts the coordination environment of atoms in more complex structures where the default prediction algorithm fails.
  • surfaxe-potential: Calculates the planar potential of the slab along c-axis, the gradient of the planar potential and optionally macroscopic potential.
  • surfaxe-surface-dipole: Returns the surface dipole needed for macroscopic ionisation potential calculation
  • surfaxe-cartdisp: Calculates the Cartesian displacements of atoms during relaxation from intial and final structures.

Plotting:

  • surfaxe-plot-surfen and surfaxe-plot-enatom: Plot the surface energy and energy per atom based on data from surfaxe-parsefols with individual customisability
  • surfaxe-plot-bonds: Plots the bond distance with respect to fractional coordinate, based on surfaxe-bonds
  • surfaxe-plot-potential: Plots the planar (and macroscopic) potential based on data already analysed with surfaxe-potential

Data:

  • surfaxe-core: Collects the core energy level from the middle of a surface slab, based on supplied bulk core atom and the list of its nearest neighbours.
  • surfaxe-vacuum: Collects the vacuum potential level from a VASP LOCPOT file.

Pymatgen issues warnings whenever the hash in a VASP POTCAR present does not match the one in their library. Only one warning of the same type will be issued by default. All warnings can be suppressed completely by adding the following to your script:

python import warnings warnings.filterwarnings('ignore')

Development notes

Bugs, features and questions

Please use the Issue Tracker to report bugs or request features in the first instance.

Contributions to interface with this package are most welcome. Please use the "Fork and Pull" workflow to make contributions and stick as closely as possible to the following:

  • Code style should comply with PEP8 where possible. Google's house style is also helpful, including a good model for docstrings.
  • Please use comments liberally!
  • Add tests wherever possible, and use the test suite to check if everything still works.

Tests

Unit tests are in the tests directory and can be run from the top directory using pytest. Please run these tests whenever submitting bug fix pull requests and include new tests for new features as appropriate.

We also use CI build and testing using GitHub Actions.

License and how to cite

Surfaxe is free to use under the MIT License. If you use it in your research, please cite

K. Brlec, D. W. Davies and D. O. Scanlon, Surfaxe: Systematic surface calculations. Journal of Open Source Software, 6(61), 3171, (2021) DOI: 10.21105/joss.03171

Dependencies

Surfaxe relies primarily on Pymatgen for manipulating crystal structures and interfacing with the DFT codes.

Detailed requirements

Surfaxe is compatible with python 3.7+ and requires the following packages:

Contributors

List of contributors:

  • Katarina Brlec (@brlec)
  • Daniel Davies (@dandavies99)
  • David Scanlon (@scanlond)

Acknowledgements:

  • Surfaxe has benefited from useful discussions with Adam Jackson (@ajjackson), Seán Kavanagh (@kavanase), Graeme Watson (@wantsong), Luisa Herring-Rodriguez (@zccalgh), Christopher Savory (@cnsavory), Bonan Zhu (@zhubonan) and Maud Einhorn (@maudeinhorn).
  • Thanks to Keith Butler (@keeeto) for providing a starting point and validation examples for calculating the planar average electrostatic potential via the macrodensity package.
  • We thank @eihernan, @pzarabadip and @danielskatz for taking the time to review the code and offering valuable suggestions for improvements.

Owner

  • Name: Scanlon Materials Theory Group
  • Login: SMTG-Bham
  • Kind: organization
  • Location: UCL, UK

GitHub Events

Total
  • Issues event: 1
  • Watch event: 10
Last Year
  • Issues event: 1
  • Watch event: 10

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 308
  • Total Committers: 5
  • Avg Commits per committer: 61.6
  • Development Distribution Score (DDS): 0.305
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
brlec 4****c 214
Daniel Davies d****9@g****m 84
Sean Kavanagh s****9@i****k 8
Daniel S. Katz d****z@i****g 1
Katarina Brlec k****c@k****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 16
  • Total pull requests: 5
  • Average time to close issues: 4 months
  • Average time to close pull requests: 25 days
  • Total issue authors: 9
  • Total pull request authors: 3
  • Average comments per issue: 0.69
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • zhubonan (5)
  • dandavies99 (3)
  • brlec (2)
  • DVads (1)
  • wwbosell (1)
  • wladerer (1)
  • Andrew-S-Rosen (1)
  • badw (1)
  • ezpzbz (1)
Pull Request Authors
  • kavanase (3)
  • wladerer (1)
  • danielskatz (1)
Top Labels
Issue Labels
enhancement (5)
Pull Request Labels

Dependencies

requirements.txt pypi
  • numpy >=1.14.3
  • pandas *
  • pymatgen >=2020.1.28
  • scipy *
  • spglib *
setup.py pypi
  • numpy *
  • pandas *
  • pymatgen *
  • scikit-learn *
  • scipy *
  • spglib *
.github/workflows/tests.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite