Skip to content

Commit

Permalink
Merge pull request #4 from monk-04/ml-uf3
Browse files Browse the repository at this point in the history
Updates to pair_uf3- Reading potential from single file, arrays from memory class, MPI to communicate the arrays
  • Loading branch information
monk-04 authored Apr 17, 2024
2 parents 01b1d04 + 18ae982 commit 8ceb6f0
Show file tree
Hide file tree
Showing 11 changed files with 1,330 additions and 187 deletions.
111 changes: 41 additions & 70 deletions doc/src/pair_uf3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,13 @@ Examples
.. code-block:: LAMMPS
pair_style uf3 3
pair_coeff 1 1 Nb_Nb.uf3
pair_coeff 3b 1 1 1 Nb_Nb_Nb.uf3
pair_coeff * * Nb.uf3 Nb
pair_style uf3 2
pair_coeff 1 1 Nb_Nb.uf3
pair_coeff 1 2 Nb_Sn.uf3
pair_coeff 2 2 Sn_Sn.uf3
pair_coeff * * NbSn.uf3 Nb Sn
pair_style uf3 3
pair_coeff 1 1 Nb_Nb.uf3
pair_coeff 1 2 Nb_Sn.uf3
pair_coeff 2 2 Sn_Sn.uf3
pair_style 3b 1 1 1 Nb_Nb_Nb.uf3
pair_style 3b 1 1 2 Nb_Nb_Sn.uf3
pair_style 3b 1 2 2 Nb_Sn_Sn.uf3
pair_style 3b 2 1 1 Sn_Nb_Nb.uf3
pair_style 3b 2 1 2 Sn_Nb_Sn.uf3
pair_style 3b 2 2 2 Sn_Sn_Sn.uf3
pair_coeff * * NbSn.uf3 Nb Sn
Description
"""""""""""
Expand Down Expand Up @@ -70,81 +59,51 @@ interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and
:math:`N_n` denote the number of basis functions per spline or tensor
spline dimension.

The UF3 LAMMPS potential files are provided using multiple pair_coeff
commands. A single UF3 LAMMPS potential file contains information about
one particular interaction only.
With *uf3* style only a single pair_coeff command is used to indicate the
UF3 LAMMPS potential file containing all the two- and three-body interactions
followed by N additional arguments specifying the mapping of UF3 elements to
LAMMPS atom types, where N is the number of LAMMPS atom types:

.. note::

Unlike other MANYBODY and ML potentials in LAMMPS, the atom type for
which the specified potential file should be used for is not
determined from the potential file, but is rather determined from the
user provided atom type numbers after pair_coeff.
* UF3 LAMMPS potential file
* N elements names = mapping of UF3 elements to atom types

As an example, if a LAMMPS simulation contains 2 atom types (elements
'A' and 'B'), the pair_coeff command will be:

.. code-block:: LAMMPS
pair_style uf3 3
pair_coeff 1 1 A_A.uf3
pair_coeff 1 2 A_B.uf3
pair_coeff 2 2 B_B.uf3
pair_coeff 3b 1 1 1 A_A_A.uf3
pair_coeff 3b 1 1 2 A_A_B.uf3
pair_coeff 3b 1 2 2 A_B_B.uf3
pair_coeff 3b 2 1 1 B_A_A.uf3
pair_coeff 3b 2 1 2 B_A_B.uf3
pair_coeff 3b 2 2 2 B_B_B.uf3
pair_coeff * * AB.uf3 A B
The AB.uf3 file should conatin all two-body (A-A, A-B, B-B) and three-body
(A-A-A, A-A-B, A-B-B, B-A-A, B-A-B, B-B-B).

If a value of "2" is specified in the :code:`pair_style uf3` command,
only the two-body potential files are needed. For 3-body interaction the
only the two-body potentials are needed. For 3-body interaction the
first atom type is the central atom. We recommend using the
:code:`generate_uf3_lammps_pots.py` script (found `here
<https://github.com/uf3/uf3/tree/master/lammps_plugin/scripts>`_) for
generating the UF3 LAMMPS potential files from the UF3 JSON potentials.

LAMMPS wild-card character "*" can also be used to specify a single UF3
LAMMPS potential file for multiple interaction. For example-

.. code-block:: LAMMPS
pair_style uf3 3
pair_coeff * * A_A
pair_coeff 3b 1 * * A_A_A
pair_coeff 3b 2 * * B_B_B
The file A_A will be used for 2-body interaction between atom types 1-1,
1-2 and 2-2; file A_A_A will be used 3-body interaction for atom types
1-1-1, 1-1-2, 1-2-2; and so on. Note, using a single interaction file
for all types of interactions is **not** the recommended way of using
:code:`pair_style uf3` and will often lead to **incorrect results**.
<https://github.com/uf3/uf3/tree/develop/lammps_plugin/scripts>`_) for
generating the UF3 LAMMPS potential file from the UF3 JSON potentials.

----------

UF3 LAMMPS potential files in the *potentials* directory of the LAMMPS
distribution have a ".uf3" suffix. All UF3 LAMMPS potential files should
start with :code:`#UF3 POT` and end with :code:`#` characters. Following
shows the format of a generic 2-body UF3 LAMMPS potential file-
UF3 LAMMPS potential file in the *potentials* directory of the LAMMPS
distribution have a ".uf3" suffix. The interaction block in UF3 LAMMPS potential
file should start with :code:`#UF3 POT` and end with :code:`#` characters.
Following shows the format of a generic 2-body and 3-body potential block in
UF3 LAMMPS potential file-

.. code-block:: LAMMPS
#UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE
2B LEADING_TRIM TRAILING_TRIM
2B ELEMENT1 ELEMENT2 LEADING_TRIM TRAILING_TRIM
Rij_CUTOFF NUM_OF_KNOTS
BSPLINE_KNOTS
NUM_OF_COEFF
COEFF
#
The second line indicates whether the potential file contains data for 2-body (:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number on the same line. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS is terminated after issuing an error message. 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.

The format of a generic 3-body UF3 LAMMPS potential file is as follow-

.. code-block:: LAMMPS
#UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE
3B LEADING_TRIM TRAILING_TRIM
3B ELEMENT1 ELEMENT2 ELEMENT3 LEADING_TRIM TRAILING_TRIM
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 @@ -164,10 +123,22 @@ The format of a generic 3-body UF3 LAMMPS potential file is as follow-
.
#
Similar to the 2-body potential file, the third line sets the cutoffs
and length of the knots. The cutoff distance between atom-type I and J
is :code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and
between J and K is :code:`Rjk_CUTOFF`.
The second line indicates whether the block contains data for 2-body
(:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by element
combination interaction, :code:`LEADING_TRIM` and :code:`TRAILING_TRIM`
number on the same line. The current implementation is only tested for
:code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`.
If other values are used LAMMPS is terminated after issuing an error message.
The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described
by the potential block. :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.
Similar to the 2-body potential block, the third line sets the cutoffs and
length of the knots. The cutoff distance between atom-type I and J is
:code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and between
J and K is :code:`Rjk_CUTOFF`.

.. note::

Expand Down Expand Up @@ -204,7 +175,7 @@ This pair style does not support the :doc:`pair_modify <pair_modify>`
shift, table, and tail options.

This pair style does not write its information to :doc:`binary restart
files <restart>`, since it is stored in potential files.
files <restart>`, since it is stored in potential file.

This pair style can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` command. It does not support the
Expand All @@ -219,7 +190,7 @@ if LAMMPS was built with that package. See the :doc:`Build package

This pair style requires the :doc:`newton <newton>` setting to be "on".

The UF3 LAMMPS potential files provided with LAMMPS (see the potentials
The UF3 LAMMPS potential file provided with LAMMPS (see the potentials
directory) are parameterized for metal :doc:`units <units>`.

The single() function of 'uf3' pair style only return the 2-body
Expand Down
9 changes: 8 additions & 1 deletion potentials/Nb_Nb_Nb.uf3 → potentials/Nb.uf3
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION:
3B 0 3 nk
2B Nb Nb 0 3 nk
8.0 31
0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8
27
79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0
#
#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION:
3B Nb Nb Nb 0 3 nk
8.0 4.0 4.0 23 15 15
0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8
0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4
Expand Down
7 changes: 0 additions & 7 deletions potentials/Nb_Nb.uf3

This file was deleted.

Loading

0 comments on commit 8ceb6f0

Please sign in to comment.