Helps with LAMMPS input/output
Project description
lammps_helper
Install
pip install lammps_helper
About
lammps_helper is python code to help create input files for and extract output data from the molecular dynamics package LAMMPS. It contains just a few features that I needed for my specific project and is not meant to be general in any way.
You're probably asking yourself 'Why do I need to download another package? Why doesn't this already exist?' So here is a table comparing lammps_helper to some other packages.
Package | Features | Issues |
---|---|---|
lammps_helper | Adds topology to LAMMPS data | Limited to simple structures |
Extracts info about dipoles, thermo data. | ||
lammps-interface | Converts cif to LAMMPS data | Doesn't apply symmetry operations when building supercells. Works for cif files with P1 symmetry. |
Sophisticated topology detection | ||
atomsk | Converts all kinds of structure files including LAMMPS | Doesn't create topology (bonds, angles, dihedrals) |
Manipulates structures (create, delete, and move atoms) | ||
topotools | All kinds of manipulations on atoms, molecules, and topology. | Can either set bonds for all atoms or single bonds. |
Great for organics, polymers, proteins. | A bit awkward to use with crystals. | |
Vesta | Converts and displays all kinds of files. | Doesn't output topology. |
atomman | Easy interaction with LAMMPS from python. Setup and run simulations, extract output. Imports cif. | Doesn't deal with topology. |
lammps-cython | Another python wrapper for LAMMPS. Setup and run, extract output. | No structural manipulation. |
pymatgen | General suite of tools for handling materials computations via python. Includes some LAMMPS input/output and control. Has a function that generates bonds. | No way to set specific bonds, uses a global distance parameter. |
moltemplate | Generates LAMMPS data using molecule building instructions. | Can't import .cif, .xyz, etc. |
Obviously there is more than one workflow to create structure data for LAMMPS. The simplest is to write the LAMMPS data file by hand. That works for very simple structures up to about 10 atoms and/or bonds per unit cell. If there are no explicit bonds in your structure you can simply convert a .cif, .xyz or similar file into LAMMPS format with (from easiest to hardest) atomsk, topotools, lammps-interface, atomman, or pymatgen. If your structure has bonds and you don't want to write out all the bonds, angles, and dihedrals by hand you have a couple options.
-
Write out instructions to build the structure with moltemplate. Requires a lot of time up front, but makes it easy to change the structure in future.
-
Convert a .cif, .xyz, etc. file to a LAMMPS data file. Fast and easy, but tweaking the structure is tedious.
If you choose to convert a .cif, .xyz, etc. it can be done several ways. One way is to use atomsk to convert the cif file to a LAMMPS file like this:
atomsk crystal.cif lmp
That will give you a LAMMPS data file with a list of all the atoms in the unit cell. You can then add bonds, angles, and dihedrals using lammps_helper like this:
import lammps_helper as lh
import pandas as pd
bond_pairs = pd.DataFrame(data = dict(element1 = ['N', 'C'],
element2 = ['C', 'C'],
cutoff = [1.5, 1.52]))
bonds = lh.add_bond_data(f'my_structure.lmp', bond_pairs)
angles = lh.add_angle_dihedral_data(f'my_structure.lmp', bonds)
With lammps_helper you must specify each type of bond by the names of the atoms and a cutoff distance (in whatever units are used in the LAMMPS file, probably Angstroms). Any atoms of those types within that distance will be bonded. This code is very simple and probably can't handle cyclic molecules. If you have a structure with rings I suggest you try moltemplate or lammps-interface.
lammps_helper also has code useful for extracting data about molecular dipoles and for plotting distributions of dipole directions over time. See the documentation for more info. lammps_helper is available on github.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lammps_helper-0.1.4.tar.gz
.
File metadata
- Download URL: lammps_helper-0.1.4.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25716f0aee9de6d1ac76f97bcc1426a154152a24f1cfbdc97f830a4b0353b66d |
|
MD5 | 28063c72d10d4eff5bbf9d3f09a4d247 |
|
BLAKE2b-256 | 678b6f45e9f3626aa22c6c504524629029ded89f8917b7820556534368fb50a6 |
File details
Details for the file lammps_helper-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: lammps_helper-0.1.4-py3-none-any.whl
- Upload date:
- Size: 35.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f66dae7eb87b9b4a20fb4c3eaab366edce7df3c40bb076295b7edba237f808 |
|
MD5 | 3dbfcfac1722b2fcc6801b55498f57b8 |
|
BLAKE2b-256 | e366a26e9428a02d29de28a4021190d3316d739c5239852e0667040d619c161f |