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.3.0.tar.gz (20.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: genpot-1.3.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.10

File hashes

Hashes for genpot-1.3.0.tar.gz
Algorithm Hash digest
SHA256 29bb66c458194c7f79d1b51a8bd8aaa3c07d008e2a0045424d425c4b41d07e44
MD5 9b716192030a078d9d7ee4514fe0302a
BLAKE2b-256 fd7a4df3b6a29a8a57fdbd29f5f5a938cbae74c61617cef2b79237c2e2cf8b15

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