Merge pull request #3278 from yury-lysogorskiy/feature/ml-pace-multispecies
ML_PACE package hybrid support and small updates
This commit is contained in:
@ -24,6 +24,24 @@ function(validate_option name values)
|
||||
endif()
|
||||
endfunction(validate_option)
|
||||
|
||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||
function(get_newest_file path variable)
|
||||
file(GLOB _dirs ${path})
|
||||
set(_besttime 2000-01-01T00:00:00)
|
||||
set(_bestfile "<unknown>")
|
||||
foreach(_dir ${_dirs})
|
||||
file(TIMESTAMP ${_dir} _newtime)
|
||||
if(_newtime IS_NEWER_THAN _besttime)
|
||||
set(_bestfile ${_dir})
|
||||
set(_besttime ${_newtime})
|
||||
endif()
|
||||
endforeach()
|
||||
if(_bestfile STREQUAL "<unknown>")
|
||||
message(FATAL_ERROR "Could not find valid path at: ${path}")
|
||||
endif()
|
||||
set(${variable} ${_bestfile} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_lammps_version version_header variable)
|
||||
file(STRINGS ${version_header} line REGEX LAMMPS_VERSION)
|
||||
set(MONTHS x Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
|
||||
set(PACELIB_MD5 "e0572de57039d4afedefb25707b6ceae" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
set(PACELIB_MD5 "32394d799bc282bb57696c78c456e64f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
|
||||
@ -13,8 +13,8 @@ execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||
|
||||
file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*)
|
||||
# enforce building libyaml-cpp as static library and turn off optional features
|
||||
set(YAML_BUILD_SHARED_LIBS OFF)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF)
|
||||
|
||||
@ -15,7 +15,7 @@ from install_helpers import fullpath, geturl, checkmd5sum
|
||||
# settings
|
||||
|
||||
thisdir = fullpath('.')
|
||||
version = 'v.2021.10.25.fix'
|
||||
version = 'v.2021.10.25.fix2'
|
||||
|
||||
# known checksums for different PACE versions. used to validate the download.
|
||||
checksums = { \
|
||||
@ -23,7 +23,8 @@ checksums = { \
|
||||
'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5',
|
||||
'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b',
|
||||
'v.2021.10.25' : 'a2ac3315c41a1a4a5c912bcb1bc9c5cc',
|
||||
'v.2021.10.25.fix': 'e0572de57039d4afedefb25707b6ceae'
|
||||
'v.2021.10.25.fix': 'e0572de57039d4afedefb25707b6ceae',
|
||||
'v.2021.10.25.fix2': '32394d799bc282bb57696c78c456e64f'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -146,18 +146,8 @@ void PairPACE::compute(int eflag, int vflag)
|
||||
// the pointer to the list of neighbors of "i"
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
if (inum != nlocal) error->all(FLERR, "inum: {} nlocal: {} are different", inum, nlocal);
|
||||
|
||||
// Aidan Thompson told RD (26 July 2019) that practically always holds:
|
||||
// inum = nlocal
|
||||
// i = ilist(ii) < inum
|
||||
// j = jlist(jj) < nall
|
||||
// neighborlist contains neighbor atoms plus skin atoms,
|
||||
// skin atoms can be removed by setting skin to zero but here
|
||||
// they are disregarded anyway
|
||||
|
||||
//determine the maximum number of neighbours
|
||||
int max_jnum = -1;
|
||||
int max_jnum = 0;
|
||||
int nei = 0;
|
||||
for (ii = 0; ii < list->inum; ii++) {
|
||||
i = ilist[ii];
|
||||
@ -190,7 +180,7 @@ void PairPACE::compute(int eflag, int vflag)
|
||||
|
||||
try {
|
||||
aceimpl->ace->compute_atom(i, x, type, jnum, jlist);
|
||||
} catch (exception &e) {
|
||||
} catch (std::exception &e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
@ -325,10 +315,16 @@ void PairPACE::coeff(int narg, char **arg)
|
||||
|
||||
const int n = atom->ntypes;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
char *elemname = elemtypes[i - 1];
|
||||
char *elemname = arg[2 + i];
|
||||
if (strcmp(elemname, "NULL") == 0) {
|
||||
// species_type=-1 value will not reach ACE Evaluator::compute_atom,
|
||||
// but if it will ,then error will be thrown there
|
||||
aceimpl->ace->element_type_mapping(i) = -1;
|
||||
map[i] = -1;
|
||||
if (comm->me == 0) utils::logmesg(lmp, "Skipping LAMMPS atom type #{}(NULL)\n", i);
|
||||
} else {
|
||||
int atomic_number = AtomicNumberByName_pace(elemname);
|
||||
if (atomic_number == -1) error->all(FLERR, "'{}' is not a valid element\n", elemname);
|
||||
|
||||
SPECIES_TYPE mu = aceimpl->basis_set->get_species_index_by_name(elemname);
|
||||
if (mu != -1) {
|
||||
if (comm->me == 0)
|
||||
@ -342,10 +338,11 @@ void PairPACE::coeff(int narg, char **arg)
|
||||
potential_file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initialize scale factor
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = i; j <= n; j++) { scale[i][j] = 1.0; }
|
||||
for (int j = i; j <= n; j++) scale[i][j] = 1.0;
|
||||
}
|
||||
|
||||
aceimpl->ace->set_basis(*aceimpl->basis_set, 1);
|
||||
|
||||
Reference in New Issue
Block a user