Skip to content

Commit

Permalink
Updated documentation of UF3 LAMMPS POT file format
Browse files Browse the repository at this point in the history
  • Loading branch information
monk-04 committed Oct 5, 2023
1 parent 9b6464d commit 9156fa4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lammps_plugin/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The kokkos accelerator variants of uf3 (i.e. :code:`pair_style uf3/kk` with GPU
Running lammps with UF3 potential
=====

**The old style of listing all UF3 LAMMPS potential files after pair_coeff * * in single line still works but a warning is printed**
**The old style of listing all UF3 LAMMPS potential files after pair_coeff * * in single line is deprecated**

To use UF3 potentials in lammps just add the following tags to the lammps input file-

Expand Down Expand Up @@ -112,14 +112,14 @@ The 2-body UF3 lammps potential file should have the following format-
.. code:: bash
#UF3 POT
2B LEADING_TRIM TRAILING_TRIM
2B LEADING_TRIM TRAILING_TRIM TYPE_OF_KNOT_SPACING
Rij_CUTOFF NUM_OF_KNOTS
BSPLINE_KNOTS
NUM_OF_COEFF
COEFF
#
The first line of all UF3 lammps potential files should start with :code:`#UF3 POT` characters. The next line indicates whether the file contains UF3 lammps potential data for 2-body (:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS will stop with an error message.
The first line of all UF3 lammps potential files should start with :code:`#UF3 POT` characters. The next line indicates whether the file contains UF3 lammps potential data for 2-body (:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS will stop with an error message. The :code:`TYPE_OF_KNOT_SPACING` specifies if the spacing between the knots is constant :code:`uk` (uniform-knots/linear-knots) or is non-uniform :code:`nk`.

The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described by the potential file. :code:`NUM_OF_KNOTS` is the number of knots (or the length of the knot vector) present on the very next line. The :code:`BSPLINE_KNOTS` line should contain all the knots in ascending order. :code:`NUM_OF_COEFF` is the number of coefficients in the :code:`COEFF` line. All the numbers in the BSPLINE_KNOTS and COEFF line should be space-separated.

Expand All @@ -133,7 +133,7 @@ The 3-body UF3 lammps potential file has a format similar to the 2-body potentia
.. code:: bash
#UF3 POT
3B LEADING_TRIM TRAILING_TRIM
3B LEADING_TRIM TRAILING_TRIM TYPE_OF_KNOT_SPACING
Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ
BSPLINE_KNOTS_FOR_JK
BSPLINE_KNOTS_FOR_IK
Expand All @@ -154,7 +154,7 @@ The 3-body UF3 lammps potential file has a format similar to the 2-body potentia
#
The first line is similar to the 2-body potential file and the second line has :code:`3B` characters indicating that this file describes 3-body interaction. The :code:`3B` is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS will stop with an error message.
The first line is similar to the 2-body potential file and the second line has :code:`3B` characters indicating that this file describes 3-body interaction. The :code:`3B` is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS will stop with an error message. The :code:`TYPE_OF_KNOT_SPACING` specifies if the spacing between the knots is constant :code:`uk` (uniform-knots/linear-knots) or is non-uniform :code:`nk`.

Similar to the 2-body potential file, the third line sets the cutoffs and length of the knots. The cutoff distance between atom-type 1 and 2 is :code:`Rij_CUTOFF`, atom-type 1 and 3 is :code:`Rik_CUTOFF` and between 2 and 3 is :code:`Rjk_CUTOFF`. **Note the current implementation works only for UF3 potentials with cutoff distances for 3-body interactions that follows** :code:`2Rij_CUTOFF=2Rik_CUTOFF=Rjk_CUTOFF` **relation.**

Expand Down
10 changes: 8 additions & 2 deletions lammps_plugin/scripts/generate_uf3_lammps_pots.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def write_uf3_lammps_pot_files(chemical_sys,model,pot_dir):
for interaction in chemical_sys.interactions_map[2]:
key = '_'.join(interaction)
files[key] = "#UF3 POT\n"
files[key] += "2B %i %i\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)
if model.bspline_config.knot_strategy == 'linear':
files[key] += "2B %i %i uk\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)
else:
files[key] += "2B %i %i nk\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)

files[key] += str(model.bspline_config.r_max_map[interaction]) + " " + \
str(len(model.bspline_config.knots_map[interaction]))+"\n"
Expand All @@ -131,7 +134,10 @@ def write_uf3_lammps_pot_files(chemical_sys,model,pot_dir):
for interaction in model.bspline_config.interactions_map[3]:
key = '_'.join(interaction)
files[key] = "#UF3 POT\n"
files[key] += "3B %i %i\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)
if model.bspline_config.knot_strategy == 'linear':
files[key] += "3B %i %i uk\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)
else:
files[key] += "3B %i %i nk\n"%(model.bspline_config.leading_trim,model.bspline_config.trailing_trim)

files[key] += str(model.bspline_config.r_max_map[interaction][2]) \
+ " " + str(model.bspline_config.r_max_map[interaction][1]) \
Expand Down

0 comments on commit 9156fa4

Please sign in to comment.