Skip to content

Commit 67eae55

Browse files
authored
Merge branch 'develop' into develop
2 parents 7201ed9 + 6bca7d8 commit 67eae55

File tree

6 files changed

+210
-98
lines changed

6 files changed

+210
-98
lines changed

doc/source/etc.rst

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
.. _etc:
23

34
ChIMES in LAMMPS
@@ -63,13 +64,75 @@ Note that the following must also be set in the main LAMMPS input file, to use C
6364
atom_style atomic
6465
atom_modify sort 0 0.0
6566
67+
**Important Considerations:**
68+
69+
Atom Type Mass Matching
70+
"""""""""""""""""""""
71+
72+
The element masses defined in the ChIMES parameter file must match the masses defined in the LAMMPS data file. The matching is done by comparing masses to within 0.001 atomic mass units. The order of atom types in the files does not matter - only the mass values need to match.
73+
74+
For example, if your ChIMES parameter file defines elements with masses 12.011 and 15.999, then your LAMMPS data file must have atom types with matching masses, regardless of the order they appear in the files.
75+
76+
**ChIMES Parameter File Example:**
77+
The parameter file defines atom types with specific masses:
78+
79+
.. code-block:: text
80+
81+
ATOM TYPES: 2
82+
83+
# TYPEIDX # # ATM_TYP # # ATMCHRG # # ATMMASS #
84+
0 C 0 12.011
85+
1 O 0 15.999
86+
87+
**LAMMPS Data File Example:**
88+
The data file must have atom types with matching masses (order doesn't matter):
89+
90+
.. code-block:: text
91+
92+
2 atom types
93+
94+
Masses
95+
96+
1 12.0107 # C (matches ChIMES mass 12.011 within tolerance)
97+
2 15.9994 # O (matches ChIMES mass 15.999 within tolerance)
98+
99+
**Important:** If no mass matches are found between the ChIMES parameter file and LAMMPS data file, the simulation will terminate with an error, as ChIMES cannot be used for any interactions.
100+
101+
Hybrid Overlay Usage
102+
"""""""""""""""""""
103+
104+
ChIMES can be used simultaneously with other potentials using LAMMPS' hybrid/overlay pair style. This allows you to combine ChIMES with additional force fields for specific interactions.
105+
106+
**Example of hybrid/overlay usage:**
107+
108+
.. code-block:: text
109+
110+
pair_style hybrid/overlay chimesFF momb 9.0 0.75 20.0 lj/cut 10.0
111+
pair_coeff * * chimesFF ${param_file}
112+
pair_coeff 1 1 momb 0.0 1.0 1.0 418.26 2.904
113+
pair_coeff 1 2 lj/cut 0.25 3.5
114+
pair_coeff 2 2 lj/cut 0.25 3.5
115+
116+
In this example, ChIMES is combined with MOMB (Many-body van der Waals) and Lennard-Jones potentials for different atom type interactions.
117+
118+
Models with D2 Dispersion Correction
119+
"""""""""""""""""""""""""""""""""""
120+
121+
Using hybrid ChIMES and MOMB is specifically for adding D2 dispersion correction at the time of using LAMMPS. Whether to include MOMB and the parameters used is specific to the ChIMES parameterization and should not be added arbitrarily.
122+
123+
**Important:** When using MOMB with ChIMES, you must include the ``make yes-extra-pair`` command in the install.sh script when compiling LAMMPS to enable the MOMB potential support.
124+
125+
.. code-block:: text
126+
127+
# Compile
128+
129+
cd build/${lammps}/src
130+
make yes-manybody
131+
make yes-extra-pair
66132
67133
.. Warning::
68134

69135
1. Implementation assumes outer cutoffs for (n+1)-body interactions are always :math:`\le` those for n-body interactions
70136
2. This capability is still under testing - please `let us know <https://groups.google.com/g/chimes_software>`_ if you observe strange behavior
71137
3. Assumes user wants single-atom energies to be added to the system energy. If you don't want to, zero the energy offsets in the parameter file
72138

73-
74-
Examples
75-
^^^^^^^^^^^^^^^^

doc/source/fingerprint_example.pdf

72 KB
Binary file not shown.

doc/source/getting_started.rst

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,30 @@ Please see :ref:`the special Github instructions <page-getting_started-Open-GH>`
2929
Compiling and running the code
3030
****************************************
3131

32-
As described above, the ``chimes_calculator`` comprises library tools for evaluating ChIMES interactions. However, the repository contains several usage examples (see, e.g. :ref:`ChIMES Calculator <sec-use-examples-api>` and :ref:`ChIMES Calculator Serial Interface <sec-ser-use-examples-api>` examples.). These examples can be compiled by navigating to a given example sub directory (e.g. ``chimes FF/examples/cpp/``) and typing ``make``.
32+
As described above, the ``chimes_calculator`` comprises library tools for evaluating ChIMES interactions. Further information about the model architecture can be found in :ref:`ChIMES Calculator <page-chimesFF>`. ``chimesFF.h`` and ``chimesFF.cpp`` are the source files that implement the core logic of calculating ChIMES interactions given the cluster of atoms. When the class defined therein is instantiated, it read in a ChIMES parameter file. It then can be used to evaluate individual terms in the many-body cluster expansion that defines the ChIMES potential. Specifically, it contains functions to compute energy, stress tensor, and per-atom forces for an individual 2-, 3- or 4-body cluster of atoms, given their coordinates.
3333

34+
For most applications, chimesFF should be integrated into a simulation code that can take a full system configuration, extract all n-body clusters while respecting periodic boundary conditions, and feed them into chimesFF. An example to do this is provided in :ref:`ChIMES Calculator Serial Interface <sec-ser-use-examples-api>`, which demonstrates how to use the ``chimes_calculator`` for an overall system evaluation. We also provide an implementation of chimesFF as a pair_style in lammps in the :ref:`The ChIMES Calculator with LAMMPS <page-etc>` page.
3435

35-
Alternatively, the entire software suite can be compiled at once using CMake, via the install script - note that C++, C, *and* Fortran compilers are all required to use the this approach.
36+
These examples can be compiled by navigating to a given example subdirectory (e.g. ``chimesFF/examples/cpp/``) and typing ``make``.
3637

38+
You can compile and install the entire software suite in different computing environments. All require C, C++ and Fortran compilers:
3739

38-
If your environment is correctly configured, you can simply execute ``./install.sh``.
40+
* Standard Installation (Local Machine or Basic Environment)
3941

40-
If you are on a HPC using module files, you may need to load them first. Module files are already configured for a handful of HPC - inspect the contents of modfiles to see if
41-
yours is listed. If it is (e.g., LLNL-LC.mod), execute ``export hosttype=LLNL-LC; ./install.sh`` to install. Otherwise, load the appropriate modules by hand before running the
42-
install script.
42+
* If your environment is correctly configured, you can simply execute ``./install.sh`` in the outer most directory.
4343

44-
.. Note ::
4544

46-
Consider submitting module files and corresponding install.sh changes as a PR, for your HPC!
45+
* Installation on an HPC cluster
46+
47+
* You need to load pre-configured module files first. Module files are already configured for a handful of HPC in ``/modfiles/`` ; verify if yours is listed. If it is (e.g., LLNL-LC.mod), execute ``export hosttype=LLNL-LC; ./install.sh`` to install. Otherwise, load the appropriate modules by hand before running the install script.
4748

49+
* CMake-Based Installation
4850

49-
, or executing the appropriate CMake commands by simply running ``./install.sh`` from the base ``chimes_calculator`` directory. If the latter option is used, a list of generated executables/library files and their respective install locations can be found in the generated ``build/install_manifest.txt`` file. Note that C++, C, *and* Fortran compilers are all required to use the ``./install.sh`` approach.
51+
* You can execute the appropriate CMake commands by simply running ``./install.sh`` from the base ``chimes_calculator`` directory. If this option is used, a list of generated executables/library files and their respective install locations can be found in the generated ``build/install_manifest.txt`` file.
5052

53+
.. Note ::
5154
55+
Consider submitting module files and corresponding install.sh changes as a PR, for your HPC!
5256
5357
5458
Sample ChIMES parameter and input files are provided in the ``serial_interface/tests/force_fields`` and ``serial_interface/tests/configurations`` directories, allowing compiled executables to be tested via, e.g.:
@@ -58,10 +62,16 @@ Sample ChIMES parameter and input files are provided in the ``serial_interface/t
5862
serial_interface/examples/cpp/chimescalc \
5963
serial_interface/tests/force_fields/published_params.liqC.2b.cubic.txt \
6064
serial_interface/tests/configurations/liqC.2.5gcc_6000K.OUTCAR_#000.xyz | tee my_test.log
65+
66+
Compiling the ChIMES Calculator with LAMMPS
67+
*********************************************
68+
69+
We implemented the CHIMES in the `LAMMPS <https://lammps.sandia.gov/>`_ and detailed information regarding Compiling and running can be found in :ref:`The ChIMES Calculator with LAMMPS <page-etc>`.
6170

6271

63-
For additional details on using, integrating, and compiling, and contributing, see:
72+
For additional details on using, integrating, compiling, and contributing, see:
6473

6574
* :ref:`The ChIMES Calculator <page-chimesFF>`
6675
* :ref:`The ChIMES Calculator Serial Interface <page-serial_interface>`
76+
* :ref:`The ChIMES Calculator with LAMMPS <page-etc>`
6777
* :ref:`Contributing <page-contributing>`

doc/source/serial_interface.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ The ChIMES Calculator Serial Interface
66
Overview
77
********
88

9-
The ChIMES calculator serial interface provides an easier means of evaluating ChIMES interactions for a given system. In constrast to the ChIMES calculator (i.e. ``chimesFF``), which takes information on *individual* atom clusters and returns the cluster energy, stress tensor, via ``compute_xB`` functions, the serial interface (i.e. ``serial_chimes_interface``) takes *overall* system information and returns *overall* system energy, stress tensor, and forces. Though far less flexible than direct use of ``chimesFF``, ``serial_chimes_interface`` allows users to leverage ChIMES with much less coding. For further details on ``chimesFF``, see :ref:`The ChIMES Calculator <page-chimesFF>`. For a complete set of ChIMES references, see :ref:`Citing ChIMES <page-citing>`. Note that this functionality is primarily intended for instructive purposes, and is not recommended for large scale simulations.
9+
The ChIMES calculator serial interface provides an easier means of evaluating ChIMES interactions for a given system. In contrast to the ChIMES calculator (i.e. ``chimesFF``), which takes information on *individual* atom clusters and returns the cluster energy, stress tensor, via ``compute_xB`` functions, the serial interface (i.e. ``serial_chimes_interface``) takes *overall* system information and returns *overall* system energy, stress tensor, and forces. Though far less flexible than direct use of ``chimesFF``, ``serial_chimes_interface`` allows users to leverage ChIMES with much less coding. For examples of how to implement the ChIMES calculator serial interface with different APIs, refer to :ref:`Implementation Examples <sec-ser-use-examples-api>`. For further details on ``chimesFF``, see :ref:`The ChIMES Calculator <page-chimesFF>`. For a complete set of ChIMES references, see :ref:`Citing ChIMES <page-citing>`.
10+
11+
.. Note::
12+
The serial interface is intended to primarily serve as an easy-to-read example of how to use/implement the chimesFF library in various user codes. Hence, the implementation is not optimized for computational efficiency and therefore not recommended for use in long or large scale simulations. For users seeking a computationally efficient out-of-the-box simulation capability, we recommend using our LAMMPS implementation. See the :ref:`ChIMES in LAMMPS <page-etc>` for more details.
1013

1114

1215
The ChIMES Calculator Serial Interface
@@ -24,7 +27,7 @@ The ChIMES calculator serial interface source files are located in ``serial_inte
2427
2528
.. Warning::
2629

27-
For small simulation cells (e.g., a single atom in a face-centered cubic unit cell), the ChIMES calculator must be instantiated via ``serial_chimes_interface chimes(true)``. This allows for automatic replication in situations where the ChIMES outer cutoff is greater than one half of the smallest supercell length. Please note that use of extra-small simulation cells is ill-advised for aything except crystalline systems and should be used with caution.
30+
It is recommended to have a supercell length of at least double the outer cutoff. For small simulation cells (e.g., a single atom in a face-centered cubic unit cell), the ChIMES calculator must be instantiated via ``serial_chimes_interface chimes(true)``. This allows for automatic replication in situations where the ChIMES outer cutoff is greater than one half of the smallest supercell length. Please note that use of extra-small simulation cells is ill-advised for aything except crystalline systems and should be used with caution.
2831

2932
*Developer note: To recover behavior of the research code, instantiate with:* ``serial_chimes_interface chimes(false)``.
3033

@@ -111,10 +114,10 @@ void calculate_chimes ======================= =====
111114
double array Vector of x-coordinates for system atoms
112115
double array Vector of y-coordinates for system atoms
113116
double array Vector of z-coordinates for system atoms
114-
char array System cell a lattice vector
117+
char array Vector of atom types for system atoms
118+
double array System cell a lattice vector
115119
double array System cell b lattice vector
116120
double array System cell c lattice vector
117-
double array Vector of atom types for system atoms
118121
double* Overall system energy (updated by function)
119122
double array Vector of forces for system atoms (updated by function); ([atom index][fx, fy, fz])
120123
double array System stress tensor (updated by function); ([s_xx, s_xy, s_xz, s_yx, s_yy, s_yz, s_zx, s_zy, s_zz])
@@ -178,10 +181,10 @@ void f_calculate_chimes ======================= =====
178181
C_double array Vector of x-coordinates for system atoms
179182
C_double array Vector of y-coordinates for system atoms
180183
C_double array Vector of z-coordinates for system atoms
181-
C_char array System cell a lattice vector
184+
C_char array Vector of atom types for system atoms
185+
C_double array System cell a lattice vector
182186
C_double array System cell b lattice vector
183187
C_double array System cell c lattice vector
184-
C_double array Vector of atom types for system atoms
185188
C_double* Overall system energy (updated by function)
186189
C_double array Vector of forces for system atoms (updated by function); ([atom index][fx, fy, fz])
187190
C_double array System stress tensor (updated by function); ([s_xx, s_xy, s_xz, s_yx, s_yy, s_yz, s_zx, s_zy, s_zz])
@@ -328,10 +331,10 @@ See description calculate_chimes ======================= =====
328331
float list Vector of x-coordinates for system atoms
329332
float list Vector of y-coordinates for system atoms
330333
float list Vector of z-coordinates for system atoms
331-
str list System cell a lattice vector
334+
str list Vector of atom types for system atoms
335+
float list System cell a lattice vector
332336
float list System cell b lattice vector
333337
float list System cell c lattice vector
334-
float list Vector of atom types for system atoms
335338
float Overall system energy
336339
float list Vector of forces for system atoms ([atom index][fx, fy, fz])
337340
float list System stress tensor ([s_xx, s_xy, s_xz, s_yx, s_yy, s_yz, s_zx, s_zy, s_zz])
@@ -364,15 +367,18 @@ Implementation Examples
364367
^^^^^^^^^^^^^^^^^^^^^^^
365368

366369
The following codes demonstrates how ``serial_chimes_interface.{h,cpp}`` can be used to obtain the overall stress tensor, energy, and per-atom forces for a given system configuration using C, C++ Fortran, and Python. See the ``main.*`` files in each corresponding subdirectory of ``serial_interface/examples`` for further implementation details. Note that sample system configurations (i.e. ``*xyz`` files) and parameter files can be found in ``serial_interface/test/configurations`` and ``serial_interface/test/force_fields``, respectively.
367-
For user generated tests, note that ``*.xyz`` files must provide lattice vectors in the comment line, e.g. lx 0.0 0.0 0.0 ly 0.0 0.0 0.0 lz. Click :ref:`here <page-units>` for an overview of ChIMES units.
370+
371+
.. Note::
372+
373+
For user generated tests, note that ``*.xyz`` files must provide lattice vectors in the comment line, e.g. lx 0.0 0.0 0.0 ly 0.0 0.0 0.0 lz. Click :ref:`here <page-units>` for an overview of ChIMES units.
368374

369375
.. Note::
370376

371377
All implementation examples are intended to be run on Unix-based systems (e.g. Linux, OSX).
372378

373379
.. Warning::
374380

375-
These codes are for demonstrative purposes only and come with no guarantees.
381+
These codes are for demonstrative purposes only and come with no guarantees.
376382

377383
.. Note::
378384

@@ -400,21 +406,19 @@ For user generated tests, note that ``*.xyz`` files must provide lattice vectors
400406
* Navigate to ``serial_interface/examples/fortran``
401407
* Compile with: ``make all``
402408
* Test with: ``./chimescalc-test_serial-F <parameter file> <xyz file>``
403-
* Additional notes:
404409

405410
* **Fortran2008 Example:** Similarly, this ``main`` function establishes a pointer to a ``serial_chimes_interface`` object via calls to ``ChimesCalc_init()`` and subroutine calls within the ``ChimesCalc`` class, defined in ``chimescalc_serial_F08.f90.``
406411
Subroutines called from the Fortran2008 API act as an interface for the wrapper functions establied in the Fortran90 API. Actual linking is achieved at compilation. See the ``Makefile`` for details.
407412

408413
* Navigate to ``serial_interface/examples/fortran08``
409414
* Compile with: ``make all``
410415
* Test with: ``./chimescalc-test_serial-F08 <parameter file> <xyz file>``
411-
* Additional notes:
412416

413417
* **Python Example:** This example accesses ``serial_chimes_interface`` functions through ``chimescalc_serial_py.py``, a ctypes-based python API for access to the C API functions
414418
(i.e. through ``chimescalc_serial_C.cpp``). Once ``chimescalc_serial_py.py`` is imported, it is associated with a compiled C API library file, i.e. ``lib-C_wrapper-serial_interface.so`` and can be used to access ``serial_chimes_interface`` member functions.
415419

416420
* Navigate to ``serial_interface/examples/python``
417421
* Compile ``libchimescalc-serial_dl.so`` with: ``make all``
418422
* Rename: ``cp libchimescalc-serial_dl.so libchimescalc_dl.so``
419-
* Test with: ``python main.py <parameter file> <coordinate file>``
423+
* Test with: ``python main.py <parameter file> <xyz file>``
420424

0 commit comments

Comments
 (0)