Skip to main content

Generate potential files used by LAMMPS

Project description

Generate parameter files used in LAMMPS

genpot is a light-weight Python package for generating parameter files to be used in LAMMPS. Per 2022-06-16, the package supports the Stillinger-Weber, Vashishta and TIP4P force-fields, with multiple base parameterizations. However, the framework is written in a general way that makes it easy to add other force-fields. The strength of the package is that the user can modify the parameters as they like. This is in particular useful when parameterizing a force-field.

Installation

Install from PyPi using

$ pip install genpot

or from GitHub (might be unstable) using

$ pip install git+https://github.com/evenmn/generate-potential-files

Basic Usage

The short script

from genpot import StillingerWeber
potential = StillingerWeber('si_stillinger_1985')
potential.write("Si.sw")

will generate the original parameterization for silicon by Stillinger and Weber from 1985:

$ cat Si.sw

...

# element 1 element 2 element 3
#           epsilon, sigma, a, lambda, gamma, cos(theta)
#           A, B, p, q, tol

Si   Si   Si        2.1683     2.0951        1.8       21.0        1.2  -0.333333
                  7.049556   0.602225        4.0        0.0        0.0

Modify parameters

Say, for instance, that you want to change the value of p from 4.0 to 5.0. This can easily be done by

potential.update_params({'SiSiSi': {'p': 5.0}})

List available base parameterizations

Above, we used the base parameterization "si_stillinger_1985". How can we find other parameterizations? All available parameterizations can be found by the command potential.list_params(). Example:

from genpot import Vashishta
potential = Vashishta()
potential.list_params()
h2o_wang_2007, lnp_branicio_2009, sic_vashishta_2007, sio2_vashishta_1990

Thereafter, the preferred parameterization can be set using potential.set_params():

potential.set_params("h2o_wang_2007")

Coupled parameters

For a substance of pure silicon, as in the example above, we will only have one interaction group (interactions between the silicon atoms). For more complex substances, like water, there are multiple interaction groups that we need to assign values to. All the values can be set manually as shown below:

potential.update_params({'OOO': {'Zi': -0.6, 'Zj': -0.6, 'r4s': 5.0},
                         'HHH': {'Zi': 0.3, 'Zj': 0.3, 'r4s': 5.0},
                         'OHH': {'Zi': -0.6, 'Zj': 0.3, 'r4s': 5.0, 'H': 1000.0},
                         'HOO': {'H': 1000.0}})

However, often the parameters are coupled. Here, the effective charge of H and O should be the same in all interaction groups, which makes it excessive to update all of them manually. Instead, the effective charges can be updated globally, using:

potential.update_params({'global': {'Z_H': 0.3}})

Also, we often want a parameter to be the same across all the groups. Especially for cutoff distances, this is convenient. Similar to the global group, there is a all group that simplifies this operation:

potential.update_params({'all': {'r4s': 5.0}})

Sometimes, we want to change a parameter of several groups, but not all. This can be done by specifying the different groups separated by a comma:

potential.update_params({'OHH,HOO': {'H': 1000.0}})

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

genpot-1.1.1.tar.gz (11.9 kB view details)

Uploaded Source

File details

Details for the file genpot-1.1.1.tar.gz.

File metadata

  • Download URL: genpot-1.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.50.2 importlib-metadata/4.11.3 keyring/21.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for genpot-1.1.1.tar.gz
Algorithm Hash digest
SHA256 0b7426b170a605616e228fd47d3aad5b14365869baf7ced4f4bcedcf83e996f3
MD5 cfc8b4dd7c04fd12dbb42a6ae053ce1e
BLAKE2b-256 5d706d9128c05eef8093d35310e53d7dce98e3653a3d0f1a374de83b8926fe2f

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