lindemann

lindemann is a python package to calculate the Lindemann index of a lammps trajectory

https://github.com/n720720/lindemann

Science Score: 77.0%

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

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

Keywords

analysis cheminformatics chemistry chemoinformatics gromacs lammps lammps-trajectory lindemann lindemann-index md-simulation molecular-dynamics ovito phase-transition phase-transitions simulation temperature-ramps transition-phase
Last synced: 4 months ago · JSON representation ·

Repository

lindemann is a python package to calculate the Lindemann index of a lammps trajectory

Basic Info
  • Host: GitHub
  • Owner: N720720
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 20.5 MB
Statistics
  • Stars: 24
  • Watchers: 0
  • Forks: 5
  • Open Issues: 16
  • Releases: 11
Topics
analysis cheminformatics chemistry chemoinformatics gromacs lammps lammps-trajectory lindemann lindemann-index md-simulation molecular-dynamics ovito phase-transition phase-transitions simulation temperature-ramps transition-phase
Created over 5 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct Citation Security

README.md

lindemann

[![Build status](https://github.com/N720720/lindemann/workflows/build/badge.svg?branch=master&event=push)](https://github.com/N720720/lindemann/actions?query=workflow%3Abuild) [![Python Version](https://img.shields.io/pypi/pyversions/lindemann.svg)](https://pypi.org/project/lindemann/) [![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/N720720/lindemann/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit) [![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/N720720/lindemann/blob/master/.pre-commit-config.yaml) [![Semantic Versions](https://img.shields.io/badge/%F0%9F%9A%80-semantic%20versions-informational.svg)](https://github.com/N720720/lindemann/releases) [![License](https://img.shields.io/pypi/l/lindemann)](https://pypi/l/lindemann/) ![](images/459_Atoms_brass.gif) lindemann is a Python package to calculate the Lindemann index of Molecular Dynamics simulation trajectorys, as well as the progression of the Lindemann index per frame or per atom and frame of temperature ramps for phase transition analysis.

Installation

It requires python >=3.9,<3.12

bash pip install lindemann

or install with Poetry

bash poetry add lindemann

Usage

console lindemann [OPTIONS] TRJFILE

or if installed with Poetry:

bash poetry run [OPTIONS] TRJFILE

Precautions:

Make sure you have enough memory available before you run any flags despite the -t flag. You can check the memory use by using the -m or the --mem_use Option. The high memory use will be fixed as soon as the numpy.nanmean() function with axis is available for numba.

Multiprocessing:

If you don't have a hpc environment available to distribute the workload, I added multiprocessing to parallize the tasks if you are using your local machine. Just add more than one filename with the -t flag. Currently multiprocessing is only implemented for the -t flag, due to the memory issues mentioned above.

Arguments:

  • TRJFILE...: The trajectory file(s). If no other option is selected, the lindemann index is calculated for the trajectory. Equivalent to the -t option. If you pass more than one trajectory they will be calculated in parallel. Only works with no flag or -t flag. [required]

Options:

  • -t: Calculates the Lindemann-Index for the Trajectory file(s) [default: False]
  • -f: Calculates the Lindemann-Index for each frame. [default: False]
  • -a: Calculates the Lindemann-Index for each atom for each frame. [default: False]
  • -p: Returns a plot Lindemann-Index vs. Frame. [default: False]
  • -l: Saves the individual Lindemann-Index of each Atom in a lammpstrj, so it can be viewed in Ovito. [default: False]
  • -v, --version: Prints the version of the lindemann package.
  • -ti, -timeit: Uses timeit module to show running time [default: False]
  • -m, -mem_use: Calculates the memory use. Run it before you use any of the cli functionality despite the -t flag [default: False]
  • --help: Show this message and exit.

Demo

Basic usage to calculate the Lindemann Index:

The package has a plotting feature. It will show the a plot Lindemann index vs. the frames. If the trajectory file is a temperature ramp, it is possible to determine the phase transition.

Usage of the of the lammpstrj file output feature to save the progression for each atom per frame into a LAMMPS trajectory file. Afterwards the trajectory can be viewed with ovito for example, here the Lindemann progression was used for the OVITO color coding feature.

Motivation

In my research I have investigated simulated annealing of brass nanoparticles. I had to determine the melting point of many different cluster sizes and zinc compositions and I have chosen the Lindemann index for this purpose. I wanted a cli tool that could be easily used with MPI due to the amount of calculations. I also wanted to get to know numba better and so I combined them in this project. numba does not really like pythonic code and can handle verbose code better.

ybyygu had already worked out a nice solution in cython with the Welford algorithm, which was found to be easy to convert into numba. whashi44 in turn had presented a great Numpy version with a GUI, his version convinced me to use ovito for read write tasks of LAMMPS trajectories.

For the determination of the melting point of nanoparticles you can often find plots in the literature which follow the following scheme. A temperature range is defined where the phase transition is likely to take place. Then step lengths for the temperature are defined and then a trajectory is calculated for the respective temperature. If a phase transition occurs, this can be recognized by a jump of the lindemann index as shown in figure 1

Figure 1.

I realized that the development of the Lindemann index can be observed across the trajectory. The Welford algorithm allows a live calculation of the mean std, which means that the development of the Lindemann index can be observed as the simulations run. Since I worked with heat ramps for simulated annaeling, I was interested in the development of the Lindemann index across the frames of these trajectories.

This could be realized by a modification of the Welford algorithm. With this method you can observe the change of the Lindemann index per frame. Here, too, a characteristic change of the Lindemann index occurs, with which the phase transition can also be determined. The development of the Lindemann index over the frames can then be visualized as a plot for the phase transition determination. If the temperature is plotted against the Lindemann index, the temperature can also be read directly for the phase transition, as seen in figure 2.

Figure 2: Note the noise of the temperature was smoothed with help of numpy.convolve with a box size of 40.

With a further modification of the Welford algorithm you can also see the contribution of each atom to the lindemann index for each frame. This was especially interesting for me because atomic properties can be easily visualized with tools like OVITO. This gives one a detailed view of the phase transition. This is especially interesting for the investigation of nanoparticles during the phase transition, as they often start melting from the surface. This is where the method in combination with OVITO offers a good starting point for further investigations.

Furthermore, computational costs can be reduced by using one heat ramp instead of many trajectories with discrete temperatures. As an example, see figures 1 and 2. In figure 1, 16 trajectories with different temperatures were chosen to determine the phase transition. The step width was reduced near the phase transition for a better determination of the phase transition. Each trajectory has 50k steps, that is 800k in total, whereas in figure 2 the heatramp has only 200k steps.

Background

A key problem with the measurement of the melting point of nanoparticles is that with decreasing size of a given nanoparticle the phase transition, defined as the temperature of a sudden change in the enthalpy, becomes less pronounced. This is caused by the surface effect: for a given cluster the surface area is larger compared to a bulk structure of the same size. Melting does not take place all at once, but is a longer melt transition and no longer really a melting point.

The Lindemann index, stated in the following equation presents a solution for this problem. It describes the root-mean-square (rms) fluctuation of the bonds or interatomic distance in the system over time (or temperature, if the temperature of the system changes as the simulation progresses). The Lindemann index is a more robust method to determine the melting point of nanoparticles, as opposed to enthalpy. Accordingly the Lindemann index is often considered, when the melting point of nano-particles is of interest. The index is defined as,

where is the number of atoms in the nano particle. is the distance between atom i and atom j. The brackets representing a time or temperature average. The rms of the bond fluctuation is considerable lower for a solid than for a liquid, due to restrained degrees of freedom. In a solid, the atoms hold on to their position and only fluctuate around their equilibrium positions. During the melting process the atoms become more mobile and are able to leave their original position. The translation movement of atoms is magnitudes larger than that of the bond fluctuations of a solid. As a result, the Lindemann index rises dramatically at the melting point and therefore gives a suitable observable to determine the transition phase. In effect, the Lindemann index measures a sort of average difussion coefficient for the atoms in the system.

A key problem with much of the literature regarding the Lindemann index, is that there is a uncertainty of where to define the phase transition within a Lindemann plot. On the grounds that the melting point is a macroscopic definition for bulk structures. But here nanoparticles differ: because of their relative small size, compared to bulk structures, melting can occur fist on their relative large surface, compared to the volume they obtain and followed by the melting of core of the particle. Therefore a temperature range, rather then a melting point, is observed, as stated by Neyts in their work.

🛡 License

License

This project is licensed under the terms of the GPLv3 license. See LICENSE for more details.

📃 Citation

@misc{lindemann, author = {Sebastian Thurm}, title = {lindemann is a python package to calculate the Lindemann index of a lammps trajectory as well as the progression of the Lindemann index per frame of temperature ramps for phase transition analysis.}, year = {2020}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/N720720/lindemann}} }

Credits

The Lindemann index is introduced in the following paper,\ F. A. Lindemann, Zeitschrift für Phys. 1910, 11, 609–612.\ This package is based on the work from ybyygu and whashi44 on calculating the Lindemann index.\ The visualisations in this Readme are made with Ovito.\ A. Stukowski, Model. Simul. Mater. Sci. Eng. 2010, 18, 15012. link.\ This project was generated with python-package-template.\ The Welford Algorith can be found in:\ Donald E. Knuth ,The art of computer programming, volume 2 (3rd ed.): seminumerical algorithms, Addison-Wesley Longman Publishing Co, 1997, 232.

Owner

  • Name: Sebastian Thurm
  • Login: N720720
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: lindemann
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Sebastian
    family-names: Thurm
    email: s.thurm@protonmail.com
repository-code: 'https://github.com/N720720/lindemann'
repository-artifact: 'https://pypi.org/project/lindemann/'
abstract: >-
  lindemann is a Python package to calculate the Lindemann
  index of Molecular Dynamics simulation trajectorys, as
  well as the progression of the Lindemann index per frame
  or per atom and frame of temperature ramps for phase
  transition analysis.
keywords:
  - Molecular Dynamics
  - Cheminformatics
  - Lindemann
  - Lindemann Index
  - Phase transition
license: GPL-3.0-or-later

GitHub Events

Total
  • Issues event: 2
  • Watch event: 5
Last Year
  • Issues event: 2
  • Watch event: 5

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 225
  • Total Committers: 6
  • Avg Commits per committer: 37.5
  • Development Distribution Score (DDS): 0.613
Top Committers
Name Email Commits
dependabot[bot] 4****]@u****m 87
Sebastian Thurm 6****0@u****m 51
Sebastian Thurm s****m@s****e 36
N720720 s****m@p****m 29
dependabot-preview[bot] 2****]@u****m 19
Jonathan Yik Chang Ting j****7@g****m 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 14
  • Total pull requests: 101
  • Average time to close issues: 3 months
  • Average time to close pull requests: 28 days
  • Total issue authors: 5
  • Total pull request authors: 3
  • Average comments per issue: 1.29
  • Average comments per pull request: 0.87
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 97
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • N720720 (10)
  • yutengyan (1)
  • alighavipanjeh (1)
  • pppyk (1)
  • KasperBuskPedersen (1)
Pull Request Authors
  • dependabot[bot] (97)
  • N720720 (6)
Top Labels
Issue Labels
enhancement (9) benchmarking (3) testing (3) question (2) dependencies (2) bug (1) documentation (1)
Pull Request Labels
dependencies (97) python (50) github_actions (47) enhancement (4)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 37 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 10
  • Total maintainers: 1
pypi.org: lindemann

lindemann is a python package to calculate the Lindemann index of a lammps trajectory as well as the progression of the Lindemann index per frame of temperature ramps for phase transition analysis.

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 37 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 14.2%
Stargazers count: 15.2%
Average: 17.0%
Dependent repos count: 21.8%
Downloads: 23.7%
Maintainers (1)
Last synced: 4 months ago

Dependencies

poetry.lock pypi
  • appdirs 1.4.4 develop
  • astroid 2.9.3 develop
  • atomicwrites 1.4.0 develop
  • attrs 21.4.0 develop
  • bandit 1.7.2 develop
  • black 19.10b0 develop
  • certifi 2021.10.8 develop
  • charset-normalizer 2.0.11 develop
  • darglint 1.8.1 develop
  • docker 5.0.3 develop
  • dparse 0.5.1 develop
  • gitdb 4.0.9 develop
  • gitpython 3.1.26 develop
  • idna 3.3 develop
  • iniconfig 1.1.1 develop
  • isort 4.3.21 develop
  • jinja2 3.0.3 develop
  • lazy-object-proxy 1.7.1 develop
  • markupsafe 2.0.1 develop
  • mccabe 0.6.1 develop
  • memory-profiler 0.60.0 develop
  • mypy 0.812 develop
  • mypy-extensions 0.4.3 develop
  • pathspec 0.9.0 develop
  • pbr 5.8.0 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pydocstyle 6.1.1 develop
  • pylint 2.12.2 develop
  • pytest 6.2.5 develop
  • pyupgrade 2.31.0 develop
  • pywin32 227 develop
  • regex 2022.1.18 develop
  • requests 2.27.1 develop
  • safety 1.10.3 develop
  • smmap 5.0.0 develop
  • snowballstemmer 2.2.0 develop
  • stevedore 3.5.0 develop
  • tokenize-rt 4.2.1 develop
  • typed-ast 1.4.3 develop
  • typer-cli 0.0.12 develop
  • urllib3 1.26.8 develop
  • websocket-client 1.2.3 develop
  • wrapt 1.13.3 develop
  • bottleneck 1.3.2
  • cfgv 3.3.1
  • click 7.1.2
  • colorama 0.4.4
  • commonmark 0.9.1
  • cycler 0.11.0
  • distlib 0.3.4
  • filelock 3.4.2
  • fonttools 4.29.0
  • icc-rt 2020.0.133
  • identify 2.4.6
  • importlib-metadata 4.10.1
  • intel-openmp 2020.0.133
  • kiwisolver 1.3.2
  • llvmlite 0.38.0
  • matplotlib 3.5.1
  • nodeenv 1.6.0
  • numba 0.55.1
  • numpy 1.21.5
  • ovito 3.6.0
  • packaging 21.3
  • pathlib 1.0.1
  • pillow 9.0.0
  • platformdirs 2.4.1
  • pre-commit 2.17.0
  • psutil 5.9.0
  • pygments 2.11.2
  • pyparsing 3.0.7
  • pyside2 5.15.2.1
  • python-dateutil 2.8.2
  • pyyaml 6.0
  • rich 11.1.0
  • setuptools-scm 6.4.2
  • shellingham 1.4.0
  • shiboken2 5.15.2.1
  • six 1.16.0
  • toml 0.10.2
  • tomli 2.0.0
  • typer 0.3.2
  • typing-extensions 4.0.1
  • virtualenv 20.13.0
  • zipp 3.7.0
pyproject.toml pypi
  • Jinja2 ^3.0.3 develop
  • bandit ^1.7.2 develop
  • black ^19.10b0 develop
  • darglint ^1.8.0 develop
  • docker ^5.0.0 develop
  • isort ^4.3.21 develop
  • memory-profiler ^0.60.0 develop
  • mypy ^0.812 develop
  • pydocstyle ^6.0.0 develop
  • pylint ^2.7.4 develop
  • pytest ^6.2.4 develop
  • pyupgrade ^2.20.0 develop
  • safety ^1.9.0 develop
  • typer-cli ^0.0.12 develop
  • Bottleneck ^1.3.2
  • icc-rt ^2020.0.133
  • importlib_metadata >=1.6,<5.0
  • matplotlib ^3.2.2
  • numba >=0.52
  • numpy >=1.18, <1.22
  • ovito ^3.1.1
  • pathlib ^1.0.1
  • pre-commit ^2.6.0
  • psutil ^5.9.0
  • python >=3.7.3,<3.11
  • rich >=3.3.2,<12.0.0
  • typer ^0.3.0
.github/workflows/build.yml actions
  • actions/cache v2.1.6 composite
  • actions/checkout v2 composite
  • actions/setup-python v2.2.2 composite
  • fastify/github-action-merge-dependabot v2.5.0 composite
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/greetings.yml actions
  • actions/first-interaction v1 composite
.github/workflows/release-drafter.yml actions
  • release-drafter/release-drafter v5.17.6 composite
docker/Dockerfile docker
  • python 3.7-slim-buster build