Skip to content

Commit 73e3994

Browse files
authored
Merge pull request #68 from RKLindsey/develop
Fix I/O bugs, update documentation, refactor LAMMPS test suite
2 parents 6bca7d8 + 67eae55 commit 73e3994

File tree

215 files changed

+119561
-2165722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+119561
-2165722
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
etc/lmp/tests/*/correct_output/*

chimesFF/src/FP/chimesFF.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,9 @@ void chimesFF::read_parameters(string paramfile)
727727
}
728728
}
729729
else
730-
{
731-
cout << "chimesFF: \tType is excluded... skipping." << endl;
730+
{
731+
if (rank == 0)
732+
cout << "chimesFF: \tType is excluded... skipping." << endl;
732733
}
733734
}
734735

@@ -1058,7 +1059,8 @@ void chimesFF::read_parameters(string paramfile)
10581059
}
10591060
else
10601061
{
1061-
cout << "chimesFF: \tType is excluded... skipping." << endl;
1062+
if (rank == 0)
1063+
cout << "chimesFF: \tType is excluded... skipping." << endl;
10621064
}
10631065
}
10641066

@@ -2266,7 +2268,6 @@ void chimesFF::build_pair_int_quad_map()
22662268
// to support GPU environment without string operations.
22672269
// This must be called prior to force evaluation.
22682270

2269-
cout << "Entered weird func" << endl;
22702271
const int natoms = 4 ;
22712272
const int npairs = natoms * (natoms-1) / 2 ;
22722273
vector<int> pair_map(npairs) ;
@@ -2317,13 +2318,15 @@ void chimesFF::build_pair_int_quad_map()
23172318
if ( pair_int_quad_map[i].size() == 0 )
23182319
{
23192320
if (atom_int_quad_map[i] >= 0)
2320-
cout << "Error: Did not initialize pair_int_quad_map for entry " << i << endl ;
2321+
if(rank==0)
2322+
cout << "Error: Did not initialize pair_int_quad_map for entry " << i << endl ;
23212323
else
2322-
cout << "Warning: Did not initialize pair_int_quad_map for excluded entry " << i << endl ;
2324+
if(rank==0)
2325+
cout << "Warning: Did not initialize pair_int_quad_map for excluded entry " << i << endl ;
23232326
}
23242327
}
23252328
GlobalParams::pair_int_quad_mapping = pair_int_quad_map;
2326-
cout << "Assigned global param" << endl;
2329+
//cout << "Assigned global param" << endl;
23272330
}
23282331

23292332
void chimesFF::build_pair_int_trip_map()
@@ -2375,9 +2378,11 @@ void chimesFF::build_pair_int_trip_map()
23752378
if ( pair_int_trip_map[i].size() == 0 )
23762379
{
23772380
if (atom_int_trip_map[i] >= 0)
2378-
cout << "Error: Did not initialize pair_int_trip_map for entry " << i << endl ;
2381+
if(rank==0)
2382+
cout << "Error: Did not initialize pair_int_trip_map for entry " << i << endl ;
23792383
else
2380-
cout << "Warning: Did not initialize pair_int_trip_map for excluded entry " << i << endl ;
2384+
if(rank==0)
2385+
cout << "Warning: Did not initialize pair_int_trip_map for excluded entry " << i << endl ;
23812386
}
23822387
}
23832388

chimesFF/src/FP/histogram

-461 KB
Binary file not shown.

chimesFF/src/FP/multi_calc_histogram.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,28 @@ int my_rank;
2222
#include <iomanip>
2323
#include "chimesFF.h" // Make sure this includes the GlobalParams namespace declaration
2424

25-
void print_global_params() {
25+
void print_global_params()
26+
{
2627

2728
// Print 2-body cutoffs
29+
if (my_rank == 0)
30+
{
2831
cout << "\n2-Body Cutoffs:\n";
29-
for (size_t i = 0; i < rcut_2b_list.size(); ++i) {
32+
for (size_t i = 0; i < rcut_2b_list.size(); ++i)
33+
{
3034
cout << "Pair " << i << ": ";
3135
cout << "Inner = " << fixed << setprecision(4) << rcut_2b_list[i][0];
3236
cout << ", Outer = " << rcut_2b_list[i][1] << "\n";
3337
}
38+
3439

3540
// Print 3-body cutoffs
3641
cout << "\n3-Body Cutoffs:\n";
37-
for (size_t i = 0; i < rcut_3b_list.size(); ++i) {
42+
for (size_t i = 0; i < rcut_3b_list.size(); ++i)
43+
{
3844
cout << "Triplet " << i << ":\n";
39-
for (size_t j = 0; j < rcut_3b_list[i].size(); ++j) {
45+
for (size_t j = 0; j < rcut_3b_list[i].size(); ++j)
46+
{
4047
cout << " Pair " << j << ": ";
4148
cout << "Inner = " << rcut_3b_list[i][j][0];
4249
cout << ", Outer = " << rcut_3b_list[i][j][1] << "\n";
@@ -45,9 +52,11 @@ void print_global_params() {
4552

4653
// Print 4-body cutoffs
4754
cout << "\n4-Body Cutoffs:\n";
48-
for (size_t i = 0; i < rcut_4b_list.size(); ++i) {
55+
for (size_t i = 0; i < rcut_4b_list.size(); ++i)
56+
{
4957
cout << "Quadruplet " << i << ":\n";
50-
for (size_t j = 0; j < rcut_4b_list[i].size(); ++j) {
58+
for (size_t j = 0; j < rcut_4b_list[i].size(); ++j)
59+
{
5160
cout << " Pair " << j << ": ";
5261
cout << "Inner = " << rcut_4b_list[i][j][0];
5362
cout << ", Outer = " << rcut_4b_list[i][j][1] << "\n";
@@ -56,11 +65,13 @@ void print_global_params() {
5665

5766
// Print Morse lambda values
5867
cout << "\nMorse Lambda Values:\n";
59-
for (size_t i = 0; i < morse_lambda_list.size(); ++i) {
68+
for (size_t i = 0; i < morse_lambda_list.size(); ++i)
69+
{
6070
cout << "Pair " << i << ": λ = "
6171
<< fixed << setprecision(4)
6272
<< morse_lambda_list[i] << "\n";
6373
}
74+
}
6475
}
6576

6677
int split_lines(string line, vector<string> & items)
@@ -569,7 +580,8 @@ int main(int argc, char *argv[])
569580
vector<double> f1_2b_atom_types, f2_2b_atom_types;
570581
int npairs_2b = 1;
571582
read_flat_clusters(f1_2b, npairs_2b, f1_2b_flat_clusters, f1_2b_atom_types, 2);
572-
cout << "Read in 2B clusters..." << endl;
583+
if (my_rank == 0)
584+
cout << "Read in 2B clusters..." << endl;
573585
read_flat_clusters(f2_2b, npairs_2b, f2_2b_flat_clusters, f2_2b_atom_types, 2);
574586

575587
// Process 3B clusters
@@ -579,7 +591,8 @@ int main(int argc, char *argv[])
579591
vector<double> f1_3b_atom_types, f2_3b_atom_types;
580592
int npairs_3b = 3;
581593
read_flat_clusters(f1_3b, npairs_3b, f1_3b_flat_clusters, f1_3b_atom_types, 3);
582-
cout << "Read in 3B clusters..." << endl;
594+
if (my_rank == 0)
595+
cout << "Read in 3B clusters..." << endl;
583596
read_flat_clusters(f2_3b, npairs_3b, f2_3b_flat_clusters, f2_3b_atom_types, 3);
584597

585598
// Process 4B clusters
@@ -589,7 +602,8 @@ int main(int argc, char *argv[])
589602
vector<double> f1_4b_atom_types, f2_4b_atom_types;
590603
int npairs_4b = 6;
591604
read_flat_clusters(f1_4b, npairs_4b, f1_4b_flat_clusters, f1_4b_atom_types, 4);
592-
cout << "Read in 4B clusters..." << endl;
605+
if (my_rank == 0)
606+
cout << "Read in 4B clusters..." << endl;
593607
read_flat_clusters(f2_4b, npairs_4b, f2_4b_flat_clusters, f2_4b_atom_types, 4);
594608

595609
if (my_rank == 0) {
@@ -612,4 +626,4 @@ int main(int argc, char *argv[])
612626

613627
MPI_Finalize();
614628
return 0;
615-
}
629+
}

chimesFF/src/FP/post_process.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ for body in 2b 3b 4b; do
3636
sub(/_clusters\.txt$/, "_list.txt", list_file);
3737
print cluster_file;
3838
print list_file
39-
}' "$framefile" | xargs rm -v
39+
}' "$framefile" | xargs rm -v > /dev/null 2>&1
4040
else
4141
echo " Error concatenating files, preserving originals"
4242
fi
@@ -48,4 +48,4 @@ for body in 2b 3b 4b; do
4848
done
4949

5050
echo -e "\nCombination complete. Created files:"
51-
ls -l *b_combined.txt
51+
ls -l *-clusters.txt | awk '{print $NF}'

chimesFF/src/chimesFF.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -938,9 +938,10 @@ void chimesFF::read_parameters(string paramfile)
938938
}
939939
}
940940
else if (tmp_str_items[4] == "EXCLUDED:")
941-
{
942-
cout << "chimesFF: \tType is excluded... skipping." << endl;
943-
}
941+
{
942+
if (rank == 0)
943+
cout << "chimesFF: \tType is excluded... skipping." << endl;
944+
}
944945
}
945946

946947
if(line.find("TRIPMAPS:") != string::npos)
@@ -1269,7 +1270,8 @@ void chimesFF::read_parameters(string paramfile)
12691270
}
12701271
else
12711272
{
1272-
cout << "chimesFF: \tType is excluded... skipping." << endl;
1273+
if (rank == 0)
1274+
cout << "chimesFF: \tType is excluded... skipping." << endl;
12731275
}
12741276
}
12751277

@@ -3009,9 +3011,11 @@ void chimesFF::build_pair_int_quad_map()
30093011
if ( pair_int_quad_map[i].size() == 0 )
30103012
{
30113013
if (atom_int_quad_map[i] >= 0)
3012-
cout << "Error: Did not initialize pair_int_quad_map for entry " << i << endl ;
3014+
if(rank==0)
3015+
cout << "Error: Did not initialize pair_int_quad_map for entry " << i << endl ;
30133016
else
3014-
cout << "Warning: Did not initialize pair_int_quad_map for excluded entry " << i << endl ;
3017+
if(rank==0)
3018+
cout << "Warning: Did not initialize pair_int_quad_map for excluded entry " << i << endl ;
30153019
}
30163020
}
30173021
}
@@ -3065,9 +3069,11 @@ void chimesFF::build_pair_int_trip_map()
30653069
if ( pair_int_trip_map[i].size() == 0 )
30663070
{
30673071
if (atom_int_trip_map[i] >= 0)
3068-
cout << "Error: Did not initialize pair_int_trip_map for entry " << i << endl ;
3072+
if(rank==0)
3073+
cout << "Error: Did not initialize pair_int_trip_map for entry " << i << endl ;
30693074
else
3070-
cout << "Warning: Did not initialize pair_int_trip_map for excluded entry " << i << endl ;
3075+
if(rank==0)
3076+
cout << "Warning: Did not initialize pair_int_trip_map for excluded entry " << i << endl ;
30713077
}
30723078
}
30733079

doc/source/etc.rst

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,49 @@
1-
.. _page-etc:
21

3-
Support for Linking with External Codes
4-
=============================================
2+
.. _etc:
53

6-
Using the ChIMES Calculator with LAMMPS
7-
******************************************
4+
ChIMES in LAMMPS
5+
=============================================
86

9-
We are currently working toward ChIMES calculator implementation in `LAMMPS <https://lammps.sandia.gov>`_ as a USER package. In the interim, the following provides a guide to implementing the ChIMES calculator as a LAMMPS pairstyle.
7+
We are currently working toward ChIMES calculator implementation in `LAMMPS <https://lammps.sandia.gov>`_ as a USER package. In the interim, we have provided a capability for compiling the `stable_29Aug2024_update1 <https://github.com/lammps/lammps.git build/>`_ version of LAMMPS with ChIMES as a pairstyle in this package.
108

119

1210

1311
Quick start
1412
^^^^^^^^^^^^^^^^
1513

16-
Provided a system with a C++11-compatible compiler and an MPI compatible compiler are available, LAMMPS can be downloaded, installed, linked to ChIMES, and compiled all at once by navigating to ``etc/lmp``, adding Intel compilers to your path and executing ``./install.sh``. Once complete, the installation can be tested by navigating to ``etc/lmp/tests`` and running the example via ``../exe/lmp_mpi_chimes -i in.lammps``.
14+
.. Note ::
1715
18-
As with installation of the ChIMES Calculator itself, 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
19-
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
20-
install script.
16+
To compile LAMMPS with ChIMES, you must have C++11 and MPI compilers avillable. As with installation of the ChIMES Calculator itself, 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 yours is listed. If it is (e.g., LLNL-LC.mod), execute ``export hosttype=LLNL-LC`` Otherwise, load the appropriate modules by hand before running the install script.
2117
22-
Note that Intel oneapi compilers (which are now free) can be used to properly configure your enviroment for all Intel capabilities (e.g., icc, mpiicpc, mkl, etc.) - simply locate and execute the setvars.sh script within your Intel installation.
18+
Note that Intel oneapi compilers (which are now free) can be used to properly configure your enviroment for all Intel capabilities (e.g., icc, mpiicpc, mkl, etc.) - simply locate and execute the setvars.sh script within your Intel installation.
2319
2420
25-
-----
2621
27-
Detailed Compilation Overview
28-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
Navigate to ``etc/lmp`` and execute ``./install.sh`` to install. Once complete, the installation can be tested by navigating to ``etc/lmp/tests`` and either running the entire test suite via ``./run_tests.sh``, which takes roughly 15 minutes, or running an individual test by entering an example folder and executing ``../../exe/lmp_mpi_chimes -i in.lammps``.
2923

24+
The install script compiles with LAMMPS packages ``manybody`` and ``extra-pair``. Additional packages can be included by adding appropriate commands to the ``etc/lmp/install.sh`` script. For example, to add the MOLECULE package, one would add the line highlighted in yellow below:
3025

31-
.. Note::
3226

33-
This example assumes users have downloaded the 29 Oct 2020 release of LAMMPS (stable version as of 10/29/20), which can be downloaded `here <https://lammps.sandia.gov/download.html>`_.
27+
.. code-block ::
28+
:lineno-start: 114
29+
:emphasize-lines: 6
3430
31+
# Compile
3532
36-
37-
To integrate the ChIMES calculator in LAMMPS, locate the following files, and place them in the following destination among the LAMMPS source code:
38-
39-
======================== ================ ================ ==============
40-
File Location Destination Description
41-
======================== ================ ================ ==============
42-
``chimesFF.{h,cpp}`` ``chimesFF/src`` ``src/MANYBODY`` ChIMES calculator files
43-
``pair_chimes.{h,cpp}`` ``etc/lmp/src`` ``src/MANYBODY`` ChIMES pair_style definition files
44-
``pair.{h,cpp}`` ``etc/lmp/etc`` ``src`` Updated LAMMPS pair files (new ev_tally definition added)
45-
``Makefile.mpi_chimes`` ``etc/lmp/etc`` ``src/MAKE`` Makefile for compiling with ChIMES support
46-
======================== ================ ================ ==============
47-
48-
49-
Following, compile from the base LAMMPS directory with:
50-
51-
.. code-block:: shell
52-
33+
cd build/${lammps}/src
5334
make yes-manybody
54-
make mpi_chimes
35+
make yes-extra-pair
36+
make yes-molecule
37+
make -j 4 mpi_chimes
38+
cd -
5539
56-
Note that a successful compilation should produce an executable named ``lmp_mpi_chimes``.
40+
5741
58-
.. Tip::
5942
60-
If you are using an intel compiler, either delete the ``pair_list.*`` files that appear in the src folder following the ``make yes-manybody`` command, or add ``-restrict`` to ``CCFLAGS`` in ``MAKE/Makefile.mpi_chimes``. Note that the presently provided ``Makefile.mpi_chimes`` utilizes the latter approach.
43+
.. Tip ::
6144
45+
Additional flags can be specified during installation to enable features such as model tabulation and configuration fingerprint generation. For more details, see the :ref:`utils` page.
46+
6247
6348
Running
6449
^^^^^^^^^^^^^^^^

etc/lmp/tests/CG_ChIMES_lmp_tests/in.lammps

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)