forked from lijiext/lammps
Merge remote-tracking branch 'github/master' into add-ECO-DF
This commit is contained in:
commit
bb5b931d78
|
@ -32,6 +32,12 @@ endif()
|
|||
# Cmake modules/macros are in a subdirectory to keep this file cleaner
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
|
||||
|
||||
# make sure LIBRARY_PATH is set if environment variable is set
|
||||
if (DEFINED ENV{LIBRARY_PATH})
|
||||
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIBRARY_PATH}")
|
||||
message(STATUS "Appending $ENV{LIBRARY_PATH} to CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")
|
||||
endif()
|
||||
|
||||
include(LAMMPSUtils)
|
||||
|
||||
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h PROJECT_VERSION)
|
||||
|
|
|
@ -40,6 +40,17 @@ if(GPU_API STREQUAL "CUDA")
|
|||
|
||||
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||
|
||||
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder
|
||||
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
||||
if (GPU_LIB_OLD_CUBIN_HEADERS)
|
||||
message(FATAL_ERROR "########################################################################\n"
|
||||
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
||||
"Please run\n"
|
||||
" make -C ${LAMMPS_LIB_SOURCE_DIR}/gpu -f Makefile.serial clean\n"
|
||||
"to remove\n"
|
||||
"########################################################################")
|
||||
endif()
|
||||
|
||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||
|
||||
|
@ -79,7 +90,7 @@ if(GPU_API STREQUAL "CUDA")
|
|||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_75,code=[sm_75,compute_75] ")
|
||||
endif()
|
||||
|
||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS
|
||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING})
|
||||
|
||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
|
|
|
@ -132,6 +132,10 @@ Thus the GPU_ARCH setting is merely an optimization, to have code for
|
|||
the preferred GPU architecture directly included rather than having to wait
|
||||
for the JIT compiler of the CUDA driver to translate it.
|
||||
|
||||
When building with CMake, you **must NOT** build the GPU library in ``lib/gpu``
|
||||
using the traditional build procedure. CMake will detect files generated by that
|
||||
process and will terminate with an error and a suggestion for how to remove them.
|
||||
|
||||
If you are compiling with HIP, note that before running CMake you will have to
|
||||
set appropriate environment variables. Some variables such as
|
||||
:code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc`
|
||||
|
|
|
@ -94,6 +94,7 @@ An alphabetic list of all general LAMMPS commands.
|
|||
* :doc:`package <package>`
|
||||
* :doc:`pair_coeff <pair_coeff>`
|
||||
* :doc:`pair_modify <pair_modify>`
|
||||
* :doc:`pair_style <pair_style>`
|
||||
* :doc:`pair_write <pair_write>`
|
||||
* :doc:`partition <partition>`
|
||||
* :doc:`prd <prd>`
|
||||
|
|
|
@ -6,6 +6,9 @@ fix orient/fcc command
|
|||
fix orient/bcc command
|
||||
======================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID orient/fcc nstats dir alat dE cutlo cuthi file0 file1
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
fix poems command
|
||||
=================
|
||||
|
||||
Syntax:
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
fix rhok command
|
||||
================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID rhok nx ny nz K a
|
||||
|
|
|
@ -28,7 +28,9 @@ Syntax
|
|||
* flagHI (optional) = 0/1 to exclude/include 1/r hydrodynamic interactions
|
||||
* flagVF (optional) = 0/1 to exclude/include volume fraction corrections in the long-range isotropic terms
|
||||
|
||||
**Examples:** (all assume radius = 1)
|
||||
Examples
|
||||
""""""""
|
||||
(all assume radius = 1)
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ Syntax
|
|||
* flagHI (optional) = 0/1 to exclude/include 1/r hydrodynamic interactions
|
||||
* flagVF (optional) = 0/1 to exclude/include volume fraction corrections in the long-range isotropic terms
|
||||
|
||||
**Examples:** (all assume radius = 1)
|
||||
Examples
|
||||
""""""""
|
||||
(all assume radius = 1)
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ Syntax
|
|||
*angle* value = *yes* or *no*
|
||||
*dihedral* value = *yes* or *no*
|
||||
|
||||
Examples:
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
|
|
@ -374,15 +374,12 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -398,8 +395,7 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -415,18 +411,17 @@ void PairEAMAlloyGPU::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -374,15 +374,12 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -398,8 +395,7 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -415,21 +411,20 @@ void PairEAMFSGPU::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
|
||||
for (int j = 0; j < file->nelements; j++) {
|
||||
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
|
||||
reader.next_dvector(&file->rhor[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "kim_init.h"
|
||||
#include "fix_store_kim.h"
|
||||
#include "kim_units.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
@ -71,8 +73,7 @@
|
|||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "citeme.h"
|
||||
#include "fix_store_kim.h"
|
||||
#include "kim_units.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern "C" {
|
||||
#include "KIM_SimulatorHeaders.h"
|
||||
|
|
|
@ -988,15 +988,12 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -1012,8 +1009,7 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -1029,18 +1025,17 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -988,15 +988,12 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -1012,8 +1009,7 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -1029,21 +1025,20 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
|
||||
for (int j = 0; j < file->nelements; j++) {
|
||||
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
|
||||
reader.next_dvector(&file->rhor[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -546,15 +546,12 @@ void PairADP::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "ADP");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -570,8 +567,7 @@ void PairADP::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -589,30 +585,29 @@ void PairADP::read_file(char *filename)
|
|||
memory->create(file->w2r, file->nelements, file->nelements, file->nr + 1, "pair:w2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->u2r[i][j][1]);
|
||||
reader.next_dvector(&file->u2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->w2r[i][j][1]);
|
||||
reader.next_dvector(&file->w2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -35,11 +35,13 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "potential_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathSpecial;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define TOL 1.0e-9
|
||||
#define PGDELTA 1
|
||||
|
||||
|
@ -3331,9 +3333,6 @@ double PairAIREBO::TijSpline(double Nij, double Nji,
|
|||
|
||||
void PairAIREBO::read_file(char *filename)
|
||||
{
|
||||
int i,j,k,l,limit;
|
||||
char s[MAXLINE];
|
||||
|
||||
// REBO Parameters (AIREBO)
|
||||
|
||||
double rcmin_CC,rcmin_CH,rcmin_HH,rcmax_CC,rcmax_CH,
|
||||
|
@ -3357,562 +3356,298 @@ void PairAIREBO::read_file(char *filename)
|
|||
double epsilonM_CC,epsilonM_CH,epsilonM_HH,alphaM_CC,alphaM_CH,alphaM_HH;
|
||||
double reqM_CC,reqM_CH,reqM_HH;
|
||||
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
// read file on proc 0
|
||||
|
||||
int cerror = 0;
|
||||
int numpar = 0;
|
||||
FILE *fp = NULL;
|
||||
if (comm->me == 0) {
|
||||
std::string potential_name;
|
||||
std::string header;
|
||||
switch (variant) {
|
||||
case AIREBO:
|
||||
potential_name = "AIREBO";
|
||||
header = "# AIREBO ";
|
||||
break;
|
||||
|
||||
if (me == 0) {
|
||||
fp = force->open_potential(filename);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
switch (variant) {
|
||||
case REBO_2:
|
||||
potential_name = "REBO2";
|
||||
header = "# REBO2 ";
|
||||
break;
|
||||
|
||||
case AIREBO:
|
||||
snprintf(str,128,"Cannot open AIREBO potential file %s",filename);
|
||||
break;
|
||||
case AIREBO_M:
|
||||
potential_name = "Cannot open AIREBO-M";
|
||||
header = "# AIREBO-M ";
|
||||
break;
|
||||
|
||||
case REBO_2:
|
||||
snprintf(str,128,"Cannot open REBO2 potential file %s",filename);
|
||||
break;
|
||||
|
||||
case AIREBO_M:
|
||||
snprintf(str,128,"Cannot open AIREBO-M potential file %s",filename);
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf(str,128,"Unknown REBO style variant %d",variant);
|
||||
}
|
||||
error->one(FLERR,str);
|
||||
default:
|
||||
error->one(FLERR, fmt::format("Unknown REBO style variant {}",variant));
|
||||
}
|
||||
|
||||
PotentialFileReader reader(lmp, filename, potential_name);
|
||||
reader.ignore_comments(false);
|
||||
|
||||
// skip initial comment line and check for potential file style identifier comment
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
reader.skip_line();
|
||||
char * line = reader.next_line();
|
||||
|
||||
if (((variant == AIREBO) && (strncmp(s,"# AIREBO ",9) != 0))
|
||||
|| ((variant == REBO_2) && (strncmp(s,"# REBO2 ",8) != 0))
|
||||
|| ((variant == AIREBO_M) && (strncmp(s,"# AIREBO-M ",11) != 0))) {
|
||||
error->one(FLERR,"Potential file does not match AIREBO/REBO style variant");
|
||||
if (std::string(line).find(header) == std::string::npos) {
|
||||
error->one(FLERR, fmt::format("Potential file does not match AIREBO/REBO style variant: {}: {}", header, line));
|
||||
}
|
||||
|
||||
// skip remaining comments
|
||||
|
||||
while (1) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (s[0] != '#') break;
|
||||
}
|
||||
reader.ignore_comments(true);
|
||||
|
||||
// read parameters
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmin_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmin_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmin_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmax_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmax_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmax_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmaxp_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmaxp_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcmaxp_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&smin)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Nmin)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Nmax)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&NCmin)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&NCmax)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Q_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Q_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Q_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alpha_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alpha_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alpha_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&A_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&A_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&A_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CC1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CC2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CC3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CH1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CH2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_CH3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_HH1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_HH2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&BIJc_HH3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CC1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CC2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CC3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CH1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CH2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_CH3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_HH1)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_HH2)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Beta_HH3)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rho_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rho_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rho_HH)) ++cerror;
|
||||
std::vector<double*> params {
|
||||
&rcmin_CC,
|
||||
&rcmin_CH,
|
||||
&rcmin_HH,
|
||||
&rcmax_CC,
|
||||
&rcmax_CH,
|
||||
&rcmax_HH,
|
||||
&rcmaxp_CC,
|
||||
&rcmaxp_CH,
|
||||
&rcmaxp_HH,
|
||||
&smin,
|
||||
&Nmin,
|
||||
&Nmax,
|
||||
&NCmin,
|
||||
&NCmax,
|
||||
&Q_CC,
|
||||
&Q_CH,
|
||||
&Q_HH,
|
||||
&alpha_CC,
|
||||
&alpha_CH,
|
||||
&alpha_HH,
|
||||
&A_CC,
|
||||
&A_CH,
|
||||
&A_HH,
|
||||
&BIJc_CC1,
|
||||
&BIJc_CC2,
|
||||
&BIJc_CC3,
|
||||
&BIJc_CH1,
|
||||
&BIJc_CH2,
|
||||
&BIJc_CH3,
|
||||
&BIJc_HH1,
|
||||
&BIJc_HH2,
|
||||
&BIJc_HH3,
|
||||
&Beta_CC1,
|
||||
&Beta_CC2,
|
||||
&Beta_CC3,
|
||||
&Beta_CH1,
|
||||
&Beta_CH2,
|
||||
&Beta_CH3,
|
||||
&Beta_HH1,
|
||||
&Beta_HH2,
|
||||
&Beta_HH3,
|
||||
&rho_CC,
|
||||
&rho_CH,
|
||||
&rho_HH,
|
||||
|
||||
// LJ parameters
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmin_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmin_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmin_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmax_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmax_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&rcLJmax_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmin_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmin_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmin_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmax_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmax_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&bLJmax_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilon_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilon_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilon_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&sigma_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&sigma_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&sigma_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonT_CCCC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonT_CCCH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonT_HCCH)) ++cerror;
|
||||
// LJ parameters
|
||||
&rcLJmin_CC,
|
||||
&rcLJmin_CH,
|
||||
&rcLJmin_HH,
|
||||
&rcLJmax_CC,
|
||||
&rcLJmax_CH,
|
||||
&rcLJmax_HH,
|
||||
&bLJmin_CC,
|
||||
&bLJmin_CH,
|
||||
&bLJmin_HH,
|
||||
&bLJmax_CC,
|
||||
&bLJmax_CH,
|
||||
&bLJmax_HH,
|
||||
&epsilon_CC,
|
||||
&epsilon_CH,
|
||||
&epsilon_HH,
|
||||
&sigma_CC,
|
||||
&sigma_CH,
|
||||
&sigma_HH,
|
||||
&epsilonT_CCCC,
|
||||
&epsilonT_CCCH,
|
||||
&epsilonT_HCCH
|
||||
};
|
||||
|
||||
if (morseflag) {
|
||||
// lines for reading in MORSE parameters from CH.airebo_m file
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonM_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonM_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&epsilonM_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alphaM_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alphaM_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&alphaM_HH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&reqM_CC)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&reqM_CH)) ++cerror;
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&reqM_HH)) ++cerror;
|
||||
params.push_back(&epsilonM_CC);
|
||||
params.push_back(&epsilonM_CH);
|
||||
params.push_back(&epsilonM_HH);
|
||||
params.push_back(&alphaM_CC);
|
||||
params.push_back(&alphaM_CH);
|
||||
params.push_back(&alphaM_HH);
|
||||
params.push_back(&reqM_CC);
|
||||
params.push_back(&reqM_CH);
|
||||
params.push_back(&reqM_HH);
|
||||
}
|
||||
|
||||
}
|
||||
std::string current_section;
|
||||
|
||||
// check for errors parsing global parameters
|
||||
try {
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// global parameters
|
||||
current_section = "global parameters";
|
||||
|
||||
MPI_Bcast(&cerror,1,MPI_INT,0,world);
|
||||
if (cerror > 0) {
|
||||
char msg[128];
|
||||
snprintf(msg,128,"Could not parse %d of %d parameters from file %s",
|
||||
cerror,numpar,filename);
|
||||
error->all(FLERR,msg);
|
||||
}
|
||||
|
||||
cerror = numpar = 0;
|
||||
|
||||
if (me == 0) {
|
||||
|
||||
// gC spline
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
// number-1 = # of domains for the spline
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit; i++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&gCdom[i])) ++cerror;
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
for (i = 0; i < limit-1; i++) {
|
||||
for (j = 0; j < 6; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&gC1[i][j])) ++cerror;
|
||||
for(int i = 0; i < params.size(); i++) {
|
||||
*params[i] = reader.next_double();
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
for (i = 0; i < limit-1; i++) {
|
||||
for (j = 0; j < 6; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&gC2[i][j])) ++cerror;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// gC spline
|
||||
current_section = "gC spline";
|
||||
|
||||
// number-1 = # of domains for the spline
|
||||
|
||||
int limit = reader.next_int();
|
||||
reader.next_dvector(gCdom, limit);
|
||||
|
||||
for (int i = 0; i < limit-1; i++) {
|
||||
reader.next_dvector(&gC1[i][0], 6);
|
||||
}
|
||||
}
|
||||
|
||||
// gH spline
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit; i++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&gHdom[i])) ++cerror;
|
||||
}
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < limit-1; i++) {
|
||||
for (j = 0; j < 6; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&gH[i][j])) ++cerror;
|
||||
for (int i = 0; i < limit-1; i++) {
|
||||
reader.next_dvector(&gC2[i][0], 6);
|
||||
}
|
||||
}
|
||||
|
||||
// pCC spline
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// gH spline
|
||||
current_section = "gH spline";
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
limit = reader.next_int();
|
||||
reader.next_dvector(gHdom, limit);
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/2; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&pCCdom[i][j])) ++cerror;
|
||||
for (int i = 0; i < limit-1; i++) {
|
||||
reader.next_dvector(&gH[i][0], 6);
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) pCCdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) pCCdom[1][1]; j++) {
|
||||
for (k = 0; k < 16; k++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&pCC[i][j][k])) ++cerror;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// pCC spline
|
||||
current_section = "pCC spline";
|
||||
|
||||
limit = reader.next_int();
|
||||
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
reader.next_dvector(&pCCdom[i][0], limit/2);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int) pCCdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) pCCdom[1][1]; j++) {
|
||||
reader.next_dvector(&pCC[i][j][0], 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pCH spline
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// pCH spline
|
||||
current_section = "pCH spline";
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
limit = reader.next_int();
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/2; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&pCHdom[i][j])) ++cerror;
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) pCHdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) pCHdom[1][1]; j++) {
|
||||
for (k = 0; k < 16; k++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&pCH[i][j][k])) ++cerror;
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
for (int j = 0; j < limit/2; j++) {
|
||||
pCHdom[i][j] = reader.next_double();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// piCC cpline
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/3; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piCCdom[i][j])) ++cerror;
|
||||
for (int i = 0; i < (int) pCHdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) pCHdom[1][1]; j++) {
|
||||
reader.next_dvector(&pCH[i][j][0], 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) piCCdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) piCCdom[1][1]; j++) {
|
||||
for (k = 0; k < (int) piCCdom[2][1]; k++) {
|
||||
for (l = 0; l < 64; l = l+1) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piCC[i][j][k][l])) ++cerror;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// piCC spline
|
||||
current_section = "piCC spline";
|
||||
|
||||
limit = reader.next_int();
|
||||
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
for (int j = 0; j < limit/3; j++) {
|
||||
piCCdom[i][j] = reader.next_double();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int) piCCdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) piCCdom[1][1]; j++) {
|
||||
for (int k = 0; k < (int) piCCdom[2][1]; k++) {
|
||||
reader.next_dvector(&piCC[i][j][k][0], 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// piCH spline
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// piCH spline
|
||||
current_section = "piCH spline";
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
limit = reader.next_int();
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/3; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piCHdom[i][j])) ++cerror;
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
for (int j = 0; j < limit/3; j++) {
|
||||
piCHdom[i][j] = reader.next_double();
|
||||
}
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) piCHdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) piCHdom[1][1]; j++) {
|
||||
for (k = 0; k < (int) piCHdom[2][1]; k++) {
|
||||
for (l = 0; l < 64; l = l+1) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piCH[i][j][k][l])) ++cerror;
|
||||
for (int i = 0; i < (int) piCHdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) piCHdom[1][1]; j++) {
|
||||
for (int k = 0; k < (int) piCHdom[2][1]; k++) {
|
||||
reader.next_dvector(&piCH[i][j][k][0], 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// piHH spline
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// piHH spline
|
||||
current_section = "piHH spline";
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
limit = reader.next_int();
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/3; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piHHdom[i][j])) ++cerror;
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
for (int j = 0; j < limit/3; j++) {
|
||||
piHHdom[i][j] = reader.next_double();
|
||||
}
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) piHHdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) piHHdom[1][1]; j++) {
|
||||
for (k = 0; k < (int) piHHdom[2][1]; k++) {
|
||||
for (l = 0; l < 64; l = l+1) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&piHH[i][j][k][l])) ++cerror;
|
||||
for (int i = 0; i < (int) piHHdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) piHHdom[1][1]; j++) {
|
||||
for (int k = 0; k < (int) piHHdom[2][1]; k++) {
|
||||
reader.next_dvector(&piHH[i][j][k][0], 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tij spline
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Tij spline
|
||||
current_section = "Tij spline";
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
limit = reader.next_int();
|
||||
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%d",&limit)) ++cerror;
|
||||
|
||||
for (i = 0; i < limit/2; i++) {
|
||||
for (j = 0; j < limit/3; j++) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Tijdom[i][j])) ++cerror;
|
||||
for (int i = 0; i < limit/2; i++) {
|
||||
for (int j = 0; j < limit/3; j++) {
|
||||
Tijdom[i][j] = reader.next_double();
|
||||
}
|
||||
}
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
|
||||
for (i = 0; i < (int) Tijdom[0][1]; i++) {
|
||||
for (j = 0; j < (int) Tijdom[1][1]; j++) {
|
||||
for (k = 0; k < (int) Tijdom[2][1]; k++) {
|
||||
for (l = 0; l < 64; l = l+1) {
|
||||
++numpar;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
if (1 != sscanf(s,"%lg",&Tijc[i][j][k][l])) ++cerror;
|
||||
for (int i = 0; i < (int) Tijdom[0][1]; i++) {
|
||||
for (int j = 0; j < (int) Tijdom[1][1]; j++) {
|
||||
for (int k = 0; k < (int) Tijdom[2][1]; k++) {
|
||||
reader.next_dvector(&Tijc[i][j][k][0], 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
std::string msg = fmt::format("ERROR reading {} section in {} file\n"
|
||||
"REASON: {}\n",
|
||||
current_section, potential_name, e.what());
|
||||
error->one(FLERR, msg);
|
||||
} catch (FileReaderException & fre) {
|
||||
error->one(FLERR, fre.what());
|
||||
std::string msg = fmt::format("ERROR reading {} section in {} file\n"
|
||||
"REASON: {}\n",
|
||||
current_section, potential_name, fre.what());
|
||||
error->one(FLERR, msg);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
// check for errors parsing spline data
|
||||
|
||||
MPI_Bcast(&cerror,1,MPI_INT,0,world);
|
||||
if (cerror > 0) {
|
||||
char msg[128];
|
||||
snprintf(msg,128,"Could not parse %d of %d spline data from file %s",
|
||||
cerror,numpar,filename);
|
||||
error->all(FLERR,msg);
|
||||
}
|
||||
|
||||
// store read-in values in arrays
|
||||
|
||||
if (me == 0) {
|
||||
// store read-in values in arrays
|
||||
|
||||
// REBO
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PairAIREBO : public Pair {
|
|||
protected:
|
||||
int *map; // 0 (C), 1 (H), or -1 (NULL) for each type
|
||||
|
||||
int me,variant;
|
||||
int variant;
|
||||
int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included
|
||||
int morseflag; // 1 if Morse instead of LJ for non-bonded
|
||||
|
||||
|
|
|
@ -46,10 +46,11 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "potential_file_reader.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define EPSILON 1.0e-6
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -294,7 +295,6 @@ void PairBOP::compute(int eflag, int vflag)
|
|||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
int cnt1;
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
|
@ -616,7 +616,6 @@ void PairBOP::coeff(int narg, char **arg)
|
|||
{
|
||||
int i,j;
|
||||
int n = atom->ntypes;
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
delete[] map;
|
||||
map = new int[n+1];
|
||||
|
@ -645,7 +644,7 @@ void PairBOP::coeff(int narg, char **arg)
|
|||
read_table(arg[2]);
|
||||
|
||||
// match element names to BOP word types
|
||||
if (me == 0) {
|
||||
if (comm->me == 0) {
|
||||
for (i = 3; i < narg; i++) {
|
||||
if (strcmp(arg[i],"NULL") == 0) {
|
||||
map[i-2] = -1;
|
||||
|
@ -659,7 +658,7 @@ void PairBOP::coeff(int narg, char **arg)
|
|||
}
|
||||
|
||||
MPI_Bcast(&map[1],atom->ntypes,MPI_INT,0,world);
|
||||
if (me == 0) {
|
||||
if (comm->me == 0) {
|
||||
if (elements) {
|
||||
for (i = 0; i < bop_types; i++) delete [] elements[i];
|
||||
delete [] elements;
|
||||
|
@ -1137,7 +1136,6 @@ double PairBOP::sigmaBo(int itmp, int jtmp)
|
|||
nlocal = atom->nlocal;
|
||||
ilist = list->ilist;
|
||||
firstneigh = list->firstneigh;
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
if(nb_sg==0) {
|
||||
nb_sg=(maxneigh)*(maxneigh/2);
|
||||
|
@ -4873,101 +4871,11 @@ double PairBOP::PiBo(int itmp, int jtmp)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
read BOP potential file
|
||||
allocate BOP tables
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void _noopt PairBOP::read_table(char *filename)
|
||||
void PairBOP::allocate_tables()
|
||||
{
|
||||
int i,j,k,n,m;
|
||||
int buf1,pass;
|
||||
int nws,ws;
|
||||
double buf2;
|
||||
char s[MAXLINE],buf[2];
|
||||
|
||||
MPI_Comm_rank(world,&me);
|
||||
if (me == 0) {
|
||||
FILE *fp = force->open_potential(filename);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); // skip first comment line
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%d",&bop_types);
|
||||
elements = new char*[bop_types];
|
||||
for(i=0;i<bop_types;i++) elements[i]=NULL;
|
||||
for(i=0;i<bop_types;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
nws=0;
|
||||
ws=1;
|
||||
for(j=0;j<(int)strlen(s);j++) {
|
||||
if(ws==1) {
|
||||
if(isspace(s[j])) {
|
||||
ws=1;
|
||||
} else {
|
||||
ws=0;
|
||||
}
|
||||
} else {
|
||||
if(isspace(s[j])) {
|
||||
ws=1;
|
||||
nws++;
|
||||
} else {
|
||||
ws=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(nws!=3){
|
||||
error->all(FLERR,"Incorrect table format check for element types");
|
||||
}
|
||||
sscanf(s,"%d %lf %s",&buf1,&buf2,buf);
|
||||
n= strlen(buf)+1;
|
||||
elements[i] = new char[n];
|
||||
strcpy(elements[i],buf);
|
||||
}
|
||||
nws=0;
|
||||
ws=1;
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
for(j=0;j<(int)strlen(s);j++) {
|
||||
if(ws==1) {
|
||||
if(isspace(s[j])) {
|
||||
ws=1;
|
||||
} else {
|
||||
ws=0;
|
||||
}
|
||||
} else {
|
||||
if(isspace(s[j])) {
|
||||
ws=1;
|
||||
nws++;
|
||||
} else {
|
||||
ws=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nws==3) {
|
||||
sscanf(s,"%d %d %d",&nr,&ntheta,&nBOt);
|
||||
npower=2;
|
||||
if(ntheta<=10) npower=ntheta;
|
||||
} else if (nws==2) {
|
||||
sscanf(s,"%d %d",&nr,&nBOt);
|
||||
ntheta=0;
|
||||
npower=3;
|
||||
} else {
|
||||
error->one(FLERR,"Unsupported BOP potential file format");
|
||||
}
|
||||
fclose(fp);
|
||||
npairs=bop_types*(bop_types+1)/2;
|
||||
}
|
||||
|
||||
MPI_Bcast(&nr,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&nBOt,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&ntheta,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&bop_types,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&npairs,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&npower,1,MPI_INT,0,world);
|
||||
|
||||
memory->destroy(pi_a);
|
||||
memory->destroy(pro_delta);
|
||||
memory->destroy(pi_delta);
|
||||
|
@ -5011,334 +4919,347 @@ void _noopt PairBOP::read_table(char *filename)
|
|||
memory->create(gfunc5,bop_types,bop_types,bop_types,ntheta,"BOP:gfunc5");
|
||||
memory->create(gfunc6,bop_types,bop_types,bop_types,ntheta,"BOP:gfunc6");
|
||||
memory->create(gpara,bop_types,bop_types,bop_types,npower+1,"BOP:gpara");
|
||||
}
|
||||
|
||||
allocate();
|
||||
if (me == 0) {
|
||||
FILE *fp = force->open_potential(filename);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open BOP potential file %s",filename);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); // skip first comment line
|
||||
for(i=0;i<bop_types+2;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
}
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf%lf%lf",&small1,&small2,&small3g
|
||||
,&small4,&small5,&small6,&small7);
|
||||
for(i=0;i<bop_types;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&pi_p[i]);
|
||||
}
|
||||
cutmax=0;
|
||||
for(i=0;i<npairs;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&rcut[i]);
|
||||
if(rcut[i]>cutmax)
|
||||
cutmax=rcut[i];
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf",&sigma_c[i],&sigma_a[i],&pi_c[i],&pi_a[i]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf",&sigma_delta[i],&pi_delta[i]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf",&sigma_f[i],&sigma_k[i],&small3[i]);
|
||||
}
|
||||
if(nws==3) {
|
||||
for(i=0;i<bop_types;i++)
|
||||
for(j=0;j<bop_types;j++)
|
||||
for(k=j;k<bop_types;k++) {
|
||||
if(npower<=2) {
|
||||
for(m=0;m<ntheta;m++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gfunc[j][i][k][n],&gfunc[j][i][k][n+1]
|
||||
,&gfunc[j][i][k][n+2],&gfunc[j][i][k][n+3],&gfunc[j][i][k][n+4]);
|
||||
n+=4;
|
||||
/* ----------------------------------------------------------------------
|
||||
read BOP potential file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void _noopt PairBOP::read_table(char *filename)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
try {
|
||||
PotentialFileReader reader(lmp, filename, "BOP");
|
||||
|
||||
bop_types = reader.next_int();
|
||||
elements = new char*[bop_types];
|
||||
for(int i=0; i < bop_types; i++) {
|
||||
ValueTokenizer values = reader.next_values(3);
|
||||
values.next_int();
|
||||
values.next_double();
|
||||
std::string name = values.next_string();
|
||||
|
||||
elements[i] = new char[name.length()+1];
|
||||
strcpy(elements[i], name.c_str());
|
||||
}
|
||||
|
||||
ValueTokenizer values = reader.next_values(2);
|
||||
int format = values.count();
|
||||
|
||||
switch(format) {
|
||||
case 3:
|
||||
nr = values.next_int();
|
||||
ntheta = values.next_int();
|
||||
nBOt = values.next_int();
|
||||
if(ntheta <= 10)
|
||||
npower = ntheta;
|
||||
else
|
||||
npower = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nr = values.next_int();
|
||||
nBOt = values.next_int();
|
||||
ntheta = 0;
|
||||
npower = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
error->one(FLERR,"Unsupported BOP potential file format");
|
||||
}
|
||||
|
||||
npairs = bop_types*(bop_types+1)/2;
|
||||
|
||||
allocate_tables();
|
||||
allocate();
|
||||
|
||||
values = reader.next_values(7);
|
||||
|
||||
small1 = values.next_double();
|
||||
small2 = values.next_double();
|
||||
small3g = values.next_double();
|
||||
small4 = values.next_double();
|
||||
small5 = values.next_double();
|
||||
small6 = values.next_double();
|
||||
small7 = values.next_double();
|
||||
|
||||
for(int i = 0; i < bop_types; i++) {
|
||||
pi_p[i] = reader.next_double();
|
||||
}
|
||||
|
||||
cutmax = 0.0;
|
||||
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
rcut[i] = reader.next_double();
|
||||
if (rcut[i] > cutmax)
|
||||
cutmax = rcut[i];
|
||||
|
||||
values = reader.next_values(4);
|
||||
sigma_c[i] = values.next_double();
|
||||
sigma_a[i] = values.next_double();
|
||||
pi_c[i] = values.next_double();
|
||||
pi_a[i] = values.next_double();
|
||||
|
||||
values = reader.next_values(2);
|
||||
sigma_delta[i] = values.next_double();
|
||||
pi_delta[i] = values.next_double();
|
||||
|
||||
values = reader.next_values(3);
|
||||
sigma_f[i] = values.next_double();
|
||||
sigma_k[i] = values.next_double();
|
||||
small3[i] = values.next_double();
|
||||
}
|
||||
|
||||
if(format == 3) {
|
||||
for(int i = 0; i < bop_types; i++)
|
||||
for(int j = 0; j < bop_types; j++)
|
||||
for(int k = j; k < bop_types; k++) {
|
||||
if(npower <= 2) {
|
||||
reader.next_dvector(&gfunc[j][i][k][0], ntheta);
|
||||
} else {
|
||||
reader.next_dvector(&gpara[j][i][k][0], npower+1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < bop_types; i++)
|
||||
for(int j = 0; j < bop_types; j++)
|
||||
for(int k = 0; k < bop_types; k++) {
|
||||
reader.next_dvector(&gpara[i][j][k][0], 3);
|
||||
gpara[j][i][k][3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
reader.next_dvector(&pRepul[i][0], nr);
|
||||
}
|
||||
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
reader.next_dvector(&pBetaS[i][0], nr);
|
||||
}
|
||||
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
reader.next_dvector(&pBetaP[i][0], nr);
|
||||
}
|
||||
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
reader.next_dvector(&FsigBO[i][0], nBOt);
|
||||
}
|
||||
|
||||
for(int i = 0; i < bop_types; i++) {
|
||||
pro_delta[i] = reader.next_double();
|
||||
}
|
||||
|
||||
for(int i = 0; i < bop_types; i++) {
|
||||
pro[i] = reader.next_double();
|
||||
}
|
||||
|
||||
for(int i=0;i<npairs;i++) {
|
||||
rcut3[i]=0.0;
|
||||
}
|
||||
|
||||
if(format == 3) {
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
rcut3[i] = reader.next_double();
|
||||
}
|
||||
for(int i = 0; i < npairs; i++) {
|
||||
reader.next_dvector(&pLong[i][0], nr);
|
||||
}
|
||||
}
|
||||
|
||||
rcutall=0.0;
|
||||
for(int i=0; i < npairs; i++) {
|
||||
if(rcut[i]>rcutall)
|
||||
rcutall=rcut[i];
|
||||
if(rcut3[i]>rcutall)
|
||||
rcutall=rcut3[i];
|
||||
rcutsq[i]=rcut[i]*rcut[i];
|
||||
dr[i]=rcut[i]/((double)nr-1.0);
|
||||
rdr[i]=1.0/dr[i];
|
||||
if (format == 3) {
|
||||
rcutsq3[i]=rcut3[i]*rcut3[i];
|
||||
dr3[i]=rcut3[i]/((double)nr-1.0);
|
||||
rdr3[i]=1.0/dr3[i];
|
||||
}
|
||||
}
|
||||
|
||||
rctroot=rcutall;
|
||||
dtheta=2.0/((double)ntheta-1.0);
|
||||
rdtheta=1.0/dtheta;
|
||||
dBO=1.0/((double)nBOt-1.0);
|
||||
rdBO=1.0/(double)dBO;
|
||||
|
||||
for (int i = 0; i < npairs; i++) {
|
||||
pBetaS1[i][0]=pBetaS[i][1]-pBetaS[i][0];
|
||||
pBetaS1[i][1]=0.5*(pBetaS[i][2]-pBetaS[i][0]);
|
||||
pBetaS1[i][nr-2]=0.5*(pBetaS[i][nr-1]-pBetaS[i][nr-3]);
|
||||
pBetaS1[i][nr-1]=pBetaS[i][nr-1]-pBetaS[i][nr-2];
|
||||
pBetaP1[i][0]=pBetaP[i][1]-pBetaP[i][0];
|
||||
pBetaP1[i][1]=0.5*(pBetaP[i][2]-pBetaP[i][0]);
|
||||
pBetaP1[i][nr-2]=0.5*(pBetaP[i][nr-1]-pBetaP[i][nr-3]);
|
||||
pBetaP1[i][nr-1]=pBetaP[i][nr-1]-pBetaP[i][nr-2];
|
||||
pRepul1[i][0]=pRepul[i][1]-pRepul[i][0];
|
||||
pRepul1[i][1]=0.5*(pRepul[i][2]-pRepul[i][0]);
|
||||
pRepul1[i][nr-2]=0.5*(pRepul[i][nr-1]-pRepul[i][nr-3]);
|
||||
pRepul1[i][nr-1]=pRepul[i][nr-1]-pRepul[i][nr-2];
|
||||
FsigBO1[i][0]=FsigBO[i][1]-FsigBO[i][0];
|
||||
FsigBO1[i][1]=0.5*(FsigBO[i][2]-FsigBO[i][0]);
|
||||
FsigBO1[i][nBOt-2]=0.5*(FsigBO[i][nBOt-1]-FsigBO[i][nBOt-3]);
|
||||
FsigBO1[i][nBOt-1]=FsigBO[i][nBOt-1]-FsigBO[i][nBOt-2];
|
||||
pLong1[i][0]=pLong[i][1]-pLong[i][0];
|
||||
pLong1[i][1]=0.5*(pLong[i][2]-pLong[i][0]);
|
||||
pLong1[i][nBOt-2]=0.5*(pLong[i][nr-1]-pLong[i][nr-3]);
|
||||
pLong1[i][nBOt-1]=pLong[i][nr-1]-pLong[i][nr-2];
|
||||
for (int k = 2; k < nr-2; k++) {
|
||||
pBetaS1[i][k]=((pBetaS[i][k-2]-pBetaS[i][k+2])
|
||||
+8.0*(pBetaS[i][k+1]-pBetaS[i][k-1]))/12.0;
|
||||
pBetaP1[i][k]=((pBetaP[i][k-2]-pBetaP[i][k+2])
|
||||
+8.0*(pBetaP[i][k+1]-pBetaP[i][k-1]))/12.0;
|
||||
pRepul1[i][k]=((pRepul[i][k-2]-pRepul[i][k+2])
|
||||
+8.0*(pRepul[i][k+1]-pRepul[i][k-1]))/12.0;
|
||||
pLong1[i][k]=((pLong[i][k-2]-pLong[i][k+2])
|
||||
+8.0*(pLong[i][k+1]-pLong[i][k-1]))/12.0;
|
||||
}
|
||||
for (int k=2; k < nr-2; k++) {
|
||||
FsigBO1[i][k]=((FsigBO[i][k-2]-FsigBO[i][k+2])
|
||||
+8.0*(FsigBO[i][k+1]-FsigBO[i][k-1]))/12.0;
|
||||
}
|
||||
for (int k = 0; k < nr-1; k++) {
|
||||
pBetaS2[i][k]=3.0*(pBetaS[i][k+1]-pBetaS[i][k])
|
||||
-2.0*pBetaS1[i][k]-pBetaS1[i][k+1];
|
||||
pBetaS3[i][k]=pBetaS1[i][k]+pBetaS1[i][k+1]
|
||||
-2.0*(pBetaS[i][k+1]-pBetaS[i][k]);
|
||||
pBetaP2[i][k]=3.0*(pBetaP[i][k+1]-pBetaP[i][k])
|
||||
-2.0*pBetaP1[i][k]-pBetaP1[i][k+1];
|
||||
pBetaP3[i][k]=pBetaP1[i][k]+pBetaP1[i][k+1]
|
||||
-2.0*(pBetaP[i][k+1]-pBetaP[i][k]);
|
||||
pRepul2[i][k]=3.0*(pRepul[i][k+1]-pRepul[i][k])
|
||||
-2.0*pRepul1[i][k]-pRepul1[i][k+1];
|
||||
pRepul3[i][k]=pRepul1[i][k]+pRepul1[i][k+1]
|
||||
-2.0*(pRepul[i][k+1]-pRepul[i][k]);
|
||||
pLong2[i][k]=3.0*(pLong[i][k+1]-pLong[i][k])
|
||||
-2.0*pLong1[i][k]-pLong1[i][k+1];
|
||||
pLong3[i][k]=pLong1[i][k]+pLong1[i][k+1]
|
||||
-2.0*(pLong[i][k+1]-pLong[i][k]);
|
||||
}
|
||||
|
||||
for (int k = 0; k < nBOt-1; k++) {
|
||||
FsigBO2[i][k]=3.0*(FsigBO[i][k+1]-FsigBO[i][k])
|
||||
-2.0*FsigBO1[i][k]-FsigBO1[i][k+1];
|
||||
FsigBO3[i][k]=FsigBO1[i][k]+FsigBO1[i][k+1]
|
||||
-2.0*(FsigBO[i][k+1]-FsigBO[i][k]);
|
||||
}
|
||||
|
||||
pBetaS2[i][nr-1]=0.0;
|
||||
pBetaS3[i][nr-1]=0.0;
|
||||
pBetaP2[i][nr-1]=0.0;
|
||||
pBetaP3[i][nr-1]=0.0;
|
||||
pRepul2[i][nr-1]=0.0;
|
||||
pRepul3[i][nr-1]=0.0;
|
||||
pLong2[i][nr-1]=0.0;
|
||||
pLong3[i][nr-1]=0.0;
|
||||
FsigBO2[i][nBOt-1]=0.0;
|
||||
FsigBO3[i][nBOt-1]=0.0;
|
||||
|
||||
for (int k=0; k < nr; k++) {
|
||||
pBetaS4[i][k]=pBetaS1[i][k]/dr[i];
|
||||
pBetaS5[i][k]=2.0*pBetaS2[i][k]/dr[i];
|
||||
pBetaS6[i][k]=3.0*pBetaS3[i][k]/dr[i];
|
||||
pBetaP4[i][k]=pBetaP1[i][k]/dr[i];
|
||||
pBetaP5[i][k]=2.0*pBetaP2[i][k]/dr[i];
|
||||
pBetaP6[i][k]=3.0*pBetaP3[i][k]/dr[i];
|
||||
pRepul4[i][k]=pRepul1[i][k]/dr[i];
|
||||
pRepul5[i][k]=2.0*pRepul2[i][k]/dr[i];
|
||||
pRepul6[i][k]=3.0*pRepul3[i][k]/dr[i];
|
||||
if (format == 3) {
|
||||
pLong4[i][k]=pLong1[i][k]/dr3[i];
|
||||
pLong5[i][k]=2.0*pLong2[i][k]/dr3[i];
|
||||
pLong6[i][k]=3.0*pLong3[i][k]/dr3[i];
|
||||
}
|
||||
}
|
||||
for (int k=0; k < nBOt; k++) {
|
||||
FsigBO4[i][k]=FsigBO1[i][k]/dBO;
|
||||
FsigBO5[i][k]=2.0*FsigBO2[i][k]/dBO;
|
||||
FsigBO6[i][k]=3.0*FsigBO3[i][k]/dBO;
|
||||
}
|
||||
}
|
||||
|
||||
if (npower <= 2) {
|
||||
for (int i = 0; i < bop_types; i++) {
|
||||
for (int j = 0; j < bop_types; j++) {
|
||||
for (int k = j; k < bop_types; k++) {
|
||||
gfunc1[j][i][k][0] = gfunc[j][i][k][1] - gfunc[j][i][k][0];
|
||||
gfunc1[j][i][k][1] = 0.5 * (gfunc[j][i][k][2] - gfunc[j][i][k][0]);
|
||||
gfunc1[j][i][k][ntheta - 2] = 0.5 * (gfunc[j][i][k][ntheta - 1] - gfunc[j][i][k][ntheta - 3]);
|
||||
gfunc1[j][i][k][ntheta - 1] = 0.5 * (gfunc[j][i][k][ntheta - 1] - gfunc[j][i][k][ntheta - 2]);
|
||||
|
||||
for (int m = 2; m < ntheta - 2; m++) {
|
||||
gfunc1[j][i][k][m] = ((gfunc[j][i][k][m - 2] - gfunc[j][i][k][m + 2]) +
|
||||
8.0 * (gfunc[j][i][k][m + 1] - gfunc[j][i][k][m + 1] - gfunc[j][i][k][m - 1])) /
|
||||
12.0;
|
||||
}
|
||||
|
||||
for (int m = 0; m < ntheta - 1; m++) {
|
||||
gfunc2[j][i][k][m] = 3.0 * (gfunc[j][i][k][m + 1] - gfunc[j][i][k][m]) -
|
||||
2.0 * gfunc1[j][i][k][m] - gfunc1[j][i][k][m + 1];
|
||||
gfunc3[j][i][k][m] = gfunc1[j][i][k][m] + gfunc1[j][i][k][m + 1] -
|
||||
2.0 * (gfunc[j][i][k][m + 1] - gfunc[j][i][k][m]);
|
||||
}
|
||||
|
||||
gfunc2[j][i][k][ntheta - 1] = 0.0;
|
||||
gfunc3[j][i][k][ntheta - 1] = 0.0;
|
||||
|
||||
for (int m = 0; m < ntheta; m++) {
|
||||
gfunc4[j][i][k][ntheta - 1] = gfunc1[j][i][k][m] / dtheta;
|
||||
gfunc5[j][i][k][ntheta - 1] = 2.0 * gfunc2[j][i][k][m] / dtheta;
|
||||
gfunc6[j][i][k][ntheta - 1] = 3.0 * gfunc3[j][i][k][m] / dtheta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < bop_types; i++) {
|
||||
for (int j = 0; j < bop_types; j++) {
|
||||
for (int k = 0; k < j; k++) {
|
||||
if (npower <= 2) {
|
||||
for (int n = 0; n < ntheta; n++) {
|
||||
gfunc[j][i][k][n] = gfunc[k][i][j][n];
|
||||
gfunc1[j][i][k][n] = gfunc1[k][i][j][n];
|
||||
gfunc2[j][i][k][n] = gfunc2[k][i][j][n];
|
||||
gfunc3[j][i][k][n] = gfunc3[k][i][j][n];
|
||||
gfunc4[j][i][k][n] = gfunc4[k][i][j][n];
|
||||
gfunc5[j][i][k][n] = gfunc5[k][i][j][n];
|
||||
gfunc6[j][i][k][n] = gfunc6[k][i][j][n];
|
||||
}
|
||||
} else {
|
||||
if(npower==3) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3]);
|
||||
for (int n = 0; n < npower + 1; n++) {
|
||||
gpara[j][i][k][n] = gpara[k][i][j][n];
|
||||
}
|
||||
else if(npower==4) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
}
|
||||
else if(npower==5) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&gpara[j][i][k][5]);
|
||||
}
|
||||
else if(npower==6) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6]);
|
||||
}
|
||||
else if(npower==7) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7]);
|
||||
}
|
||||
else if(npower==8) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8]);
|
||||
}
|
||||
else if(npower==9) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
||||
}
|
||||
else if(npower==10) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][0],&gpara[j][i][k][1],&gpara[j][i][k][2],&gpara[j][i][k][3],&gpara[j][i][k][4]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&gpara[j][i][k][5],&gpara[j][i][k][6],&gpara[j][i][k][7],&gpara[j][i][k][8],&gpara[j][i][k][9]);
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&gpara[j][i][k][10]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(i=0;i<bop_types;i++)
|
||||
for(j=0;j<bop_types;j++)
|
||||
for(k=0;k<bop_types;k++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf",&gpara[i][j][k][0],&gpara[i][j][k][1],&gpara[i][j][k][2]);
|
||||
gpara[j][i][k][3]=0;
|
||||
}
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
for(j=0;j<nr;j++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&pRepul[i][j],&pRepul[i][j+1]
|
||||
,&pRepul[i][j+2],&pRepul[i][j+3],&pRepul[i][j+4]);
|
||||
j+=4;
|
||||
}
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
for(j=0;j<nr;j++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaS[i][j],&pBetaS[i][j+1]
|
||||
,&pBetaS[i][j+2],&pBetaS[i][j+3],&pBetaS[i][j+4]);
|
||||
j+=4;
|
||||
}
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
for(j=0;j<nr;j++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&pBetaP[i][j],&pBetaP[i][j+1]
|
||||
,&pBetaP[i][j+2],&pBetaP[i][j+3],&pBetaP[i][j+4]);
|
||||
j+=4;
|
||||
}
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
for(j=0;j<nBOt;j++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&FsigBO[i][j],&FsigBO[i][j+1]
|
||||
,&FsigBO[i][j+2],&FsigBO[i][j+3],&FsigBO[i][j+4]);
|
||||
j+=4;
|
||||
}
|
||||
}
|
||||
for(i=0;i<bop_types;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&pro_delta[i]);
|
||||
}
|
||||
for(i=0;i<bop_types;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&pro[i]);
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
rcut3[i]=0.0;
|
||||
}
|
||||
pass=0;
|
||||
i=0;
|
||||
if(nws==3) {
|
||||
for(i=0;i<npairs;i++) {
|
||||
utils::sfgets(FLERR,s,MAXLINE,fp,filename,error);
|
||||
sscanf(s,"%lf",&rcut3[i]);
|
||||
}
|
||||
for(i=0;i<npairs;i++) {
|
||||
for(j=0;j<nr;j++) {
|
||||
pass=0;
|
||||
while(fgets(s,MAXLINE,fp)!=NULL&&pass==0) {
|
||||
sscanf(s,"%lf%lf%lf%lf%lf",&pLong[i][j],&pLong[i][j+1]
|
||||
,&pLong[i][j+2],&pLong[i][j+3],&pLong[i][j+4]);
|
||||
j+=4;
|
||||
pass=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rcutall=0.0;
|
||||
for(i=0;i<npairs;i++) {
|
||||
if(rcut[i]>rcutall)
|
||||
rcutall=rcut[i];
|
||||
if(rcut3[i]>rcutall)
|
||||
rcutall=rcut3[i];
|
||||
rcutsq[i]=rcut[i]*rcut[i];
|
||||
dr[i]=rcut[i]/((double)nr-1.0);
|
||||
rdr[i]=1.0/dr[i];
|
||||
if (nws==3) {
|
||||
rcutsq3[i]=rcut3[i]*rcut3[i];
|
||||
dr3[i]=rcut3[i]/((double)nr-1.0);
|
||||
rdr3[i]=1.0/dr3[i];
|
||||
}
|
||||
}
|
||||
rctroot=rcutall;
|
||||
dtheta=2.0/((double)ntheta-1.0);
|
||||
rdtheta=1.0/dtheta;
|
||||
dBO=1.0/((double)nBOt-1.0);
|
||||
rdBO=1.0/(double)dBO;
|
||||
for(i=0;i<npairs;i++) {
|
||||
pBetaS1[i][0]=pBetaS[i][1]-pBetaS[i][0];
|
||||
pBetaS1[i][1]=0.5*(pBetaS[i][2]-pBetaS[i][0]);
|
||||
pBetaS1[i][nr-2]=0.5*(pBetaS[i][nr-1]-pBetaS[i][nr-3]);
|
||||
pBetaS1[i][nr-1]=pBetaS[i][nr-1]-pBetaS[i][nr-2];
|
||||
pBetaP1[i][0]=pBetaP[i][1]-pBetaP[i][0];
|
||||
pBetaP1[i][1]=0.5*(pBetaP[i][2]-pBetaP[i][0]);
|
||||
pBetaP1[i][nr-2]=0.5*(pBetaP[i][nr-1]-pBetaP[i][nr-3]);
|
||||
pBetaP1[i][nr-1]=pBetaP[i][nr-1]-pBetaP[i][nr-2];
|
||||
pRepul1[i][0]=pRepul[i][1]-pRepul[i][0];
|
||||
pRepul1[i][1]=0.5*(pRepul[i][2]-pRepul[i][0]);
|
||||
pRepul1[i][nr-2]=0.5*(pRepul[i][nr-1]-pRepul[i][nr-3]);
|
||||
pRepul1[i][nr-1]=pRepul[i][nr-1]-pRepul[i][nr-2];
|
||||
FsigBO1[i][0]=FsigBO[i][1]-FsigBO[i][0];
|
||||
FsigBO1[i][1]=0.5*(FsigBO[i][2]-FsigBO[i][0]);
|
||||
FsigBO1[i][nBOt-2]=0.5*(FsigBO[i][nBOt-1]-FsigBO[i][nBOt-3]);
|
||||
FsigBO1[i][nBOt-1]=FsigBO[i][nBOt-1]-FsigBO[i][nBOt-2];
|
||||
pLong1[i][0]=pLong[i][1]-pLong[i][0];
|
||||
pLong1[i][1]=0.5*(pLong[i][2]-pLong[i][0]);
|
||||
pLong1[i][nBOt-2]=0.5*(pLong[i][nr-1]-pLong[i][nr-3]);
|
||||
pLong1[i][nBOt-1]=pLong[i][nr-1]-pLong[i][nr-2];
|
||||
for(k=2;k<nr-2;k++) {
|
||||
pBetaS1[i][k]=((pBetaS[i][k-2]-pBetaS[i][k+2])
|
||||
+8.0*(pBetaS[i][k+1]-pBetaS[i][k-1]))/12.0;
|
||||
pBetaP1[i][k]=((pBetaP[i][k-2]-pBetaP[i][k+2])
|
||||
+8.0*(pBetaP[i][k+1]-pBetaP[i][k-1]))/12.0;
|
||||
pRepul1[i][k]=((pRepul[i][k-2]-pRepul[i][k+2])
|
||||
+8.0*(pRepul[i][k+1]-pRepul[i][k-1]))/12.0;
|
||||
pLong1[i][k]=((pLong[i][k-2]-pLong[i][k+2])
|
||||
+8.0*(pLong[i][k+1]-pLong[i][k-1]))/12.0;
|
||||
}
|
||||
for(k=2;k<nr-2;k++) {
|
||||
FsigBO1[i][k]=((FsigBO[i][k-2]-FsigBO[i][k+2])
|
||||
+8.0*(FsigBO[i][k+1]-FsigBO[i][k-1]))/12.0;
|
||||
}
|
||||
for(k=0;k<nr-1;k++) {
|
||||
pBetaS2[i][k]=3.0*(pBetaS[i][k+1]-pBetaS[i][k])
|
||||
-2.0*pBetaS1[i][k]-pBetaS1[i][k+1];
|
||||
pBetaS3[i][k]=pBetaS1[i][k]+pBetaS1[i][k+1]
|
||||
-2.0*(pBetaS[i][k+1]-pBetaS[i][k]);
|
||||
pBetaP2[i][k]=3.0*(pBetaP[i][k+1]-pBetaP[i][k])
|
||||
-2.0*pBetaP1[i][k]-pBetaP1[i][k+1];
|
||||
pBetaP3[i][k]=pBetaP1[i][k]+pBetaP1[i][k+1]
|
||||
-2.0*(pBetaP[i][k+1]-pBetaP[i][k]);
|
||||
pRepul2[i][k]=3.0*(pRepul[i][k+1]-pRepul[i][k])
|
||||
-2.0*pRepul1[i][k]-pRepul1[i][k+1];
|
||||
pRepul3[i][k]=pRepul1[i][k]+pRepul1[i][k+1]
|
||||
-2.0*(pRepul[i][k+1]-pRepul[i][k]);
|
||||
pLong2[i][k]=3.0*(pLong[i][k+1]-pLong[i][k])
|
||||
-2.0*pLong1[i][k]-pLong1[i][k+1];
|
||||
pLong3[i][k]=pLong1[i][k]+pLong1[i][k+1]
|
||||
-2.0*(pLong[i][k+1]-pLong[i][k]);
|
||||
}
|
||||
for(k=0;k<nBOt-1;k++) {
|
||||
FsigBO2[i][k]=3.0*(FsigBO[i][k+1]-FsigBO[i][k])
|
||||
-2.0*FsigBO1[i][k]-FsigBO1[i][k+1];
|
||||
FsigBO3[i][k]=FsigBO1[i][k]+FsigBO1[i][k+1]
|
||||
-2.0*(FsigBO[i][k+1]-FsigBO[i][k]);
|
||||
}
|
||||
pBetaS2[i][nr-1]=0.0;
|
||||
pBetaS3[i][nr-1]=0.0;
|
||||
pBetaP2[i][nr-1]=0.0;
|
||||
pBetaP3[i][nr-1]=0.0;
|
||||
pRepul2[i][nr-1]=0.0;
|
||||
pRepul3[i][nr-1]=0.0;
|
||||
pLong2[i][nr-1]=0.0;
|
||||
pLong3[i][nr-1]=0.0;
|
||||
FsigBO2[i][nBOt-1]=0.0;
|
||||
FsigBO3[i][nBOt-1]=0.0;
|
||||
for(k=0;k<nr;k++) {
|
||||
pBetaS4[i][k]=pBetaS1[i][k]/dr[i];
|
||||
pBetaS5[i][k]=2.0*pBetaS2[i][k]/dr[i];
|
||||
pBetaS6[i][k]=3.0*pBetaS3[i][k]/dr[i];
|
||||
pBetaP4[i][k]=pBetaP1[i][k]/dr[i];
|
||||
pBetaP5[i][k]=2.0*pBetaP2[i][k]/dr[i];
|
||||
pBetaP6[i][k]=3.0*pBetaP3[i][k]/dr[i];
|
||||
pRepul4[i][k]=pRepul1[i][k]/dr[i];
|
||||
pRepul5[i][k]=2.0*pRepul2[i][k]/dr[i];
|
||||
pRepul6[i][k]=3.0*pRepul3[i][k]/dr[i];
|
||||
if (nws==3) {
|
||||
pLong4[i][k]=pLong1[i][k]/dr3[i];
|
||||
pLong5[i][k]=2.0*pLong2[i][k]/dr3[i];
|
||||
pLong6[i][k]=3.0*pLong3[i][k]/dr3[i];
|
||||
}
|
||||
}
|
||||
for(k=0;k<nBOt;k++) {
|
||||
FsigBO4[i][k]=FsigBO1[i][k]/dBO;
|
||||
FsigBO5[i][k]=2.0*FsigBO2[i][k]/dBO;
|
||||
FsigBO6[i][k]=3.0*FsigBO3[i][k]/dBO;
|
||||
}
|
||||
}
|
||||
if(npower<=2) {
|
||||
for(i=0;i<bop_types;i++) {
|
||||
for(j=0;j<bop_types;j++) {
|
||||
for(k=j;k<bop_types;k++) {
|
||||
gfunc1[j][i][k][0]=gfunc[j][i][k][1]-gfunc[j][i][k][0];
|
||||
gfunc1[j][i][k][1]=0.5*(gfunc[j][i][k][2]-gfunc[j][i][k][0]);
|
||||
gfunc1[j][i][k][ntheta-2]=0.5*(gfunc[j][i][k][ntheta-1]-gfunc[j][i][k][ntheta-3]);
|
||||
gfunc1[j][i][k][ntheta-1]=0.5*(gfunc[j][i][k][ntheta-1]-gfunc[j][i][k][ntheta-2]);
|
||||
for(m=2;m<ntheta-2;m++) {
|
||||
gfunc1[j][i][k][m]=((gfunc[j][i][k][m-2]-gfunc[j][i][k][m+2])+
|
||||
8.0*(gfunc[j][i][k][m+1]-gfunc[j][i][k][m+1]-gfunc[j][i][k][m-1]))/12.0;
|
||||
}
|
||||
for(m=0;m<ntheta-1;m++) {
|
||||
gfunc2[j][i][k][m]=3.0*(gfunc[j][i][k][m+1]-gfunc[j][i][k][m])-
|
||||
2.0*gfunc1[j][i][k][m]-gfunc1[j][i][k][m+1];
|
||||
gfunc3[j][i][k][m]=gfunc1[j][i][k][m]+gfunc1[j][i][k][m+1]-
|
||||
2.0*(gfunc[j][i][k][m+1]-gfunc[j][i][k][m]);
|
||||
}
|
||||
gfunc2[j][i][k][ntheta-1]=0.0;
|
||||
gfunc3[j][i][k][ntheta-1]=0.0;
|
||||
for(m=0;m<ntheta;m++) {
|
||||
gfunc4[j][i][k][ntheta-1]=gfunc1[j][i][k][m]/dtheta;
|
||||
gfunc5[j][i][k][ntheta-1]=2.0*gfunc2[j][i][k][m]/dtheta;
|
||||
gfunc6[j][i][k][ntheta-1]=3.0*gfunc3[j][i][k][m]/dtheta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
} catch (FileReaderException & fre) {
|
||||
error->one(FLERR, fre.what());
|
||||
}
|
||||
for(i=0;i<bop_types;i++) {
|
||||
for(j=0;j<bop_types;j++) {
|
||||
for(k=0;k<j;k++) {
|
||||
if(npower<=2) {
|
||||
for(n=0;n<ntheta;n++) {
|
||||
gfunc[j][i][k][n]=gfunc[k][i][j][n];
|
||||
gfunc1[j][i][k][n]=gfunc1[k][i][j][n];
|
||||
gfunc2[j][i][k][n]=gfunc2[k][i][j][n];
|
||||
gfunc3[j][i][k][n]=gfunc3[k][i][j][n];
|
||||
gfunc4[j][i][k][n]=gfunc4[k][i][j][n];
|
||||
gfunc5[j][i][k][n]=gfunc5[k][i][j][n];
|
||||
gfunc6[j][i][k][n]=gfunc6[k][i][j][n];
|
||||
}
|
||||
} else {
|
||||
for(n=0;n<npower+1;n++) {
|
||||
gpara[j][i][k][n]=gpara[k][i][j][n];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
MPI_Bcast(&nr,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&nBOt,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&ntheta,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&bop_types,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&npairs,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&npower,1,MPI_INT,0,world);
|
||||
|
||||
if (comm->me != 0){
|
||||
allocate_tables();
|
||||
allocate();
|
||||
}
|
||||
|
||||
MPI_Bcast(&rdBO,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&dBO,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&rdtheta,1,MPI_DOUBLE,0,world);
|
||||
|
|
|
@ -41,7 +41,6 @@ class PairBOP : public Pair {
|
|||
double memory_usage();
|
||||
|
||||
private:
|
||||
int me;
|
||||
int maxneigh; // maximum size of neighbor list on this processor
|
||||
int maxneigh3; // maximum size of neighbor list on this processor
|
||||
int update_list; // check for changing maximum size of neighbor list
|
||||
|
@ -207,6 +206,7 @@ class PairBOP : public Pair {
|
|||
|
||||
void read_table(char *);
|
||||
void allocate();
|
||||
void allocate_tables();
|
||||
void create_pi(int);
|
||||
void create_sigma(int);
|
||||
void destroy_pi();
|
||||
|
|
|
@ -594,7 +594,7 @@ void PairComb::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line," \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -312,84 +312,45 @@ double PairComb3::init_one(int i, int j)
|
|||
|
||||
void PairComb3::read_lib()
|
||||
{
|
||||
const unsigned int MAXLIB = 1024;
|
||||
int i,j,k,l,m;
|
||||
int ii,jj,kk,ll,mm,iii;
|
||||
char s[MAXLIB];
|
||||
|
||||
// open library file on proc 0
|
||||
|
||||
if (comm->me == 0) {
|
||||
const char filename[] = "lib.comb3";
|
||||
FILE *fp = force->open_potential(filename);
|
||||
if (fp == NULL) error->one(FLERR,"Cannot open COMB3 lib.comb3 file");
|
||||
|
||||
try {
|
||||
// read and store at the same time
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
ValueTokenizer values(s, " \t\n\r\f");
|
||||
|
||||
ccutoff[0] = values.next_double();
|
||||
ccutoff[1] = values.next_double();
|
||||
ccutoff[2] = values.next_double();
|
||||
ccutoff[3] = values.next_double();
|
||||
ccutoff[4] = values.next_double();
|
||||
ccutoff[5] = values.next_double();
|
||||
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
ch_a[0] = values.next_double();
|
||||
ch_a[1] = values.next_double();
|
||||
ch_a[2] = values.next_double();
|
||||
ch_a[3] = values.next_double();
|
||||
ch_a[4] = values.next_double();
|
||||
ch_a[5] = values.next_double();
|
||||
ch_a[6] = values.next_double();
|
||||
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
PotentialFileReader reader(lmp, "lib.comb3", "COMB3");
|
||||
reader.next_dvector(ccutoff, 6);
|
||||
reader.next_dvector(ch_a, 7);
|
||||
|
||||
ValueTokenizer values = reader.next_values(3);
|
||||
nsplpcn = values.next_int();
|
||||
nsplrad = values.next_int();
|
||||
nspltor = values.next_int();
|
||||
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
values = reader.next_values(3);
|
||||
maxx = values.next_int();
|
||||
maxy = values.next_int();
|
||||
maxz = values.next_int();
|
||||
|
||||
utils::sfgets(FLERR,s,MAXLIB,fp,filename,error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
values = reader.next_values(3);
|
||||
maxxc = values.next_int();
|
||||
maxyc = values.next_int();
|
||||
maxconj = values.next_int();
|
||||
|
||||
for (l = 0; l < nsplpcn; l++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(3);
|
||||
values.skip(1);
|
||||
|
||||
maxxcn[l] = values.next_int();
|
||||
vmaxxcn[l] = values.next_double();
|
||||
dvmaxxcn[l] = values.next_double();
|
||||
}
|
||||
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
ntab = values.next_int();
|
||||
ntab = reader.next_int();
|
||||
|
||||
for (i = 0; i < (ntab + 1); i++){
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(4);
|
||||
values.skip(1);
|
||||
|
||||
pang[i] = values.next_double();
|
||||
dpang[i] = values.next_double();
|
||||
ddpang[i] = values.next_double();
|
||||
|
@ -399,8 +360,7 @@ void PairComb3::read_lib()
|
|||
for (i = 0; i < (maxx + 1); i++)
|
||||
for (j = 0; j < (maxy + 1); j++)
|
||||
for (k = 0; k < (maxz + 1); k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(8);
|
||||
|
||||
ll = values.next_int() - 1;
|
||||
ii = values.next_int();
|
||||
|
@ -416,8 +376,7 @@ void PairComb3::read_lib()
|
|||
for (i = 0; i < maxx; i++)
|
||||
for (j = 0; j < maxy; j++)
|
||||
for (k = 0; k < maxz; k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(4);
|
||||
|
||||
ll = values.next_int()-1;
|
||||
ii = values.next_int();
|
||||
|
@ -425,13 +384,8 @@ void PairComb3::read_lib()
|
|||
kk = values.next_int();
|
||||
|
||||
for(iii = 0; iii < 2; iii++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
for(m = 0; m < 32 ; m++) {
|
||||
mm = iii*32 + m;
|
||||
pcn_cubs[ll][ii][jj][kk][mm] = values.next_double();
|
||||
}
|
||||
mm = iii*32;
|
||||
reader.next_dvector(&pcn_cubs[ll][ii][jj][kk][mm], 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,8 +393,7 @@ void PairComb3::read_lib()
|
|||
for (i = 0; i < (maxxc + 1); i++)
|
||||
for (j = 0; j < (maxyc + 1); j++)
|
||||
for (k = 0; k < maxconj; k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(8);
|
||||
|
||||
ll = values.next_int() - 1;
|
||||
ii = values.next_int();
|
||||
|
@ -456,8 +409,7 @@ void PairComb3::read_lib()
|
|||
for (i = 0; i < maxxc; i++)
|
||||
for (j = 0; j < maxyc; j++)
|
||||
for (k = 0; k < (maxconj - 1); k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(4);
|
||||
|
||||
ll = values.next_int() - 1;
|
||||
ii = values.next_int();
|
||||
|
@ -465,13 +417,8 @@ void PairComb3::read_lib()
|
|||
kk = values.next_int() - 1;
|
||||
|
||||
for (iii = 0; iii < 2; iii++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
for(m = 0; m < 32 ; m++){
|
||||
mm = iii * 32 + m;
|
||||
rad_spl[ll][ii][jj][kk][mm] = values.next_double();
|
||||
}
|
||||
mm = iii * 32;
|
||||
reader.next_dvector(&rad_spl[ll][ii][jj][kk][mm], 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,8 +426,7 @@ void PairComb3::read_lib()
|
|||
for (i=0; i<maxxc+1; i++)
|
||||
for (j=0; j<maxyc+1; j++)
|
||||
for (k=0; k<maxconj; k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(8);
|
||||
|
||||
ll = values.next_int() - 1;
|
||||
ii = values.next_int();
|
||||
|
@ -496,26 +442,21 @@ void PairComb3::read_lib()
|
|||
for (i=0; i<maxxc; i++)
|
||||
for (j=0; j<maxyc; j++)
|
||||
for (k=0; k<maxconj-1; k++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
values = reader.next_values(4);
|
||||
|
||||
ll = values.next_int() - 1;
|
||||
ii = values.next_int();
|
||||
jj = values.next_int();
|
||||
kk = values.next_int() - 1;
|
||||
for(iii=0; iii<2; iii++) {
|
||||
utils::sfgets(FLERR, s, MAXLIB, fp, filename, error);
|
||||
values = ValueTokenizer(s, " \t\n\r\f");
|
||||
|
||||
for (m = 0; m < 32 ; m++){
|
||||
mm=iii*32+m;
|
||||
tor_spl[ll][ii][jj][kk][mm] = values.next_double();
|
||||
}
|
||||
mm=iii*32;
|
||||
reader.next_dvector(&tor_spl[ll][ii][jj][kk][mm], 32);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
} catch (FileReaderException & fre) {
|
||||
error->one(FLERR, fre.what());
|
||||
} catch (TokenizerException & e) {
|
||||
fclose(fp);
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
}
|
||||
|
@ -594,7 +535,7 @@ void PairComb3::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -473,13 +473,11 @@ void PairEAM::read_file(char *filename)
|
|||
|
||||
reader.skip_line();
|
||||
|
||||
line = reader.next_line(2);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass = values.next_double();
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -493,9 +491,9 @@ void PairEAM::read_file(char *filename)
|
|||
memory->create(file->rhor, (file->nr+1), "pair:rhor");
|
||||
memory->create(file->zr, (file->nr+1), "pair:zr");
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[1]);
|
||||
reader.next_dvector(file->nr, &file->zr[1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[1]);
|
||||
reader.next_dvector(&file->frho[1], file->nrho);
|
||||
reader.next_dvector(&file->zr[1], file->nr);
|
||||
reader.next_dvector(&file->rhor[1], file->nr);
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
|
|
@ -122,15 +122,12 @@ void PairEAMAlloy::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +143,7 @@ void PairEAMAlloy::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,18 +159,17 @@ void PairEAMAlloy::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -514,7 +514,7 @@ void PairEAMCD::read_h_coeff(char *filename)
|
|||
strcpy(line, nextline);
|
||||
}
|
||||
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
int degree = values.next_int();
|
||||
nhcoeff = degree+1;
|
||||
|
||||
|
|
|
@ -129,8 +129,7 @@ void PairEAMFS::read_file(char *filename)
|
|||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +145,7 @@ void PairEAMFS::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,21 +161,20 @@ void PairEAMFS::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
|
||||
for (int j = 0; j < file->nelements; j++) {
|
||||
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
|
||||
reader.next_dvector(&file->rhor[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "potential_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
|
@ -1059,9 +1060,7 @@ EIMPotentialFileReader::EIMPotentialFileReader(LAMMPS * lmp, const std::string &
|
|||
FILE * fp = force->open_potential(filename.c_str());
|
||||
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str, 128, "cannot open EIM potential file %s", filename.c_str());
|
||||
error->one(FLERR, str);
|
||||
error->one(FLERR, fmt::format("cannot open EIM potential file {}", filename));
|
||||
}
|
||||
|
||||
parse(fp);
|
||||
|
@ -1141,7 +1140,7 @@ void EIMPotentialFileReader::parse(FILE * fp)
|
|||
bool found_global = false;
|
||||
|
||||
while((line = next_line(fp))) {
|
||||
ValueTokenizer values(line, " \t\r\n\f");
|
||||
ValueTokenizer values(line);
|
||||
std::string type = values.next_string();
|
||||
|
||||
if (type == "global:") {
|
||||
|
|
|
@ -380,7 +380,7 @@ void PairGW::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -75,7 +75,7 @@ void PairGWZBL::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -296,7 +296,7 @@ void PairNb3bHarmonic::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -571,8 +571,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
try {
|
||||
reader = new PotentialFileReader(lmp, file, "polymorphic");
|
||||
|
||||
char * line = reader->next_line(2);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader->next_values(2);
|
||||
|
||||
int ntypes = values.next_int();
|
||||
|
||||
|
@ -585,8 +584,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
match = new int[nelements];
|
||||
|
||||
for (int i = 0; i < nelements; i++) {
|
||||
line = reader->next_line(3);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader->next_values(3);
|
||||
values.next_double(); // atomic number
|
||||
values.next_double(); // atomic mass
|
||||
std::string name = values.next_string();
|
||||
|
@ -602,9 +600,8 @@ void PairPolymorphic::read_file(char *file)
|
|||
// sizes
|
||||
// Note: the format of this line has changed between the
|
||||
// 2015-06-06 and 2015-12-09 versions of the pair style.
|
||||
line = reader->next_line(4);
|
||||
try {
|
||||
values = ValueTokenizer(line);
|
||||
values = reader->next_values(4);
|
||||
nr = ng = nx = 0;
|
||||
nr = values.next_int();
|
||||
ng = values.next_int();
|
||||
|
@ -625,8 +622,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
|
||||
for (int i = 0; i < npair; i++) {
|
||||
PairParameters & p = pairParameters[i];
|
||||
line = reader->next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader->next_values(2);
|
||||
p.cut = values.next_double();
|
||||
p.cutsq = p.cut*p.cut;
|
||||
p.xi = values.next_double();
|
||||
|
@ -658,7 +654,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < npair; i++) { // U
|
||||
PairParameters & p = pairParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
p.U = new tabularFunction(nr,0.0,p.cut);
|
||||
|
@ -667,7 +663,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < npair; i++) { // V
|
||||
PairParameters & p = pairParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
p.V = new tabularFunction(nr,0.0,p.cut);
|
||||
|
@ -676,7 +672,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < npair; i++) { // W
|
||||
PairParameters & p = pairParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
p.W = new tabularFunction(nr,0.0,p.cut);
|
||||
|
@ -693,7 +689,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
if (eta != 3) {
|
||||
for (int j = 0; j < nelements; j++) { // P
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
for (int i = 0; i < nelements; i++) {
|
||||
|
@ -705,7 +701,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int j = 0; j < nelements-1; j++) { // P
|
||||
for (int k = j+1; k < nelements; k++) {
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
for (int i = 0; i < nelements; i++) {
|
||||
|
@ -723,7 +719,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < ntriple; i++) { // P
|
||||
TripletParameters & p = tripletParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nr, singletable);
|
||||
reader->next_dvector(singletable, nr);
|
||||
}
|
||||
MPI_Bcast(singletable,nr,MPI_DOUBLE,0,world);
|
||||
p.P = new tabularFunction(nr,-cutmax,cutmax);
|
||||
|
@ -735,7 +731,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < ntriple; i++) { // G
|
||||
TripletParameters & p = tripletParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(ng, singletable);
|
||||
reader->next_dvector(singletable, ng);
|
||||
}
|
||||
MPI_Bcast(singletable,ng,MPI_DOUBLE,0,world);
|
||||
p.G = new tabularFunction(ng,-1.0,1.0);
|
||||
|
@ -746,7 +742,7 @@ void PairPolymorphic::read_file(char *file)
|
|||
for (int i = 0; i < npair; i++) { // F
|
||||
PairParameters & p = pairParameters[i];
|
||||
if (comm->me == 0) {
|
||||
reader->next_dvector(nx, singletable);
|
||||
reader->next_dvector(singletable, nx);
|
||||
}
|
||||
MPI_Bcast(singletable,nx,MPI_DOUBLE,0,world);
|
||||
p.F = new tabularFunction(nx,0.0,maxX);
|
||||
|
|
|
@ -360,7 +360,7 @@ void PairSW::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -405,7 +405,7 @@ void PairTersoff::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -58,7 +58,7 @@ void PairTersoffMOD::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -49,7 +49,7 @@ void PairTersoffMODC::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -76,7 +76,7 @@ void PairTersoffZBL::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -366,7 +366,7 @@ void PairVashishta::read_file(char *file)
|
|||
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line, " \t\n\r\f");
|
||||
ValueTokenizer values(line);
|
||||
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
|
|
|
@ -29,14 +29,15 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "table_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
enum{LINEAR,SPLINE};
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define SMALL 0.001
|
||||
#define TINY 1.E-10
|
||||
|
||||
|
@ -381,61 +382,45 @@ void AngleTable::free_table(Table *tb)
|
|||
|
||||
void AngleTable::read_table(Table *tb, char *file, char *keyword)
|
||||
{
|
||||
char line[MAXLINE];
|
||||
TableFileReader reader(lmp, file, "angle");
|
||||
|
||||
// open file
|
||||
char * line = reader.find_section_start(keyword);
|
||||
|
||||
FILE *fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open file %s",file);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
|
||||
// loop until section found with matching keyword
|
||||
|
||||
while (1) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL)
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
if (strspn(line," \t\n") == strlen(line)) continue; // blank line
|
||||
if (line[0] == '#') continue; // comment
|
||||
char *word = strtok(line," \t\n\r");
|
||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||
param_extract(tb,line);
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
for (int i = 0; i < tb->ninput; i++)
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
if (!line) {
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
}
|
||||
|
||||
// read args on 2nd line of section
|
||||
// allocate table arrays for file values
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
param_extract(tb,line);
|
||||
memory->create(tb->afile,tb->ninput,"angle:afile");
|
||||
memory->create(tb->efile,tb->ninput,"angle:efile");
|
||||
memory->create(tb->ffile,tb->ninput,"angle:ffile");
|
||||
line = reader.next_line();
|
||||
param_extract(tb, line);
|
||||
memory->create(tb->afile, tb->ninput, "angle:afile");
|
||||
memory->create(tb->efile, tb->ninput, "angle:efile");
|
||||
memory->create(tb->ffile, tb->ninput, "angle:ffile");
|
||||
|
||||
// read a,e,f table values from file
|
||||
|
||||
int cerror = 0;
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
if (3 != sscanf(line,"%*d %lg %lg %lg",
|
||||
&tb->afile[i],&tb->efile[i],&tb->ffile[i])) ++cerror;
|
||||
line = reader.next_line(4);
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->afile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException & e) {
|
||||
++cerror;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror) {
|
||||
char str[128];
|
||||
sprintf(str,"%d of %d lines in table were incomplete or could not be"
|
||||
" parsed completely",cerror,tb->ninput);
|
||||
error->warning(FLERR,str);
|
||||
std::string str = fmt::format("{} of {} lines in table were incomplete or could not be parsed completely", cerror, tb->ninput);
|
||||
error->warning(FLERR,str.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,26 +506,28 @@ void AngleTable::param_extract(Table *tb, char *line)
|
|||
tb->fpflag = 0;
|
||||
tb->theta0 = MY_PI;
|
||||
|
||||
char *word = strtok(line," \t\n\r\f");
|
||||
while (word) {
|
||||
if (strcmp(word,"N") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->ninput = atoi(word);
|
||||
} else if (strcmp(word,"FP") == 0) {
|
||||
tb->fpflag = 1;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fplo = atof(word);
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fphi = atof(word);
|
||||
tb->fplo *= (180.0/MY_PI)*(180.0/MY_PI);
|
||||
tb->fphi *= (180.0/MY_PI)*(180.0/MY_PI);
|
||||
} else if (strcmp(word,"EQ") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->theta0 = atof(word)/180.0*MY_PI;
|
||||
} else {
|
||||
error->one(FLERR,"Invalid keyword in angle table parameters");
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
|
||||
while (values.has_next()) {
|
||||
std::string word = values.next_string();
|
||||
|
||||
if (word == "N") {
|
||||
tb->ninput = values.next_int();
|
||||
} else if (word == "FP") {
|
||||
tb->fpflag = 1;
|
||||
tb->fplo = values.next_double();
|
||||
tb->fphi = values.next_double();
|
||||
tb->fplo *= (180.0/MY_PI)*(180.0/MY_PI);
|
||||
tb->fphi *= (180.0/MY_PI)*(180.0/MY_PI);
|
||||
} else if (word == "EQ") {
|
||||
tb->theta0 = values.next_double()/180.0*MY_PI;
|
||||
} else {
|
||||
error->one(FLERR,"Invalid keyword in angle table parameters");
|
||||
}
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
} catch(TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
if (tb->ninput == 0) error->one(FLERR,"Angle table parameters did not set N");
|
||||
|
|
|
@ -27,12 +27,14 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "table_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NONE,LINEAR,SPLINE};
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define BIGNUM 1.0e300
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -307,38 +309,19 @@ void BondTable::free_table(Table *tb)
|
|||
|
||||
void BondTable::read_table(Table *tb, char *file, char *keyword)
|
||||
{
|
||||
char line[MAXLINE];
|
||||
TableFileReader reader(lmp, file, "bond");
|
||||
double emin = BIGNUM;
|
||||
|
||||
// open file
|
||||
char * line = reader.find_section_start(keyword);
|
||||
|
||||
FILE *fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open file %s",file);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
|
||||
// loop until section found with matching keyword
|
||||
|
||||
while (1) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL)
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line
|
||||
if (line[0] == '#') continue; // comment
|
||||
char *word = strtok(line," \t\n\r");
|
||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||
param_extract(tb,line);
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
for (int i = 0; i < tb->ninput; i++)
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
if (!line) {
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
}
|
||||
|
||||
// read args on 2nd line of section
|
||||
// allocate table arrays for file values
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
line = reader.next_line();
|
||||
param_extract(tb,line);
|
||||
memory->create(tb->rfile,tb->ninput,"bond:rfile");
|
||||
memory->create(tb->efile,tb->ninput,"bond:efile");
|
||||
|
@ -349,18 +332,24 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
|||
int cerror = 0;
|
||||
int r0idx = -1;
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
if (NULL == fgets(line,MAXLINE,fp))
|
||||
error->one(FLERR,"Premature end of file in bond table");
|
||||
if (3 != sscanf(line,"%*d %lg %lg %lg",
|
||||
&tb->rfile[i],&tb->efile[i],&tb->ffile[i])) ++cerror;
|
||||
line = reader.next_line(4);
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
tb->rfile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException & e) {
|
||||
++cerror;
|
||||
}
|
||||
|
||||
if (tb->efile[i] < emin) {
|
||||
emin = tb->efile[i];
|
||||
r0idx = i;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
// infer r0 from minimum of potential, if not given explicitly
|
||||
|
||||
|
@ -389,19 +378,15 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
|
|||
}
|
||||
|
||||
if (ferror) {
|
||||
char str[128];
|
||||
sprintf(str,"%d of %d force values in table are inconsistent with -dE/dr.\n"
|
||||
" Should only be flagged at inflection points",ferror,tb->ninput);
|
||||
error->warning(FLERR,str);
|
||||
error->warning(FLERR, fmt::format("{} of {} force values in table are inconsistent with -dE/dr.\n"
|
||||
" Should only be flagged at inflection points",ferror,tb->ninput));
|
||||
}
|
||||
|
||||
// warn if data was read incompletely, e.g. columns were missing
|
||||
|
||||
if (cerror) {
|
||||
char str[128];
|
||||
sprintf(str,"%d of %d lines in table were incomplete or could not be"
|
||||
" parsed completely",cerror,tb->ninput);
|
||||
error->warning(FLERR,str);
|
||||
error->warning(FLERR, fmt::format("{} of {} lines in table were incomplete or could not be"
|
||||
" parsed completely",cerror,tb->ninput));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,24 +473,26 @@ void BondTable::param_extract(Table *tb, char *line)
|
|||
tb->fpflag = 0;
|
||||
tb->r0 = 0.0;
|
||||
|
||||
char *word = strtok(line," \t\n\r\f");
|
||||
while (word) {
|
||||
if (strcmp(word,"N") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->ninput = atoi(word);
|
||||
} else if (strcmp(word,"FP") == 0) {
|
||||
tb->fpflag = 1;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fplo = atof(word);
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fphi = atof(word);
|
||||
} else if (strcmp(word,"EQ") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->r0 = atof(word);
|
||||
} else {
|
||||
error->one(FLERR,"Invalid keyword in bond table parameters");
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
|
||||
while (values.has_next()) {
|
||||
std::string word = values.next_string();
|
||||
|
||||
if (word == "N") {
|
||||
tb->ninput = values.next_int();
|
||||
} else if (word == "FP") {
|
||||
tb->fpflag = 1;
|
||||
tb->fplo = values.next_double();
|
||||
tb->fphi = values.next_double();
|
||||
} else if (word == "EQ") {
|
||||
tb->r0 = values.next_double();
|
||||
} else {
|
||||
error->one(FLERR,"Invalid keyword in bond table parameters");
|
||||
}
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
} catch(TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
if (tb->ninput == 0) error->one(FLERR,"Bond table parameters did not set N");
|
||||
|
|
|
@ -2489,7 +2489,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody)
|
|||
buf = buffer;
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != ATTRIBUTE_PERBODY)
|
||||
|
|
|
@ -568,7 +568,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
|||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
nwords = utils::trim_and_count_words(line);
|
||||
if (nwords != 3)
|
||||
error->all(FLERR,"Incorrect format in SNAP coefficient file");
|
||||
|
||||
|
@ -610,7 +610,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
|
|||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
nwords = utils::trim_and_count_words(line);
|
||||
if (nwords != 1)
|
||||
error->all(FLERR,"Incorrect format in SNAP coefficient file");
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ void NEBSpin::readfile(char *file, int flag)
|
|||
buf = buffer;
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != ATTRIBUTE_PERLINE)
|
||||
|
|
|
@ -122,15 +122,12 @@ void PairEAMAlloyIntel::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +143,7 @@ void PairEAMAlloyIntel::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,18 +159,17 @@ void PairEAMAlloyIntel::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -122,15 +122,12 @@ void PairEAMFSIntel::read_file(char *filename)
|
|||
PotentialFileReader reader(lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +143,7 @@ void PairEAMFSIntel::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,21 +159,20 @@ void PairEAMFSIntel::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
|
||||
for (int j = 0; j < file->nelements; j++) {
|
||||
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
|
||||
reader.next_dvector(&file->rhor[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
#include "utils.h"
|
||||
#include "dihedral_table.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "table_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include "math_const.h"
|
||||
#include "math_extra.h"
|
||||
|
@ -458,8 +461,7 @@ static double Phi(double const *x1, //array holding x,y,z coords atom 1
|
|||
DihedralTable::DihedralTable(LAMMPS *lmp) : Dihedral(lmp)
|
||||
{
|
||||
ntables = 0;
|
||||
tables = NULL;
|
||||
checkU_fname = checkF_fname = NULL;
|
||||
tables = nullptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -468,8 +470,6 @@ DihedralTable::~DihedralTable()
|
|||
{
|
||||
for (int m = 0; m < ntables; m++) free_table(&tables[m]);
|
||||
memory->sfree(tables);
|
||||
memory->sfree(checkU_fname);
|
||||
memory->sfree(checkF_fname);
|
||||
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
|
@ -832,13 +832,13 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Invalid dihedral table length (")
|
||||
+ string(arg[2]) + string(").");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
else if ((tb->ninput == 2) && (tabstyle == SPLINE)) {
|
||||
string err_msg;
|
||||
err_msg = string("Invalid dihedral spline table length. (Try linear)\n (")
|
||||
+ string(arg[2]) + string(").");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
|
||||
// check for monotonicity
|
||||
|
@ -851,7 +851,7 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
string(arg[2]) + string(", ")+i_str.str()+string("th entry)");
|
||||
if (i==0)
|
||||
err_msg += string("\n(This is probably a mistake with your table format.)\n");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Dihedral table angle range must be < 360 degrees (")
|
||||
+string(arg[2]) + string(").");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -871,7 +871,7 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Dihedral table angle range must be < 2*PI radians (")
|
||||
+ string(arg[2]) + string(").");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
// Optional: allow the user to print out the interpolated spline tables
|
||||
|
||||
if (me == 0) {
|
||||
if (checkU_fname && (strlen(checkU_fname) != 0))
|
||||
if (!checkU_fname.empty())
|
||||
{
|
||||
ofstream checkU_file;
|
||||
checkU_file.open(checkU_fname, ios::out);
|
||||
|
@ -953,7 +953,7 @@ void DihedralTable::coeff(int narg, char **arg)
|
|||
}
|
||||
checkU_file.close();
|
||||
}
|
||||
if (checkF_fname && (strlen(checkF_fname) != 0))
|
||||
if (!checkF_fname.empty())
|
||||
{
|
||||
ofstream checkF_file;
|
||||
checkF_file.open(checkF_fname, ios::out);
|
||||
|
@ -1084,42 +1084,21 @@ void DihedralTable::free_table(Table *tb)
|
|||
/* ----------------------------------------------------------------------
|
||||
read table file, only called by proc 0
|
||||
------------------------------------------------------------------------- */
|
||||
static const int MAXLINE=2048;
|
||||
void DihedralTable::read_table(Table *tb, char *file, char *keyword)
|
||||
{
|
||||
char line[MAXLINE];
|
||||
TableFileReader reader(lmp, file, "dihedral");
|
||||
|
||||
// open file
|
||||
char * line = reader.find_section_start(keyword);
|
||||
|
||||
FILE *fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
string err_msg = string("Cannot open file ") + string(file);
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
if (!line) {
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
}
|
||||
|
||||
// loop until section found with matching keyword
|
||||
|
||||
while (1) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL) {
|
||||
string err_msg=string("Did not find keyword \"")
|
||||
+string(keyword)+string("\" in dihedral table file.");
|
||||
error->one(FLERR, err_msg.c_str());
|
||||
}
|
||||
if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line
|
||||
if (line[0] == '#') continue; // comment
|
||||
char *word = strtok(line," \t\n\r");
|
||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||
param_extract(tb,line);
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
for (int i = 0; i < tb->ninput; i++)
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
}
|
||||
|
||||
// read args on 2nd line of section
|
||||
// allocate table arrays for file values
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
line = reader.next_line();
|
||||
param_extract(tb,line);
|
||||
memory->create(tb->phifile,tb->ninput,"dihedral:phifile");
|
||||
memory->create(tb->efile,tb->ninput,"dihedral:efile");
|
||||
|
@ -1127,41 +1106,24 @@ void DihedralTable::read_table(Table *tb, char *file, char *keyword)
|
|||
|
||||
// read a,e,f table values from file
|
||||
|
||||
int itmp;
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
|
||||
// Skip blank lines and delete text following a '#' character
|
||||
char *pe = strchr(line, '#');
|
||||
if (pe != NULL) *pe = '\0'; //terminate string at '#' character
|
||||
char *pc = line;
|
||||
while ((*pc != '\0') && isspace(*pc))
|
||||
pc++;
|
||||
if (*pc != '\0') { //If line is not a blank line
|
||||
stringstream line_ss(line);
|
||||
try {
|
||||
if (tb->f_unspecified) {
|
||||
line_ss >> itmp;
|
||||
line_ss >> tb->phifile[i];
|
||||
line_ss >> tb->efile[i];
|
||||
ValueTokenizer values = reader.next_values(3);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
} else {
|
||||
line_ss >> itmp;
|
||||
line_ss >> tb->phifile[i];
|
||||
line_ss >> tb->efile[i];
|
||||
line_ss >> tb->ffile[i];
|
||||
ValueTokenizer values = reader.next_values(4);
|
||||
values.next_int();
|
||||
tb->phifile[i] = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
}
|
||||
if (! line_ss) {
|
||||
stringstream err_msg;
|
||||
err_msg << "Read error in table "<< keyword<<", near line "<<i+1<<"\n"
|
||||
<< " (Check to make sure the number of columns is correct.)";
|
||||
if ((! tb->f_unspecified) && (i==0))
|
||||
err_msg << "\n (This sometimes occurs if users forget to specify the \"NOF\" option.)\n";
|
||||
error->one(FLERR, err_msg.str().c_str());
|
||||
}
|
||||
} else //if it is a blank line, then skip it.
|
||||
i--;
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
} //for (int i = 0; (i < tb->ninput) && fp; i++) {
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -1252,7 +1214,7 @@ void DihedralTable::spline_table(Table *tb)
|
|||
|
||||
if ((num_disagreements > tb->ninput/2) && (num_disagreements > 2)) {
|
||||
string msg("Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n");
|
||||
error->all(FLERR,msg.c_str());
|
||||
error->all(FLERR, msg);
|
||||
}
|
||||
|
||||
} // check for consistency if (! tb->f_unspecified)
|
||||
|
@ -1353,44 +1315,40 @@ void DihedralTable::param_extract(Table *tb, char *line)
|
|||
tb->f_unspecified = false; //default
|
||||
tb->use_degrees = true; //default
|
||||
|
||||
char *word = strtok(line," \t\n\r\f");
|
||||
while (word) {
|
||||
if (strcmp(word,"N") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->ninput = atoi(word);
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
|
||||
while (values.has_next()) {
|
||||
std::string word = values.next_string();
|
||||
if (word == "N") {
|
||||
tb->ninput = values.next_int();
|
||||
}
|
||||
else if (word == "NOF") {
|
||||
tb->f_unspecified = true;
|
||||
}
|
||||
else if ((word == "DEGREES") || (word == "degrees")) {
|
||||
tb->use_degrees = true;
|
||||
}
|
||||
else if ((word == "RADIANS") || (word == "radians")) {
|
||||
tb->use_degrees = false;
|
||||
}
|
||||
else if (word == "CHECKU") {
|
||||
checkU_fname = values.next_string();
|
||||
}
|
||||
else if (word == "CHECKF") {
|
||||
checkF_fname = values.next_string();
|
||||
}
|
||||
// COMMENTING OUT: equilibrium angles are not supported
|
||||
//else if (word == "EQ") {
|
||||
// tb->theta0 = values.next_double();
|
||||
//}
|
||||
else {
|
||||
string err_msg = fmt::format("Invalid keyword in dihedral angle table parameters ({})", word);
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
else if (strcmp(word,"NOF") == 0) {
|
||||
tb->f_unspecified = true;
|
||||
}
|
||||
else if ((strcmp(word,"DEGREES") == 0) || (strcmp(word,"degrees") == 0)) {
|
||||
tb->use_degrees = true;
|
||||
}
|
||||
else if ((strcmp(word,"RADIANS") == 0) || (strcmp(word,"radians") == 0)) {
|
||||
tb->use_degrees = false;
|
||||
}
|
||||
else if (strcmp(word,"CHECKU") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
memory->sfree(checkU_fname);
|
||||
memory->create(checkU_fname,strlen(word)+1,"dihedral_table:checkU");
|
||||
strcpy(checkU_fname, word);
|
||||
}
|
||||
else if (strcmp(word,"CHECKF") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
memory->sfree(checkF_fname);
|
||||
memory->create(checkF_fname,strlen(word)+1,"dihedral_table:checkF");
|
||||
strcpy(checkF_fname, word);
|
||||
}
|
||||
// COMMENTING OUT: equilibrium angles are not supported
|
||||
//else if (strcmp(word,"EQ") == 0) {
|
||||
// word = strtok(NULL," \t\n\r\f");
|
||||
// tb->theta0 = atof(word);
|
||||
//}
|
||||
else {
|
||||
string err_msg("Invalid keyword in dihedral angle table parameters");
|
||||
err_msg += string(" (") + string(word) + string(")");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
if (tb->ninput == 0)
|
||||
|
|
|
@ -24,6 +24,7 @@ DihedralStyle(table,DihedralTable)
|
|||
#ifndef LMP_DIHEDRAL_TABLE_H
|
||||
#define LMP_DIHEDRAL_TABLE_H
|
||||
#include "dihedral.h"
|
||||
#include <string>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
|
@ -43,8 +44,8 @@ class DihedralTable : public Dihedral {
|
|||
protected:
|
||||
int tabstyle,tablength;
|
||||
// double *phi0; <- equilibrium angles not supported
|
||||
char *checkU_fname;
|
||||
char *checkF_fname;
|
||||
std::string checkU_fname;
|
||||
std::string checkF_fname;
|
||||
|
||||
struct Table {
|
||||
int ninput;
|
||||
|
|
|
@ -824,13 +824,13 @@ void DihedralTableCut::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Invalid dihedral table length (")
|
||||
+ string(arg[5]) + string(").");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
else if ((tb->ninput == 2) && (tabstyle == SPLINE)) {
|
||||
string err_msg;
|
||||
err_msg = string("Invalid dihedral spline table length. (Try linear)\n (")
|
||||
+ string(arg[5]) + string(").");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
|
||||
// check for monotonicity
|
||||
|
@ -843,7 +843,7 @@ void DihedralTableCut::coeff(int narg, char **arg)
|
|||
string(arg[5]) + string(", ")+i_str.str()+string("th entry)");
|
||||
if (i==0)
|
||||
err_msg += string("\n(This is probably a mistake with your table format.)\n");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -855,7 +855,7 @@ void DihedralTableCut::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Dihedral table angle range must be < 360 degrees (")
|
||||
+string(arg[5]) + string(").");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -863,7 +863,7 @@ void DihedralTableCut::coeff(int narg, char **arg)
|
|||
string err_msg;
|
||||
err_msg = string("Dihedral table angle range must be < 2*PI radians (")
|
||||
+ string(arg[5]) + string(").");
|
||||
error->all(FLERR,err_msg.c_str());
|
||||
error->all(FLERR,err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword)
|
|||
FILE *fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
string err_msg = string("Cannot open file ") + string(file);
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR,err_msg);
|
||||
}
|
||||
|
||||
// loop until section found with matching keyword
|
||||
|
@ -1090,7 +1090,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword)
|
|||
if (fgets(line,MAXLINE,fp) == NULL) {
|
||||
string err_msg=string("Did not find keyword \"")
|
||||
+string(keyword)+string("\" in dihedral table file.");
|
||||
error->one(FLERR, err_msg.c_str());
|
||||
error->one(FLERR, err_msg);
|
||||
}
|
||||
if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line
|
||||
if (line[0] == '#') continue; // comment
|
||||
|
@ -1376,7 +1376,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line)
|
|||
else {
|
||||
string err_msg("Invalid keyword in dihedral angle table parameters");
|
||||
err_msg += string(" (") + string(word) + string(")");
|
||||
error->one(FLERR,err_msg.c_str());
|
||||
error->one(FLERR, err_msg);
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
}
|
||||
|
|
|
@ -122,15 +122,12 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||
PotentialFileReader reader(PairEAM::lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +143,7 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,18 +159,17 @@ void PairEAMAlloyOMP::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(file->nr, &file->rhor[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
reader.next_dvector(&file->rhor[i][1], file->nr);
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -122,15 +122,12 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||
PotentialFileReader reader(PairEAM::lmp, filename, "EAM");
|
||||
|
||||
try {
|
||||
char * line = nullptr;
|
||||
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
reader.skip_line();
|
||||
|
||||
// extract element names from nelements line
|
||||
line = reader.next_line(1);
|
||||
ValueTokenizer values(line);
|
||||
ValueTokenizer values = reader.next_values(1);
|
||||
file->nelements = values.next_int();
|
||||
|
||||
if (values.count() != file->nelements + 1)
|
||||
|
@ -146,8 +143,7 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||
|
||||
//
|
||||
|
||||
line = reader.next_line(5);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(5);
|
||||
file->nrho = values.next_int();
|
||||
file->drho = values.next_double();
|
||||
file->nr = values.next_int();
|
||||
|
@ -163,21 +159,20 @@ void PairEAMFSOMP::read_file(char *filename)
|
|||
memory->create(file->z2r, file->nelements, file->nelements, file->nr + 1, "pair:z2r");
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
line = reader.next_line(2);
|
||||
values = ValueTokenizer(line);
|
||||
values = reader.next_values(2);
|
||||
values.next_int(); // ignore
|
||||
file->mass[i] = values.next_double();
|
||||
|
||||
reader.next_dvector(file->nrho, &file->frho[i][1]);
|
||||
reader.next_dvector(&file->frho[i][1], file->nrho);
|
||||
|
||||
for (int j = 0; j < file->nelements; j++) {
|
||||
reader.next_dvector(file->nr, &file->rhor[i][j][1]);
|
||||
reader.next_dvector(&file->rhor[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < file->nelements; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
reader.next_dvector(file->nr, &file->z2r[i][j][1]);
|
||||
reader.next_dvector(&file->z2r[i][j][1], file->nr);
|
||||
}
|
||||
}
|
||||
} catch (TokenizerException & e) {
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "potential_file_reader.h"
|
||||
|
||||
#include "math_const.h"
|
||||
#include "math_special.h"
|
||||
|
@ -38,7 +40,6 @@ using namespace LAMMPS_NS;
|
|||
using namespace MathConst;
|
||||
using namespace MathSpecial;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define DELTA 4
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -84,152 +85,108 @@ PairTersoffZBLOMP::PairTersoffZBLOMP(LAMMPS *lmp) : PairTersoffOMP(lmp)
|
|||
|
||||
void PairTersoffZBLOMP::read_file(char *file)
|
||||
{
|
||||
int params_per_line = 21;
|
||||
char **words = new char*[params_per_line+1];
|
||||
|
||||
memory->sfree(params);
|
||||
params = NULL;
|
||||
params = nullptr;
|
||||
nparams = maxparam = 0;
|
||||
|
||||
// open file on proc 0
|
||||
|
||||
FILE *fp;
|
||||
if (comm->me == 0) {
|
||||
fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open Tersoff potential file %s",file);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
}
|
||||
PotentialFileReader reader(PairTersoff::lmp, file, "Tersoff");
|
||||
char * line;
|
||||
|
||||
// read each line out of file, skipping blank lines or leading '#'
|
||||
// store line of params if all 3 element tags are in element list
|
||||
while((line = reader.next_line(NPARAMS_PER_LINE))) {
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
|
||||
int n,nwords,ielement,jelement,kelement;
|
||||
char line[MAXLINE],*ptr;
|
||||
int eof = 0;
|
||||
std::string iname = values.next_string();
|
||||
std::string jname = values.next_string();
|
||||
std::string kname = values.next_string();
|
||||
|
||||
while (1) {
|
||||
if (comm->me == 0) {
|
||||
ptr = fgets(line,MAXLINE,fp);
|
||||
if (ptr == NULL) {
|
||||
eof = 1;
|
||||
fclose(fp);
|
||||
} else n = strlen(line) + 1;
|
||||
}
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof) break;
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
// ielement,jelement,kelement = 1st args
|
||||
// if all 3 args are in element list, then parse this line
|
||||
// else skip to next entry in file
|
||||
int ielement, jelement, kelement;
|
||||
|
||||
// strip comment, skip line if blank
|
||||
for (ielement = 0; ielement < nelements; ielement++)
|
||||
if (iname == elements[ielement]) break;
|
||||
if (ielement == nelements) continue;
|
||||
for (jelement = 0; jelement < nelements; jelement++)
|
||||
if (jname == elements[jelement]) break;
|
||||
if (jelement == nelements) continue;
|
||||
for (kelement = 0; kelement < nelements; kelement++)
|
||||
if (kname == elements[kelement]) break;
|
||||
if (kelement == nelements) continue;
|
||||
|
||||
if ((ptr = strchr(line,'#'))) *ptr = '\0';
|
||||
nwords = utils::count_words(line);
|
||||
if (nwords == 0) continue;
|
||||
|
||||
// concatenate additional lines until have params_per_line words
|
||||
// load up parameter settings and error check their values
|
||||
|
||||
while (nwords < params_per_line) {
|
||||
n = strlen(line);
|
||||
if (comm->me == 0) {
|
||||
ptr = fgets(&line[n],MAXLINE-n,fp);
|
||||
if (ptr == NULL) {
|
||||
eof = 1;
|
||||
fclose(fp);
|
||||
} else n = strlen(line) + 1;
|
||||
if (nparams == maxparam) {
|
||||
maxparam += DELTA;
|
||||
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
|
||||
"pair:params");
|
||||
}
|
||||
|
||||
params[nparams].ielement = ielement;
|
||||
params[nparams].jelement = jelement;
|
||||
params[nparams].kelement = kelement;
|
||||
params[nparams].powerm = values.next_double();
|
||||
params[nparams].gamma = values.next_double();
|
||||
params[nparams].lam3 = values.next_double();
|
||||
params[nparams].c = values.next_double();
|
||||
params[nparams].d = values.next_double();
|
||||
params[nparams].h = values.next_double();
|
||||
params[nparams].powern = values.next_double();
|
||||
params[nparams].beta = values.next_double();
|
||||
params[nparams].lam2 = values.next_double();
|
||||
params[nparams].bigb = values.next_double();
|
||||
params[nparams].bigr = values.next_double();
|
||||
params[nparams].bigd = values.next_double();
|
||||
params[nparams].lam1 = values.next_double();
|
||||
params[nparams].biga = values.next_double();
|
||||
params[nparams].Z_i = values.next_double();
|
||||
params[nparams].Z_j = values.next_double();
|
||||
params[nparams].ZBLcut = values.next_double();
|
||||
params[nparams].ZBLexpscale = values.next_double();
|
||||
params[nparams].powermint = int(params[nparams].powerm);
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof) break;
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
if ((ptr = strchr(line,'#'))) *ptr = '\0';
|
||||
nwords = utils::count_words(line);
|
||||
|
||||
// currently only allow m exponent of 1 or 3
|
||||
if (params[nparams].c < 0.0 ||
|
||||
params[nparams].d < 0.0 ||
|
||||
params[nparams].powern < 0.0 ||
|
||||
params[nparams].beta < 0.0 ||
|
||||
params[nparams].lam2 < 0.0 ||
|
||||
params[nparams].bigb < 0.0 ||
|
||||
params[nparams].bigr < 0.0 ||
|
||||
params[nparams].bigd < 0.0 ||
|
||||
params[nparams].bigd > params[nparams].bigr ||
|
||||
params[nparams].lam1 < 0.0 ||
|
||||
params[nparams].biga < 0.0 ||
|
||||
params[nparams].powerm - params[nparams].powermint != 0.0 ||
|
||||
(params[nparams].powermint != 3 &&
|
||||
params[nparams].powermint != 1) ||
|
||||
params[nparams].gamma < 0.0 ||
|
||||
params[nparams].Z_i < 1.0 ||
|
||||
params[nparams].Z_j < 1.0 ||
|
||||
params[nparams].ZBLcut < 0.0 ||
|
||||
params[nparams].ZBLexpscale < 0.0)
|
||||
error->one(FLERR,"Illegal Tersoff parameter");
|
||||
|
||||
nparams++;
|
||||
}
|
||||
|
||||
if (nwords != params_per_line)
|
||||
error->all(FLERR,"Incorrect format in Tersoff potential file");
|
||||
|
||||
// words = ptrs to all words in line
|
||||
|
||||
nwords = 0;
|
||||
words[nwords++] = strtok(line," \t\n\r\f");
|
||||
while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue;
|
||||
|
||||
// ielement,jelement,kelement = 1st args
|
||||
// if all 3 args are in element list, then parse this line
|
||||
// else skip to next line
|
||||
|
||||
for (ielement = 0; ielement < nelements; ielement++)
|
||||
if (strcmp(words[0],elements[ielement]) == 0) break;
|
||||
if (ielement == nelements) continue;
|
||||
for (jelement = 0; jelement < nelements; jelement++)
|
||||
if (strcmp(words[1],elements[jelement]) == 0) break;
|
||||
if (jelement == nelements) continue;
|
||||
for (kelement = 0; kelement < nelements; kelement++)
|
||||
if (strcmp(words[2],elements[kelement]) == 0) break;
|
||||
if (kelement == nelements) continue;
|
||||
|
||||
// load up parameter settings and error check their values
|
||||
|
||||
if (nparams == maxparam) {
|
||||
maxparam += DELTA;
|
||||
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
|
||||
"pair:params");
|
||||
}
|
||||
|
||||
params[nparams].ielement = ielement;
|
||||
params[nparams].jelement = jelement;
|
||||
params[nparams].kelement = kelement;
|
||||
params[nparams].powerm = atof(words[3]);
|
||||
params[nparams].gamma = atof(words[4]);
|
||||
params[nparams].lam3 = atof(words[5]);
|
||||
params[nparams].c = atof(words[6]);
|
||||
params[nparams].d = atof(words[7]);
|
||||
params[nparams].h = atof(words[8]);
|
||||
params[nparams].powern = atof(words[9]);
|
||||
params[nparams].beta = atof(words[10]);
|
||||
params[nparams].lam2 = atof(words[11]);
|
||||
params[nparams].bigb = atof(words[12]);
|
||||
params[nparams].bigr = atof(words[13]);
|
||||
params[nparams].bigd = atof(words[14]);
|
||||
params[nparams].lam1 = atof(words[15]);
|
||||
params[nparams].biga = atof(words[16]);
|
||||
params[nparams].Z_i = atof(words[17]);
|
||||
params[nparams].Z_j = atof(words[18]);
|
||||
params[nparams].ZBLcut = atof(words[19]);
|
||||
params[nparams].ZBLexpscale = atof(words[20]);
|
||||
|
||||
// currently only allow m exponent of 1 or 3
|
||||
|
||||
params[nparams].powermint = int(params[nparams].powerm);
|
||||
|
||||
if (params[nparams].c < 0.0 ||
|
||||
params[nparams].d < 0.0 ||
|
||||
params[nparams].powern < 0.0 ||
|
||||
params[nparams].beta < 0.0 ||
|
||||
params[nparams].lam2 < 0.0 ||
|
||||
params[nparams].bigb < 0.0 ||
|
||||
params[nparams].bigr < 0.0 ||
|
||||
params[nparams].bigd < 0.0 ||
|
||||
params[nparams].bigd > params[nparams].bigr ||
|
||||
params[nparams].lam1 < 0.0 ||
|
||||
params[nparams].biga < 0.0 ||
|
||||
params[nparams].powerm - params[nparams].powermint != 0.0 ||
|
||||
(params[nparams].powermint != 3 &&
|
||||
params[nparams].powermint != 1) ||
|
||||
params[nparams].gamma < 0.0 ||
|
||||
params[nparams].Z_i < 1.0 ||
|
||||
params[nparams].Z_j < 1.0 ||
|
||||
params[nparams].ZBLcut < 0.0 ||
|
||||
params[nparams].ZBLexpscale < 0.0)
|
||||
error->all(FLERR,"Illegal Tersoff parameter");
|
||||
|
||||
nparams++;
|
||||
}
|
||||
|
||||
delete [] words;
|
||||
MPI_Bcast(&nparams, 1, MPI_INT, 0, world);
|
||||
MPI_Bcast(&maxparam, 1, MPI_INT, 0, world);
|
||||
|
||||
if(comm->me != 0) {
|
||||
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params");
|
||||
}
|
||||
|
||||
MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -82,6 +82,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
|
|||
error->all(FLERR,"Incompatible API version for PLUMED in fix plumed. "
|
||||
"Only Plumed 2.4.x, 2.5.x, and 2.6.x are tested and supported.");
|
||||
|
||||
#if !defined(MPI_STUBS)
|
||||
// If the -partition option is activated then enable
|
||||
// inter-partition communication
|
||||
|
||||
|
@ -108,7 +109,6 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
|
|||
// whereas if partitions are not defined then world is equal to
|
||||
// MPI_COMM_WORLD.
|
||||
|
||||
#if !defined(MPI_STUBS)
|
||||
// plumed does not know about LAMMPS using the MPI STUBS library and will
|
||||
// fail if this is called under these circumstances
|
||||
p->cmd("setMPIComm",&world);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "update.h"
|
||||
|
@ -34,6 +35,7 @@
|
|||
#include "kspace.h"
|
||||
#include "math_const.h"
|
||||
#include "utils.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
@ -98,58 +100,71 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) :
|
|||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"q") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
qmass = atof(arg[iarg+1]); if (qmass < 0.0) error->all(FLERR,"Fix qbmsst qmass must be >= 0.0");
|
||||
qmass = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (qmass < 0.0) error->all(FLERR,"Fix qbmsst qmass must be >= 0.0");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mu") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
mu = atof(arg[iarg+1]); if (mu < 0.0) error->all(FLERR,"Fix qbmsst mu must be >= 0.0");
|
||||
mu = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (mu < 0.0) error->all(FLERR,"Fix qbmsst mu must be >= 0.0");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"p0") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
p0 = atof(arg[iarg+1]); if (p0 < 0.0) error->all(FLERR,"Fix qbmsst p0 must be >= 0.0");
|
||||
p0 = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (p0 < 0.0) error->all(FLERR,"Fix qbmsst p0 must be >= 0.0");
|
||||
p0_set = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"v0") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
v0 = atof(arg[iarg+1]); if (v0 < 0.0) error->all(FLERR,"Fix qbmsst v0 must be >= 0.0");
|
||||
v0 = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (v0 < 0.0) error->all(FLERR,"Fix qbmsst v0 must be >= 0.0");
|
||||
v0_set = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"e0") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
e0 = atof(arg[iarg+1]);
|
||||
e0 = force->numeric(FLERR,arg[iarg+1]);
|
||||
e0_set = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"tscale") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
tscale = atof(arg[iarg+1]); if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix qbmsst tscale must satisfy 0 <= tscale < 1");
|
||||
tscale = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix qbmsst tscale must satisfy 0 <= tscale < 1");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"damp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
t_period = atof(arg[iarg+1]); if (t_period <= 0.0) error->all(FLERR,"Fix qbmsst damp must be > 0.0"); fric_coef = 1/t_period;
|
||||
t_period = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (t_period <= 0.0) error->all(FLERR,"Fix qbmsst damp must be > 0.0");
|
||||
fric_coef = 1/t_period;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"seed") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
seed = atof(arg[iarg+1]); if (seed <= 0) error->all(FLERR,"Fix qbmsst seed must be a positive integer");
|
||||
seed = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (seed <= 0) error->all(FLERR,"Fix qbmsst seed must be a positive integer");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"f_max") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
f_max = atof(arg[iarg+1]); if (f_max <= 0) error->all(FLERR,"Fix qbmsst f_max must be > 0.0");
|
||||
f_max = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (f_max <= 0) error->all(FLERR,"Fix qbmsst f_max must be > 0.0");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"N_f") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
N_f = atof(arg[iarg+1]); if (N_f <= 0) error->all(FLERR,"Fix qbmsst N_f must be a positive integer");
|
||||
N_f = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (N_f <= 0) error->all(FLERR,"Fix qbmsst N_f must be a positive integer");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"eta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
eta = atof(arg[iarg+1]); if (eta <= 0) error->all(FLERR,"Fix qbmsst eta must be >= 0.0");
|
||||
eta = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (eta <= 0) error->all(FLERR,"Fix qbmsst eta must be >= 0.0");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"beta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
beta = atof(arg[iarg+1]); if (beta <= 0) error->all(FLERR,"Fix qbmsst beta must be a positive integer");
|
||||
beta = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (beta <= 0) error->all(FLERR,"Fix qbmsst beta must be a positive integer");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"T_init") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
|
||||
t_init = atof(arg[iarg+1]); if (t_init <= 0) error->all(FLERR,"Fix qbmsst T_init must be >= 0.0");
|
||||
t_init = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (t_init <= 0) error->all(FLERR,"Fix qbmsst T_init must be >= 0.0");
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix qbmsst command");
|
||||
}
|
||||
|
@ -157,48 +172,32 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) :
|
|||
// check for periodicity in controlled dimensions
|
||||
if (domain->nonperiodic) error->all(FLERR,"Fix qbmsst requires a periodic box");
|
||||
|
||||
maxexchange = 6*N_f+3;
|
||||
|
||||
// comments
|
||||
if (comm->me == 0) {
|
||||
if (screen) {
|
||||
fprintf(screen,"QBMSST parameters:\n");
|
||||
if (direction == 0) fprintf(screen," Shock in x direction\n");
|
||||
else if (direction == 1) fprintf(screen," Shock in y direction\n");
|
||||
else if (direction == 2) fprintf(screen," Shock in z direction\n");
|
||||
std::string msg = "QBMSST parameters:\n";
|
||||
|
||||
fprintf(screen," Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass);
|
||||
fprintf(screen," Shock velocity = %12.5e\n", velocity);
|
||||
fprintf(screen," Artificial viscosity (units of mass/length/time) = %12.5e\n", mu);
|
||||
if (direction == 0) msg += " Shock in x direction\n";
|
||||
else if (direction == 1) msg += " Shock in y direction\n";
|
||||
else if (direction == 2) msg += " Shock in z direction\n";
|
||||
|
||||
if (p0_set)
|
||||
fprintf(screen," Initial pressure specified to be %12.5e\n", p0);
|
||||
else fprintf(screen," Initial pressure calculated on first step\n");
|
||||
if (v0_set)
|
||||
fprintf(screen," Initial volume specified to be %12.5e\n", v0);
|
||||
else fprintf(screen," Initial volume calculated on first step\n");
|
||||
if (e0_set)
|
||||
fprintf(screen," Initial energy specified to be %12.5e\n", e0);
|
||||
else fprintf(screen," Initial energy calculated on first step\n");
|
||||
}
|
||||
if (logfile) {
|
||||
fprintf(logfile,"QBMSST parameters:\n");
|
||||
if (direction == 0) fprintf(logfile," Shock in x direction\n");
|
||||
else if (direction == 1) fprintf(logfile," Shock in y direction\n");
|
||||
else if (direction == 2) fprintf(logfile," Shock in z direction\n");
|
||||
msg += fmt::format(" Cell mass-like parameter qmass "
|
||||
"(units of mass^2/length^4) = {:12.5e}\n", qmass);
|
||||
msg += fmt::format(" Shock velocity = {:12.5e}\n", velocity);
|
||||
msg += fmt::format(" Artificial viscosity (units of "
|
||||
"mass/length/time) = {:12.5e}\n", mu);
|
||||
|
||||
fprintf(logfile," Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass);
|
||||
fprintf(logfile," Shock velocity = %12.5e\n", velocity);
|
||||
fprintf(logfile," Artificial viscosity (units of mass/length/time) = %12.5e\n", mu);
|
||||
|
||||
if (p0_set)
|
||||
fprintf(logfile," Initial pressure specified to be %12.5e\n", p0);
|
||||
else fprintf(logfile," Initial pressure calculated on first step\n");
|
||||
if (v0_set)
|
||||
fprintf(logfile," Initial volume specified to be %12.5e\n", v0);
|
||||
else fprintf(logfile," Initial volume calculated on first step\n");
|
||||
if (e0_set)
|
||||
fprintf(logfile," Initial energy specified to be %12.5e\n", e0);
|
||||
else fprintf(logfile," Initial energy calculated on first step\n");
|
||||
}
|
||||
if (p0_set)
|
||||
msg += fmt::format(" Initial pressure specified to be {:12.5e}\n", p0);
|
||||
else msg += " Initial pressure calculated on first step\n";
|
||||
if (v0_set)
|
||||
msg += fmt::format(" Initial volume specified to be {:12.5e}\n", v0);
|
||||
else msg += " Initial volume calculated on first step\n";
|
||||
if (e0_set)
|
||||
msg += fmt::format(" Initial energy specified to be {:12.5e}\n", e0);
|
||||
else msg += " Initial energy calculated on first step\n";
|
||||
utils::logmesg(lmp,msg);
|
||||
}
|
||||
|
||||
// create a new compute temp style
|
||||
|
@ -363,14 +362,17 @@ void FixQBMSST::init()
|
|||
|
||||
//set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}}
|
||||
if (int(1.0/(2*f_max*dtv)) == 0) {
|
||||
if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n");
|
||||
if (comm->me == 0) error->warning(FLERR,"Either f_max is too high or the time step "
|
||||
"is too big, setting f_max to be 1/timestep!\n");
|
||||
h_timestep=dtv;
|
||||
alpha=1;
|
||||
} else {
|
||||
alpha=int(1.0/(2*f_max*dtv));
|
||||
h_timestep=alpha*dtv;
|
||||
}
|
||||
if (comm->me == 0) printf ("The effective maximum frequncy is now %f inverse time unit with alpha value as %d!\n", 0.5/h_timestep, alpha);
|
||||
if (comm->me == 0 && screen)
|
||||
fmt::print(screen,"The effective maximum frequency is now {} inverse time unit "
|
||||
"with alpha value as {}!\n", 0.5/h_timestep, alpha);
|
||||
|
||||
//gfactor is the random force \sqrt{\frac{2\gamma{}m_{i}}{\alpha*\delta{}t}}, \sqrt{12} makes the random array variance equal to unit.
|
||||
for (int i = 1; i <= atom->ntypes; i++) {
|
||||
|
@ -432,20 +434,16 @@ void FixQBMSST::setup(int /*vflag*/)
|
|||
if ( v0_set == 0 ) {
|
||||
v0 = compute_vol();
|
||||
v0_set = 1;
|
||||
if (comm->me == 0) {
|
||||
if ( screen ) fprintf(screen,"Fix QBMSST v0 = %12.5e\n", v0);
|
||||
if ( logfile ) fprintf(logfile,"Fix QBMSST v0 = %12.5e\n", v0);
|
||||
}
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,fmt::format("Fix QBMSST v0 = {:12.5e}\n", v0));
|
||||
}
|
||||
|
||||
if ( p0_set == 0 ) {
|
||||
p0 = p_current[direction];
|
||||
p0_set = 1;
|
||||
|
||||
if ( comm->me == 0 ) {
|
||||
if ( screen ) fprintf(screen,"Fix QBMSST p0 = %12.5e\n", p0);
|
||||
if ( logfile ) fprintf(logfile,"Fix QBMSST p0 = %12.5e\n", p0);
|
||||
}
|
||||
if ( comm->me == 0 )
|
||||
utils::logmesg(lmp,fmt::format("Fix QBMSST p0 = {:12.5e}\n", p0));
|
||||
}
|
||||
|
||||
if ( e0_set == 0 ) {
|
||||
|
@ -453,11 +451,8 @@ void FixQBMSST::setup(int /*vflag*/)
|
|||
e0_set = 1;
|
||||
old_eavg = e0;
|
||||
|
||||
if ( comm->me == 0 ) {
|
||||
if ( screen ) fprintf(screen,"Fix QBMSST e0 = to be %12.5e\n",e0);
|
||||
if ( logfile ) fprintf(logfile,"Fix QBMSST e0 = to be %12.5e\n",e0);
|
||||
}
|
||||
|
||||
if ( comm->me == 0 )
|
||||
utils::logmesg(lmp,fmt::format("Fix QBMSST e0 = to be {:12.5e}\n",e0));
|
||||
}
|
||||
|
||||
temperature->compute_vector();
|
||||
|
@ -476,16 +471,10 @@ void FixQBMSST::setup(int /*vflag*/)
|
|||
omega[direction]=-1*sqrt(fac1);
|
||||
double fac2 = omega[direction]/v0;
|
||||
|
||||
if ( comm->me == 0 && tscale != 1.0) {
|
||||
if ( screen )
|
||||
fprintf(screen,"Fix QBMSST initial strain rate of %12.5e established "
|
||||
"by reducing temperature by factor of %12.5e\n",
|
||||
fac2,tscale);
|
||||
if ( logfile )
|
||||
fprintf(logfile,"Fix QBMSST initial strain rate of %12.5e established "
|
||||
"by reducing temperature by factor of %12.5e\n",
|
||||
fac2,tscale);
|
||||
}
|
||||
if ( comm->me == 0 && tscale != 1.0)
|
||||
utils::logmesg(lmp,fmt::format("Fix QBMSST initial strain rate of {:12.5e} "
|
||||
"established by reducing temperature by "
|
||||
"factor of {:12.5e}\n",fac2,tscale));
|
||||
for (int i = 0; i < atom->nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
for (int k = 0; k < 3; k++ ) {
|
||||
|
@ -531,30 +520,31 @@ void FixQBMSST::initial_integrate(int /*vflag*/)
|
|||
// decide if the qtb temperature need to be updated or not
|
||||
if (counter_l == 0) {
|
||||
t_current -= dtv*fric_coef*eta*beta*(old_eavg-e0)/(3*ntotal*boltz);
|
||||
old_eavg = 0;//clear old energy average
|
||||
if (t_current < 0.0) t_current=0;
|
||||
if (t_current > 0.0) {
|
||||
old_eavg = 0;//clear old energy average
|
||||
|
||||
// load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H
|
||||
for (int k = 0; k < 2*N_f; k++) {
|
||||
double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1
|
||||
if(k == N_f) {
|
||||
omega_H[k]=sqrt(force->boltz * t_current);
|
||||
} else {
|
||||
double energy_k= force->hplanck * fabs(f_k);
|
||||
omega_H[k]=sqrt( energy_k * (0.5+1.0/( exp(energy_k/(force->boltz * t_current)) - 1.0 )) );
|
||||
omega_H[k]*=alpha*sin((k-N_f)*MY_PI/(2*alpha*N_f))/sin((k-N_f)*MY_PI/(2*N_f));
|
||||
}
|
||||
}
|
||||
|
||||
// construct the signal filter H, filter has the unit of of sqrt(energy) \sqrt{2N_f}^{-1}H\left(t_n\right)
|
||||
for (int n = 0; n < 2*N_f; n++) {
|
||||
time_H[n] = 0;
|
||||
double t_n=(n-N_f);
|
||||
// load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H
|
||||
for (int k = 0; k < 2*N_f; k++) {
|
||||
double omega_k=(k-N_f)*MY_PI/N_f;
|
||||
time_H[n] += omega_H[k]*(cos(omega_k*t_n));
|
||||
double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1
|
||||
if(k == N_f) {
|
||||
omega_H[k]=sqrt(force->boltz * t_current);
|
||||
} else {
|
||||
double energy_k= force->hplanck * fabs(f_k);
|
||||
omega_H[k]=sqrt( energy_k * (0.5+1.0/( exp(energy_k/(force->boltz * t_current)) - 1.0 )) );
|
||||
omega_H[k]*=alpha*sin((k-N_f)*MY_PI/(2*alpha*N_f))/sin((k-N_f)*MY_PI/(2*N_f));
|
||||
}
|
||||
}
|
||||
|
||||
// construct the signal filter H, filter has the unit of of sqrt(energy) \sqrt{2N_f}^{-1}H\left(t_n\right)
|
||||
for (int n = 0; n < 2*N_f; n++) {
|
||||
time_H[n] = 0;
|
||||
double t_n=(n-N_f);
|
||||
for (int k = 0; k < 2*N_f; k++) {
|
||||
double omega_k=(k-N_f)*MY_PI/N_f;
|
||||
time_H[n] += omega_H[k]*(cos(omega_k*t_n));
|
||||
}
|
||||
time_H[n]/=(2.0*N_f);
|
||||
}
|
||||
time_H[n]/=(2.0*N_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1170,11 +1160,12 @@ void FixQBMSST::copy_arrays(int i, int j, int /*delflag*/)
|
|||
------------------------------------------------------------------------- */
|
||||
int FixQBMSST::pack_exchange(int i, double *buf)
|
||||
{
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m] = random_array_0[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m+2*N_f] = random_array_1[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m+4*N_f] = random_array_2[i][m];
|
||||
for (int m = 0; m < 3; m++) buf[m+6*N_f] = fran[i][m];
|
||||
return 6*N_f+3;
|
||||
int n = 0;
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_0[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_1[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_2[i][m];
|
||||
for (int m = 0; m < 3; m++) buf[n++] = fran[i][m];
|
||||
return n;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -1182,9 +1173,10 @@ int FixQBMSST::pack_exchange(int i, double *buf)
|
|||
------------------------------------------------------------------------- */
|
||||
int FixQBMSST::unpack_exchange(int nlocal, double *buf)
|
||||
{
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[m];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[m+2*N_f];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[m+4*N_f];
|
||||
for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[m+6*N_f];
|
||||
return 6*N_f+3;
|
||||
int n = 0;
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[n++];
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
@ -62,27 +64,34 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) :
|
|||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"temp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
|
||||
t_target = atof(arg[iarg+1]); if (t_target < 0.0) error->all(FLERR,"Fix qtb temp must be >= 0.0");
|
||||
t_target = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (t_target < 0.0) error->all(FLERR,"Fix qtb temp must be >= 0.0");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"damp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
|
||||
t_period = atof(arg[iarg+1]); if (t_period <= 0.0) error->all(FLERR,"Fix qtb damp must be > 0.0"); fric_coef = 1/t_period;
|
||||
t_period = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (t_period <= 0.0) error->all(FLERR,"Fix qtb damp must be > 0.0"); fric_coef = 1/t_period;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"seed") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
|
||||
seed = atof(arg[iarg+1]); if (seed <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
seed = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (seed <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"f_max") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
|
||||
f_max = atof(arg[iarg+1]); if (f_max <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
f_max = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (f_max <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"N_f") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
|
||||
N_f = atof(arg[iarg+1]); if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
N_f = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command");
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix qtb command");
|
||||
}
|
||||
|
||||
maxexchange = 6*N_f+3;
|
||||
|
||||
// allocate qtb
|
||||
gfactor1 = NULL;
|
||||
gfactor3 = NULL;
|
||||
|
@ -105,10 +114,6 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) :
|
|||
// allocate random-arrays and fran
|
||||
grow_arrays(atom->nmax);
|
||||
atom->add_callback(0);
|
||||
// memory->create(random_array_0,atom->nmax+300,2*N_f,"qtb:random_array_0");
|
||||
// memory->create(random_array_1,atom->nmax+300,2*N_f,"qtb:random_array_1");
|
||||
// memory->create(random_array_2,atom->nmax+300,2*N_f,"qtb:random_array_2");
|
||||
// memory->create(fran,atom->nmax+300,3,"qtb:fran");
|
||||
|
||||
// allocate omega_H and time_H
|
||||
memory->create(omega_H,2*N_f,"qtb:omega_H");
|
||||
|
@ -160,14 +165,17 @@ void FixQTB::init()
|
|||
|
||||
//set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}}
|
||||
if (int(1.0/(2*f_max*dtv)) == 0) {
|
||||
if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n");
|
||||
if (comm->me == 0) error->warning(FLERR,"Either f_max is too high or the time step "
|
||||
"is too big, setting f_max to be 1/timestep!\n");
|
||||
h_timestep=dtv;
|
||||
alpha=1;
|
||||
} else {
|
||||
alpha=int(1.0/(2*f_max*dtv));
|
||||
h_timestep=alpha*dtv;
|
||||
}
|
||||
if (comm->me == 0) printf ("The effective maximum frequncy is now %f inverse time unit with alpha value as %d!\n", 0.5/h_timestep, alpha);
|
||||
if (comm->me == 0 && screen)
|
||||
fmt::print(screen,"The effective maximum frequency is now {} inverse time unit "
|
||||
"with alpha value as {}!\n", 0.5/h_timestep, alpha);
|
||||
|
||||
// set force prefactors
|
||||
if (!atom->rmass) {
|
||||
|
@ -404,11 +412,12 @@ void FixQTB::copy_arrays(int i, int j, int /*delflag*/)
|
|||
------------------------------------------------------------------------- */
|
||||
int FixQTB::pack_exchange(int i, double *buf)
|
||||
{
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m] = random_array_0[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m+2*N_f] = random_array_1[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[m+4*N_f] = random_array_2[i][m];
|
||||
for (int m = 0; m < 3; m++) buf[m+6*N_f] = fran[i][m];
|
||||
return 6*N_f+3;
|
||||
int n = 0;
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_0[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_1[i][m];
|
||||
for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_2[i][m];
|
||||
for (int m = 0; m < 3; m++) buf[n++] = fran[i][m];
|
||||
return n;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -416,9 +425,10 @@ int FixQTB::pack_exchange(int i, double *buf)
|
|||
------------------------------------------------------------------------- */
|
||||
int FixQTB::unpack_exchange(int nlocal, double *buf)
|
||||
{
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[m];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[m+2*N_f];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[m+4*N_f];
|
||||
for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[m+6*N_f];
|
||||
return 6*N_f+3;
|
||||
int n = 0;
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[n++];
|
||||
for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[n++];
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -47,22 +47,23 @@ class FixQTB : public Fix {
|
|||
|
||||
private:
|
||||
// qtb parameters
|
||||
int counter_mu; // counter l and mu
|
||||
double t_period, fric_coef; // friction coefficient
|
||||
int seed; // seed for the random number generator
|
||||
double f_max; // frequency cutoff
|
||||
int N_f; // number of frequency grid
|
||||
double t_target; // target qtb temperature
|
||||
int counter_mu; // counter l and mu
|
||||
double t_period, fric_coef; // friction coefficient
|
||||
int seed; // seed for the random number generator
|
||||
double f_max; // frequency cutoff
|
||||
int N_f; // number of frequency grid
|
||||
double t_target; // target qtb temperature
|
||||
char *id_temp;
|
||||
class Compute *temperature;
|
||||
double h_timestep; // time step to update the random forces
|
||||
int alpha; // number of time steps to update the random forces
|
||||
class RanMars *random; // random number generator
|
||||
double *gfactor1,*gfactor3; // factors of frictions and random forces
|
||||
double *omega_H,*time_H; // H gives the desired power spectrum
|
||||
double **random_array_0, **random_array_1, **random_array_2; // random number arrays give independence between atoms and directions
|
||||
double h_timestep; // time step to update the random forces
|
||||
int alpha; // number of time steps to update the random forces
|
||||
class RanMars *random; // random number generator
|
||||
double *gfactor1,*gfactor3; // factors of frictions and random forces
|
||||
double *omega_H,*time_H; // H gives the desired power spectrum
|
||||
// random number arrays give independence between atoms and directions
|
||||
double **random_array_0, **random_array_1, **random_array_2;
|
||||
int nlevels_respa;
|
||||
double **fran, fsum[3], fsumall[3]; // random forces and their sums
|
||||
double **fran, fsum[3], fsumall[3]; // random forces and their sums
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -337,6 +337,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
|
||||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
if ((c < 10) || (j < 0) || (k < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types) {
|
||||
|
||||
|
@ -361,6 +363,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
/* line 2 */
|
||||
fgets(s,MAX_LINE,fp);
|
||||
c=Tokenize(s,&tmp);
|
||||
if (c < 8)
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
val = atof(tmp[0]); reax->tbp[j][k].p_be2 = val;
|
||||
reax->tbp[k][j].p_be2 = val;
|
||||
|
@ -491,6 +495,9 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
|
||||
if ((c < (lgflag ? 9 : 8)) || (j < 0) || (k < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types) {
|
||||
val = atof(tmp[2]);
|
||||
if (val > 0.0) {
|
||||
|
@ -528,10 +535,12 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
reax->tbp[k][j].r_pp = val;
|
||||
}
|
||||
|
||||
val = atof(tmp[8]);
|
||||
if (val >= 0.0) {
|
||||
reax->tbp[j][k].lgcij = val;
|
||||
reax->tbp[k][j].lgcij = val;
|
||||
if (lgflag) {
|
||||
val = atof(tmp[8]);
|
||||
if (val >= 0.0) {
|
||||
reax->tbp[j][k].lgcij = val;
|
||||
reax->tbp[k][j].lgcij = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -552,6 +561,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
if ((c < 10) || (j < 0) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types &&
|
||||
m < reax->num_atom_types) {
|
||||
|
@ -611,6 +622,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
n = atoi(tmp[3]) - 1;
|
||||
if ((c < 9) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j >= 0 && n >= 0) { // this means the entry is not in compact form
|
||||
if (j < reax->num_atom_types && k < reax->num_atom_types &&
|
||||
|
@ -667,8 +680,6 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* next line is number of hydrogen bond params and some comments */
|
||||
fgets( s, MAX_LINE, fp );
|
||||
c = Tokenize( s, &tmp );
|
||||
|
@ -686,7 +697,8 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
|
|||
j = atoi(tmp[0]) - 1;
|
||||
k = atoi(tmp[1]) - 1;
|
||||
m = atoi(tmp[2]) - 1;
|
||||
|
||||
if ((c < 7) || (j < 0) || (k < 0) || (m < 0))
|
||||
control->error_ptr->all(FLERR, "Inconsistent force field file");
|
||||
|
||||
if (j < reax->num_atom_types && m < reax->num_atom_types) {
|
||||
val = atof(tmp[3]);
|
||||
|
|
|
@ -48,8 +48,6 @@ using namespace MathConst;
|
|||
#define DELTA_PERATOM 64
|
||||
#define EPSILON 1.0e-6
|
||||
|
||||
enum{DOUBLE,INT,BIGINT};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
|
@ -1086,7 +1084,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
|||
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != avec->size_data_atom && nwords != avec->size_data_atom + 3)
|
||||
|
@ -1236,7 +1234,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset)
|
|||
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != avec->size_data_vel)
|
||||
|
@ -1588,7 +1586,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset)
|
|||
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != avec_bonus->size_data_bonus)
|
||||
|
|
|
@ -24,6 +24,7 @@ class Atom : protected Pointers {
|
|||
public:
|
||||
char *atom_style;
|
||||
class AtomVec *avec;
|
||||
enum{DOUBLE,INT,BIGINT};
|
||||
|
||||
// atom counts
|
||||
|
||||
|
|
166
src/atom_vec.cpp
166
src/atom_vec.cpp
|
@ -33,8 +33,6 @@ using namespace MathConst;
|
|||
#define DELTA 16384
|
||||
#define DELTA_BONUS 8192
|
||||
|
||||
enum{DOUBLE,INT,BIGINT};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
|
||||
|
@ -214,7 +212,7 @@ void AtomVec::grow(int n)
|
|||
datatype = mgrow.datatype[i];
|
||||
cols = mgrow.cols[i];
|
||||
const int nthreads = threads[i] ? comm->nthreads : 1;
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0)
|
||||
memory->grow(*((double **) pdata),nmax*nthreads,"atom:dvec");
|
||||
else if (cols > 0)
|
||||
|
@ -223,7 +221,7 @@ void AtomVec::grow(int n)
|
|||
maxcols = *(mgrow.maxcols[i]);
|
||||
memory->grow(*((double ***) pdata),nmax*nthreads,maxcols,"atom:darray");
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0)
|
||||
memory->grow(*((int **) pdata),nmax*nthreads,"atom:ivec");
|
||||
else if (cols > 0)
|
||||
|
@ -232,14 +230,14 @@ void AtomVec::grow(int n)
|
|||
maxcols = *(mgrow.maxcols[i]);
|
||||
memory->grow(*((int ***) pdata),nmax*nthreads,maxcols,"atom:iarray");
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0)
|
||||
memory->grow(*((bigint **) pdata),nmax*nthreads,"atom:bvec");
|
||||
else if (cols > 0)
|
||||
memory->grow(*((bigint ***) pdata),nmax*nthreads,cols,"atom:barray");
|
||||
else {
|
||||
maxcols = *(mgrow.maxcols[i]);
|
||||
memory->grow(*((int ***) pdata),nmax*nthreads,maxcols,"atom:barray");
|
||||
memory->grow(*((bigint ***) pdata),nmax*nthreads,maxcols,"atom:barray");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +273,7 @@ void AtomVec::copy(int i, int j, int delflag)
|
|||
pdata = mcopy.pdata[n];
|
||||
datatype = mcopy.datatype[n];
|
||||
cols = mcopy.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[j] = vec[i];
|
||||
|
@ -292,7 +290,7 @@ void AtomVec::copy(int i, int j, int delflag)
|
|||
for (m = 0; m < ncols; m++)
|
||||
array[j][m] = array[i][m];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[j] = vec[i];
|
||||
|
@ -309,7 +307,7 @@ void AtomVec::copy(int i, int j, int delflag)
|
|||
for (m = 0; m < ncols; m++)
|
||||
array[j][m] = array[i][m];
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[j] = vec[i];
|
||||
|
@ -377,7 +375,7 @@ int AtomVec::pack_comm(int n, int *list, double *buf,
|
|||
pdata = mcomm.pdata[nn];
|
||||
datatype = mcomm.datatype[nn];
|
||||
cols = mcomm.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -392,7 +390,7 @@ int AtomVec::pack_comm(int n, int *list, double *buf,
|
|||
buf[m++] = array[j][mm];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -407,7 +405,7 @@ int AtomVec::pack_comm(int n, int *list, double *buf,
|
|||
buf[m++] = ubuf(array[j][mm]).d;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -498,7 +496,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf,
|
|||
pdata = mcomm_vel.pdata[nn];
|
||||
datatype = mcomm_vel.datatype[nn];
|
||||
cols = mcomm_vel.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -513,7 +511,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf,
|
|||
buf[m++] = array[j][mm];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -528,7 +526,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf,
|
|||
buf[m++] = ubuf(array[j][mm]).d;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -572,7 +570,7 @@ void AtomVec::unpack_comm(int n, int first, double *buf)
|
|||
pdata = mcomm.pdata[nn];
|
||||
datatype = mcomm.datatype[nn];
|
||||
cols = mcomm.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -583,7 +581,7 @@ void AtomVec::unpack_comm(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -594,7 +592,7 @@ void AtomVec::unpack_comm(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -635,7 +633,7 @@ void AtomVec::unpack_comm_vel(int n, int first, double *buf)
|
|||
pdata = mcomm_vel.pdata[nn];
|
||||
datatype = mcomm_vel.datatype[nn];
|
||||
cols = mcomm_vel.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -646,18 +644,18 @@ void AtomVec::unpack_comm_vel(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
vec[i] = ubuf(buf[m++]).i;
|
||||
vec[i] = (int) ubuf(buf[m++]).i;
|
||||
} else {
|
||||
int **array = *((int ***) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -695,7 +693,7 @@ int AtomVec::pack_reverse(int n, int first, double *buf)
|
|||
pdata = mreverse.pdata[nn];
|
||||
datatype = mreverse.datatype[nn];
|
||||
cols = mreverse.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = first; i < last; i++) {
|
||||
|
@ -708,7 +706,7 @@ int AtomVec::pack_reverse(int n, int first, double *buf)
|
|||
buf[m++] = array[i][mm];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = first; i < last; i++) {
|
||||
|
@ -721,7 +719,7 @@ int AtomVec::pack_reverse(int n, int first, double *buf)
|
|||
buf[m++] = ubuf(array[i][mm]).d;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = first; i < last; i++) {
|
||||
|
@ -761,7 +759,7 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf)
|
|||
pdata = mreverse.pdata[nn];
|
||||
datatype = mreverse.datatype[nn];
|
||||
cols = mreverse.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -776,34 +774,34 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf)
|
|||
array[j][mm] += buf[m++];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
vec[j] += buf[m++];
|
||||
vec[j] += (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else {
|
||||
int **array = *((int ***) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
array[j][mm] += buf[m++];
|
||||
array[j][mm] += (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
vec[j] += buf[m++];
|
||||
vec[j] += (bigint) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else {
|
||||
bigint **array = *((bigint ***) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
array[j][mm] += buf[m++];
|
||||
array[j][mm] += (bigint) ubuf(buf[m++]).i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -856,7 +854,7 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
|||
pdata = mborder.pdata[nn];
|
||||
datatype = mborder.datatype[nn];
|
||||
cols = mborder.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -871,7 +869,7 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
|||
buf[m++] = array[j][mm];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -886,7 +884,7 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
|||
buf[m++] = ubuf(array[j][mm]).d;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -990,7 +988,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf,
|
|||
pdata = mborder_vel.pdata[nn];
|
||||
datatype = mborder_vel.datatype[nn];
|
||||
cols = mborder_vel.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -1005,7 +1003,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf,
|
|||
buf[m++] = array[j][mm];
|
||||
}
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -1020,7 +1018,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf,
|
|||
buf[m++] = ubuf(array[j][mm]).d;
|
||||
}
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -1072,7 +1070,7 @@ void AtomVec::unpack_border(int n, int first, double *buf)
|
|||
pdata = mborder.pdata[nn];
|
||||
datatype = mborder.datatype[nn];
|
||||
cols = mborder.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -1083,7 +1081,7 @@ void AtomVec::unpack_border(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -1094,7 +1092,7 @@ void AtomVec::unpack_border(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -1144,7 +1142,7 @@ void AtomVec::unpack_border_vel(int n, int first, double *buf)
|
|||
pdata = mborder_vel.pdata[nn];
|
||||
datatype = mborder_vel.datatype[nn];
|
||||
cols = mborder_vel.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -1155,18 +1153,18 @@ void AtomVec::unpack_border_vel(int n, int first, double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
vec[i] = ubuf(buf[m++]).i;
|
||||
vec[i] = (int) ubuf(buf[m++]).i;
|
||||
} else {
|
||||
int **array = *((int ***) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
array[i][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -1216,7 +1214,7 @@ int AtomVec::pack_exchange(int i, double *buf)
|
|||
pdata = mexchange.pdata[nn];
|
||||
datatype = mexchange.datatype[nn];
|
||||
cols = mexchange.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
buf[m++] = vec[i];
|
||||
|
@ -1233,7 +1231,7 @@ int AtomVec::pack_exchange(int i, double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
buf[m++] = array[i][mm];
|
||||
}
|
||||
} if (datatype == INT) {
|
||||
} if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
buf[m++] = ubuf(vec[i]).d;
|
||||
|
@ -1250,7 +1248,7 @@ int AtomVec::pack_exchange(int i, double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
buf[m++] = ubuf(array[i][mm]).d;
|
||||
}
|
||||
} if (datatype == BIGINT) {
|
||||
} if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
buf[m++] = ubuf(vec[i]).d;
|
||||
|
@ -1308,7 +1306,7 @@ int AtomVec::unpack_exchange(double *buf)
|
|||
pdata = mexchange.pdata[nn];
|
||||
datatype = mexchange.datatype[nn];
|
||||
cols = mexchange.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[nlocal] = buf[m++];
|
||||
|
@ -1325,10 +1323,10 @@ int AtomVec::unpack_exchange(double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
array[nlocal][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[nlocal] = ubuf(buf[m++]).i;
|
||||
vec[nlocal] = (int) ubuf(buf[m++]).i;
|
||||
} else if (cols > 0) {
|
||||
int **array = *((int ***) pdata);
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
|
@ -1342,7 +1340,7 @@ int AtomVec::unpack_exchange(double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
array[nlocal][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[nlocal] = (bigint) ubuf(buf[m++]).i;
|
||||
|
@ -1450,7 +1448,7 @@ int AtomVec::pack_restart(int i, double *buf)
|
|||
pdata = mrestart.pdata[nn];
|
||||
datatype = mrestart.datatype[nn];
|
||||
cols = mrestart.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
buf[m++] = vec[i];
|
||||
|
@ -1467,7 +1465,7 @@ int AtomVec::pack_restart(int i, double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
buf[m++] = array[i][mm];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
buf[m++] = ubuf(vec[i]).d;
|
||||
|
@ -1484,7 +1482,7 @@ int AtomVec::pack_restart(int i, double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
buf[m++] = ubuf(array[i][mm]).d;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
buf[m++] = ubuf(vec[i]).d;
|
||||
|
@ -1551,7 +1549,7 @@ int AtomVec::unpack_restart(double *buf)
|
|||
pdata = mrestart.pdata[nn];
|
||||
datatype = mrestart.datatype[nn];
|
||||
cols = mrestart.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[nlocal] = buf[m++];
|
||||
|
@ -1568,10 +1566,10 @@ int AtomVec::unpack_restart(double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
array[nlocal][mm] = buf[m++];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[nlocal] = ubuf(buf[m++]).i;
|
||||
vec[nlocal] = (int) ubuf(buf[m++]).i;
|
||||
} else if (cols > 0) {
|
||||
int **array = *((int ***) pdata);
|
||||
for (mm = 0; mm < cols; mm++)
|
||||
|
@ -1585,7 +1583,7 @@ int AtomVec::unpack_restart(double *buf)
|
|||
for (mm = 0; mm < ncols; mm++)
|
||||
array[nlocal][mm] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[nlocal] = (bigint) ubuf(buf[m++]).i;
|
||||
|
@ -1594,7 +1592,7 @@ int AtomVec::unpack_restart(double *buf)
|
|||
for (mm = 0; mm < cols; mm++)
|
||||
array[nlocal][mm] = (bigint) ubuf(buf[m++]).i;
|
||||
} else {
|
||||
int **array = *((int ***) pdata);
|
||||
bigint **array = *((bigint ***) pdata);
|
||||
collength = mexchange.collength[nn];
|
||||
plength = mexchange.plength[nn];
|
||||
if (collength) ncols = (*((int ***) plength))[nlocal][collength-1];
|
||||
|
@ -1654,7 +1652,7 @@ void AtomVec::create_atom(int itype, double *coord)
|
|||
pdata = mcreate.pdata[n];
|
||||
datatype = mcreate.datatype[n];
|
||||
cols = mcreate.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[nlocal] = 0.0;
|
||||
|
@ -1663,7 +1661,7 @@ void AtomVec::create_atom(int itype, double *coord)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[nlocal][m] = 0.0;
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[nlocal] = 0;
|
||||
|
@ -1672,7 +1670,7 @@ void AtomVec::create_atom(int itype, double *coord)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[nlocal][m] = 0;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[nlocal] = 0;
|
||||
|
@ -1718,7 +1716,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, char **values)
|
|||
pdata = mdata_atom.pdata[n];
|
||||
datatype = mdata_atom.datatype[n];
|
||||
cols = mdata_atom.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[nlocal] = utils::numeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1731,7 +1729,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, char **values)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[nlocal][m] = utils::numeric(FLERR,values[ivalue++],true,lmp);
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[nlocal] = utils::inumeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1740,7 +1738,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, char **values)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[nlocal][m] = utils::inumeric(FLERR,values[ivalue++],true,lmp);
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[nlocal] = utils::bnumeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1788,7 +1786,7 @@ void AtomVec::pack_data(double **buf)
|
|||
pdata = mdata_atom.pdata[n];
|
||||
datatype = mdata_atom.datatype[n];
|
||||
cols = mdata_atom.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
buf[i][j++] = vec[i];
|
||||
|
@ -1797,7 +1795,7 @@ void AtomVec::pack_data(double **buf)
|
|||
for (m = 0; m < cols; m++)
|
||||
buf[i][j++] = array[i][m];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
buf[i][j++] = ubuf(vec[i]).d;
|
||||
|
@ -1806,7 +1804,7 @@ void AtomVec::pack_data(double **buf)
|
|||
for (m = 0; m < cols; m++)
|
||||
buf[i][j++] = ubuf(array[i][m]).d;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
buf[i][j++] = ubuf(vec[i]).d;
|
||||
|
@ -1844,21 +1842,21 @@ void AtomVec::write_data(FILE *fp, int n, double **buf)
|
|||
for (nn = 1; nn < ndata_atom; nn++) {
|
||||
datatype = mdata_atom.datatype[nn];
|
||||
cols = mdata_atom.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
fprintf(fp," %-1.16e",buf[i][j++]);
|
||||
} else {
|
||||
for (m = 0; m < cols; m++)
|
||||
fprintf(fp," %-1.16e",buf[i][j++]);
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
|
||||
} else {
|
||||
for (m = 0; m < cols; m++)
|
||||
fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i);
|
||||
} else {
|
||||
|
@ -1895,7 +1893,7 @@ void AtomVec::data_vel(int ilocal, char **values)
|
|||
pdata = mdata_vel.pdata[n];
|
||||
datatype = mdata_vel.datatype[n];
|
||||
cols = mdata_vel.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
vec[ilocal] = utils::numeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1904,7 +1902,7 @@ void AtomVec::data_vel(int ilocal, char **values)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[ilocal][m] = utils::numeric(FLERR,values[ivalue++],true,lmp);
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
vec[ilocal] = utils::inumeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1913,7 +1911,7 @@ void AtomVec::data_vel(int ilocal, char **values)
|
|||
for (m = 0; m < cols; m++)
|
||||
array[ilocal][m] = utils::inumeric(FLERR,values[ivalue++],true,lmp);
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
vec[ilocal] = utils::bnumeric(FLERR,values[ivalue++],true,lmp);
|
||||
|
@ -1944,7 +1942,7 @@ void AtomVec::pack_vel(double **buf)
|
|||
pdata = mdata_vel.pdata[n];
|
||||
datatype = mdata_vel.datatype[n];
|
||||
cols = mdata_vel.cols[n];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
double *vec = *((double **) pdata);
|
||||
buf[i][j++] = vec[i];
|
||||
|
@ -1953,7 +1951,7 @@ void AtomVec::pack_vel(double **buf)
|
|||
for (m = 0; m < cols; m++)
|
||||
buf[i][j++] = array[i][m];
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
int *vec = *((int **) pdata);
|
||||
buf[i][j++] = ubuf(vec[i]).d;
|
||||
|
@ -1962,7 +1960,7 @@ void AtomVec::pack_vel(double **buf)
|
|||
for (m = 0; m < cols; m++)
|
||||
buf[i][j++] = ubuf(array[i][m]).d;
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bigint *vec = *((bigint **) pdata);
|
||||
buf[i][j++] = ubuf(vec[i]).d;
|
||||
|
@ -1992,21 +1990,21 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf)
|
|||
for (nn = 1; nn < ndata_vel; nn++) {
|
||||
datatype = mdata_vel.datatype[nn];
|
||||
cols = mdata_vel.cols[nn];
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
fprintf(fp," %-1.16e",buf[i][j++]);
|
||||
} else {
|
||||
for (m = 0; m < cols; m++)
|
||||
fprintf(fp," %-1.16e",buf[i][j++]);
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
|
||||
} else {
|
||||
for (m = 0; m < cols; m++)
|
||||
fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i);
|
||||
} else {
|
||||
|
@ -2290,7 +2288,7 @@ bigint AtomVec::memory_usage()
|
|||
datatype = mgrow.datatype[i];
|
||||
cols = mgrow.cols[i];
|
||||
const int nthreads = threads[i] ? comm->nthreads : 1;
|
||||
if (datatype == DOUBLE) {
|
||||
if (datatype == Atom::DOUBLE) {
|
||||
if (cols == 0) {
|
||||
bytes += memory->usage(*((double **) pdata),nmax*nthreads);
|
||||
} else if (cols > 0) {
|
||||
|
@ -2299,7 +2297,7 @@ bigint AtomVec::memory_usage()
|
|||
maxcols = *(mgrow.maxcols[i]);
|
||||
bytes += memory->usage(*((double ***) pdata),nmax*nthreads,maxcols);
|
||||
}
|
||||
} else if (datatype == INT) {
|
||||
} else if (datatype == Atom::INT) {
|
||||
if (cols == 0) {
|
||||
bytes += memory->usage(*((int **) pdata),nmax*nthreads);
|
||||
} else if (cols > 0) {
|
||||
|
@ -2308,7 +2306,7 @@ bigint AtomVec::memory_usage()
|
|||
maxcols = *(mgrow.maxcols[i]);
|
||||
bytes += memory->usage(*((int ***) pdata),nmax*nthreads,maxcols);
|
||||
}
|
||||
} else if (datatype == BIGINT) {
|
||||
} else if (datatype == Atom::BIGINT) {
|
||||
if (cols == 0) {
|
||||
bytes += memory->usage(*((bigint **) pdata),nmax*nthreads);
|
||||
} else if (cols > 0) {
|
||||
|
|
|
@ -258,10 +258,8 @@ void Comm::init_exchange()
|
|||
|
||||
int onefix;
|
||||
maxexchange_fix = 0;
|
||||
for (int i = 0; i < nfix; i++) {
|
||||
onefix = fix[i]->maxexchange;
|
||||
maxexchange_fix = MAX(maxexchange_fix,onefix);
|
||||
}
|
||||
for (int i = 0; i < nfix; i++)
|
||||
maxexchange_fix += fix[i]->maxexchange;
|
||||
|
||||
maxexchange = maxexchange_atom + maxexchange_fix;
|
||||
bufextra = maxexchange + BUFEXTRA;
|
||||
|
|
|
@ -219,7 +219,7 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
|
|||
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
int nwords = utils::count_words(buf);
|
||||
int nwords = utils::trim_and_count_words(buf);
|
||||
*next = '\n';
|
||||
|
||||
if (nwords != nvalue+1)
|
||||
|
|
|
@ -446,12 +446,12 @@ void FixTMD::readfile(char *file)
|
|||
zprd = hi - lo;
|
||||
bufptr = next + 1;
|
||||
continue;
|
||||
} else if (utils::count_words(bufptr) == 4) {
|
||||
} else if (utils::trim_and_count_words(bufptr) == 4) {
|
||||
if (xprd >= 0.0 || yprd >= 0.0 || zprd >= 0.0)
|
||||
error->all(FLERR,"Incorrect format in TMD target file");
|
||||
imageflag = 0;
|
||||
firstline = 0;
|
||||
} else if (utils::count_words(bufptr) == 7) {
|
||||
} else if (utils::trim_and_count_words(bufptr) == 7) {
|
||||
if (xprd < 0.0 || yprd < 0.0 || zprd < 0.0)
|
||||
error->all(FLERR,"Incorrect format in TMD target file");
|
||||
imageflag = 1;
|
||||
|
|
101
src/force.cpp
101
src/force.cpp
|
@ -1012,102 +1012,19 @@ tagint Force::tnumeric(const char *file, int line, char *str)
|
|||
|
||||
FILE *Force::open_potential(const char *name)
|
||||
{
|
||||
FILE *fp;
|
||||
std::string filepath = utils::get_potential_file_path(name);
|
||||
std::string date;
|
||||
|
||||
if (name == NULL) return NULL;
|
||||
if(!filepath.empty()) {
|
||||
date = utils::get_potential_date(filepath, "potential");
|
||||
|
||||
// attempt to open file directly
|
||||
// if successful, return ptr
|
||||
|
||||
fp = fopen(name,"r");
|
||||
if (fp) {
|
||||
if (comm->me == 0) potential_date(fp,name);
|
||||
rewind(fp);
|
||||
return fp;
|
||||
}
|
||||
|
||||
// try the environment variable directory
|
||||
|
||||
const char *path = getenv("LAMMPS_POTENTIALS");
|
||||
if (path == NULL) return NULL;
|
||||
|
||||
const char *pot = potential_name(name);
|
||||
if (pot == NULL) return NULL;
|
||||
|
||||
size_t len1 = strlen(path);
|
||||
size_t len2 = strlen(pot);
|
||||
char *newpath = new char[len1+len2+2];
|
||||
|
||||
strcpy(newpath,path);
|
||||
#if defined(_WIN32)
|
||||
newpath[len1] = '\\';
|
||||
newpath[len1+1] = 0;
|
||||
#else
|
||||
newpath[len1] = '/';
|
||||
newpath[len1+1] = 0;
|
||||
#endif
|
||||
strcat(newpath,pot);
|
||||
|
||||
fp = fopen(newpath,"r");
|
||||
if (fp) {
|
||||
if (comm->me == 0) potential_date(fp,name);
|
||||
rewind(fp);
|
||||
}
|
||||
|
||||
delete [] newpath;
|
||||
return fp;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
strip off leading part of path, return just the filename
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
const char *Force::potential_name(const char *path)
|
||||
{
|
||||
const char *pot;
|
||||
|
||||
if (path == NULL) return NULL;
|
||||
|
||||
#if defined(_WIN32)
|
||||
// skip over the disk drive part of windows pathnames
|
||||
if (isalpha(path[0]) && path[1] == ':')
|
||||
path += 2;
|
||||
#endif
|
||||
|
||||
for (pot = path; *path != '\0'; ++path) {
|
||||
#if defined(_WIN32)
|
||||
if ((*path == '\\') || (*path == '/')) pot = path + 1;
|
||||
#else
|
||||
if (*path == '/') pot = path + 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
return pot;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
read first line of potential file
|
||||
if has DATE field, print following word
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Force::potential_date(FILE *fp, const char *name)
|
||||
{
|
||||
char line[MAXLINE];
|
||||
char *ptr = fgets(line,MAXLINE,fp);
|
||||
if (ptr == NULL) return;
|
||||
|
||||
char *word;
|
||||
word = strtok(line," \t\n\r\f");
|
||||
while (word) {
|
||||
if (strcmp(word,"DATE:") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
if (word == NULL) return;
|
||||
utils::logmesg(lmp,fmt::format("Reading potential "
|
||||
"file {} with DATE: {}",name,word));
|
||||
return;
|
||||
if(!date.empty()) {
|
||||
utils::logmesg(lmp, fmt::format("Reading potential file {} "
|
||||
"with DATE: {}\n", name, date));
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
return fopen(filepath.c_str(), "r");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -136,8 +136,6 @@ class Force : protected Pointers {
|
|||
tagint tnumeric(const char *, int, char *);
|
||||
|
||||
FILE *open_potential(const char *);
|
||||
const char *potential_name(const char *);
|
||||
void potential_date(FILE *, const char *);
|
||||
|
||||
bigint memory_usage();
|
||||
|
||||
|
|
|
@ -1402,7 +1402,7 @@ void Molecule::body(int flag, int pflag, char *line)
|
|||
while (nword < nparam) {
|
||||
readline(line);
|
||||
|
||||
ncount = utils::count_words(line);
|
||||
ncount = utils::trim_and_count_words(line);
|
||||
if (ncount == 0)
|
||||
error->one(FLERR,"Too few values in body section of molecule file");
|
||||
if (nword+ncount > nparam)
|
||||
|
|
|
@ -28,12 +28,14 @@
|
|||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "table_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NONE,RLINEAR,RSQ,BMP};
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define EPSILONR 1.0e-6
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -356,37 +358,18 @@ double PairTable::init_one(int i, int j)
|
|||
|
||||
void PairTable::read_table(Table *tb, char *file, char *keyword)
|
||||
{
|
||||
char line[MAXLINE];
|
||||
TableFileReader reader(lmp, file, "pair");
|
||||
|
||||
// open file
|
||||
char * line = reader.find_section_start(keyword);
|
||||
|
||||
FILE *fp = force->open_potential(file);
|
||||
if (fp == NULL) {
|
||||
std::string str("Cannot open file ");
|
||||
str += file;
|
||||
error->one(FLERR,str.c_str());
|
||||
}
|
||||
|
||||
// loop until section found with matching keyword
|
||||
|
||||
while (1) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL)
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line
|
||||
if (line[0] == '#') continue; // comment
|
||||
char *word = strtok(line," \t\n\r");
|
||||
if (strcmp(word,keyword) == 0) break; // matching keyword
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section
|
||||
param_extract(tb,line);
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
for (int i = 0; i < tb->ninput; i++)
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
if (!line) {
|
||||
error->one(FLERR,"Did not find keyword in table file");
|
||||
}
|
||||
|
||||
// read args on 2nd line of section
|
||||
// allocate table arrays for file values
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
line = reader.next_line();
|
||||
param_extract(tb,line);
|
||||
memory->create(tb->rfile,tb->ninput,"pair:rfile");
|
||||
memory->create(tb->efile,tb->ninput,"pair:efile");
|
||||
|
@ -407,19 +390,25 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
|||
// if rflag set, compute r
|
||||
// if rflag not set, use r from file
|
||||
|
||||
int itmp;
|
||||
double rfile,rnew;
|
||||
union_int_float_t rsq_lookup;
|
||||
|
||||
int rerror = 0;
|
||||
int cerror = 0;
|
||||
|
||||
utils::sfgets(FLERR,line,MAXLINE,fp,file,error);
|
||||
reader.skip_line();
|
||||
for (int i = 0; i < tb->ninput; i++) {
|
||||
if (NULL == fgets(line,MAXLINE,fp))
|
||||
error->one(FLERR,"Premature end of file in pair table");
|
||||
if (4 != sscanf(line,"%d %lg %lg %lg",
|
||||
&itmp,&rfile,&tb->efile[i],&tb->ffile[i])) ++cerror;
|
||||
line = reader.next_line(4);
|
||||
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
values.next_int();
|
||||
rfile = values.next_double();
|
||||
tb->efile[i] = values.next_double();
|
||||
tb->ffile[i] = values.next_double();
|
||||
} catch (TokenizerException & e) {
|
||||
++cerror;
|
||||
}
|
||||
|
||||
rnew = rfile;
|
||||
if (tb->rflag == RLINEAR)
|
||||
|
@ -443,10 +432,6 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
|||
tb->rfile[i] = rnew;
|
||||
}
|
||||
|
||||
// close file
|
||||
|
||||
fclose(fp);
|
||||
|
||||
// warn if force != dE/dr at any point that is not an inflection point
|
||||
// check via secant approximation to dE/dr
|
||||
// skip two end points since do not have surrounding secants
|
||||
|
@ -477,10 +462,9 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
|
|||
}
|
||||
|
||||
if (ferror) {
|
||||
char str[128];
|
||||
sprintf(str,"%d of %d force values in table are inconsistent with -dE/dr.\n"
|
||||
" Should only be flagged at inflection points",ferror,tb->ninput);
|
||||
error->warning(FLERR,str);
|
||||
std::string str = fmt::format("{} of {} force values in table are inconsistent with -dE/dr.\n"
|
||||
" Should only be flagged at inflection points",ferror,tb->ninput);
|
||||
error->warning(FLERR,str.c_str());
|
||||
}
|
||||
|
||||
// warn if re-computed distance values differ from file values
|
||||
|
@ -573,31 +557,29 @@ void PairTable::param_extract(Table *tb, char *line)
|
|||
tb->rflag = NONE;
|
||||
tb->fpflag = 0;
|
||||
|
||||
char *word = strtok(line," \t\n\r\f");
|
||||
while (word) {
|
||||
if (strcmp(word,"N") == 0) {
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->ninput = atoi(word);
|
||||
} else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0 ||
|
||||
strcmp(word,"BITMAP") == 0) {
|
||||
if (strcmp(word,"R") == 0) tb->rflag = RLINEAR;
|
||||
else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ;
|
||||
else if (strcmp(word,"BITMAP") == 0) tb->rflag = BMP;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->rlo = atof(word);
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->rhi = atof(word);
|
||||
} else if (strcmp(word,"FPRIME") == 0) {
|
||||
tb->fpflag = 1;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fplo = atof(word);
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
tb->fphi = atof(word);
|
||||
} else {
|
||||
printf("WORD: %s\n",word);
|
||||
error->one(FLERR,"Invalid keyword in pair table parameters");
|
||||
try {
|
||||
ValueTokenizer values(line);
|
||||
|
||||
while (values.has_next()) {
|
||||
std::string word = values.next_string();
|
||||
if (word == "N") {
|
||||
tb->ninput = values.next_int();
|
||||
} else if ((word == "R") || (word == "RSQ") || (word == "BITMAP")) {
|
||||
if (word == "R") tb->rflag = RLINEAR;
|
||||
else if (word == "RSQ") tb->rflag = RSQ;
|
||||
else if (word == "BITMAP") tb->rflag = BMP;
|
||||
tb->rlo = values.next_double();
|
||||
tb->rhi = values.next_double();
|
||||
} else if (word == "FPRIME") {
|
||||
tb->fpflag = 1;
|
||||
tb->fplo = values.next_double();
|
||||
tb->fphi = values.next_double();
|
||||
} else {
|
||||
error->one(FLERR,fmt::format("Invalid keyword {} in pair table parameters", word).c_str());
|
||||
}
|
||||
}
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
} catch (TokenizerException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N");
|
||||
|
|
|
@ -30,91 +30,129 @@ using namespace LAMMPS_NS;
|
|||
|
||||
PotentialFileReader::PotentialFileReader(LAMMPS *lmp,
|
||||
const std::string &filename,
|
||||
const std::string &potential_name) : Pointers(lmp), filename(filename) {
|
||||
const std::string &potential_name) :
|
||||
Pointers(lmp),
|
||||
reader(nullptr),
|
||||
filename(filename),
|
||||
filetype(potential_name + " potential")
|
||||
{
|
||||
if (comm->me != 0) {
|
||||
error->one(FLERR, "PotentialFileReader should only be called by proc 0!");
|
||||
error->one(FLERR, "FileReader should only be called by proc 0!");
|
||||
}
|
||||
|
||||
fp = force->open_potential(filename.c_str());
|
||||
|
||||
if (fp == NULL)
|
||||
error->one(FLERR,fmt::format("Cannot open {} potential file {}: {}",
|
||||
potential_name, filename, utils::getsyserror()));
|
||||
try {
|
||||
reader = open_potential(filename);
|
||||
if(!reader) {
|
||||
error->one(FLERR, fmt::format("cannot open {} potential file {}", potential_name, filename));
|
||||
}
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
PotentialFileReader::~PotentialFileReader() {
|
||||
fclose(fp);
|
||||
delete reader;
|
||||
}
|
||||
|
||||
void PotentialFileReader::ignore_comments(bool value) {
|
||||
reader->ignore_comments = value;
|
||||
}
|
||||
|
||||
void PotentialFileReader::skip_line() {
|
||||
char *ptr = fgets(line, MAXLINE, fp);
|
||||
if (ptr == nullptr)
|
||||
error->one(FLERR,fmt::format("Missing line in {} potential file!",
|
||||
potential_name));
|
||||
try {
|
||||
reader->skip_line();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
char *PotentialFileReader::next_line(int nparams) {
|
||||
// concatenate lines until have nparams words
|
||||
int n = 0;
|
||||
int nwords = 0;
|
||||
|
||||
char *ptr = fgets(line, MAXLINE, fp);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
return nullptr;
|
||||
try {
|
||||
return reader->next_line(nparams);
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
|
||||
// strip comment
|
||||
if ((ptr = strchr(line, '#'))) *ptr = '\0';
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
|
||||
if (nwords > 0) {
|
||||
n = strlen(line);
|
||||
}
|
||||
|
||||
while(nwords < nparams) {
|
||||
char *ptr = fgets(&line[n], MAXLINE - n, fp);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
if (nwords > 0 && nwords < nparams)
|
||||
error->one(FLERR,fmt::format("Incorrect format in {} potential "
|
||||
"file! {}/{} parameters",
|
||||
potential_name, nwords, nparams));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// strip comment
|
||||
if ((ptr = strchr(line, '#'))) *ptr = '\0';
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
|
||||
// skip line if blank
|
||||
if (nwords > 0) {
|
||||
n = strlen(line);
|
||||
}
|
||||
}
|
||||
|
||||
return line;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PotentialFileReader::next_dvector(int n, double * list) {
|
||||
int i = 0;
|
||||
while (i < n) {
|
||||
char *ptr = fgets(line, MAXLINE, fp);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
if (i < n)
|
||||
error->one(FLERR,fmt::format("Incorrect format in {} potential file! "
|
||||
"{}/{} values", potential_name, i, n));
|
||||
}
|
||||
|
||||
ValueTokenizer values(line);
|
||||
while(values.has_next()) {
|
||||
list[i++] = values.next_double();
|
||||
}
|
||||
void PotentialFileReader::next_dvector(double * list, int n) {
|
||||
try {
|
||||
return reader->next_dvector(list, n);
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
ValueTokenizer PotentialFileReader::next_values(int nparams, const std::string & seperators) {
|
||||
try {
|
||||
return reader->next_values(nparams, seperators);
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return ValueTokenizer("");
|
||||
}
|
||||
|
||||
double PotentialFileReader::next_double() {
|
||||
try {
|
||||
char * line = reader->next_line(1);
|
||||
return ValueTokenizer(line).next_double();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int PotentialFileReader::next_int() {
|
||||
try {
|
||||
char * line = reader->next_line(1);
|
||||
return ValueTokenizer(line).next_int();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
tagint PotentialFileReader::next_tagint() {
|
||||
try {
|
||||
char * line = reader->next_line(1);
|
||||
return ValueTokenizer(line).next_tagint();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bigint PotentialFileReader::next_bigint() {
|
||||
try {
|
||||
char * line = reader->next_line(1);
|
||||
return ValueTokenizer(line).next_bigint();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string PotentialFileReader::next_string() {
|
||||
try {
|
||||
char * line = reader->next_line(1);
|
||||
return ValueTokenizer(line).next_string();
|
||||
} catch (FileReaderException & e) {
|
||||
error->one(FLERR, e.what());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
TextFileReader * PotentialFileReader::open_potential(const std::string& path) {
|
||||
std::string filepath = utils::get_potential_file_path(path);
|
||||
std::string date;
|
||||
|
||||
if(!filepath.empty()) {
|
||||
date = utils::get_potential_date(filepath, filetype);
|
||||
|
||||
if(!date.empty()) {
|
||||
utils::logmesg(lmp, fmt::format("Reading potential file {} with DATE: {}", filename, date));
|
||||
}
|
||||
return new TextFileReader(filepath, filetype);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -21,23 +21,36 @@
|
|||
#include <string>
|
||||
|
||||
#include "pointers.h"
|
||||
#include "tokenizer.h"
|
||||
#include "text_file_reader.h"
|
||||
|
||||
namespace LAMMPS_NS
|
||||
{
|
||||
class PotentialFileReader : protected Pointers {
|
||||
std::string potential_name;
|
||||
protected:
|
||||
TextFileReader * reader;
|
||||
std::string filename;
|
||||
static const int MAXLINE = 1024;
|
||||
char line[MAXLINE];
|
||||
FILE *fp;
|
||||
std::string filetype;
|
||||
|
||||
TextFileReader * open_potential(const std::string& path);
|
||||
|
||||
public:
|
||||
PotentialFileReader(class LAMMPS *lmp, const std::string &filename, const std::string &potential_name);
|
||||
~PotentialFileReader();
|
||||
virtual ~PotentialFileReader();
|
||||
|
||||
void ignore_comments(bool value);
|
||||
|
||||
void skip_line();
|
||||
char * next_line(int nparams);
|
||||
void next_dvector(int n, double * list);
|
||||
char * next_line(int nparams = 0);
|
||||
void next_dvector(double * list, int n);
|
||||
ValueTokenizer next_values(int nparams, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
|
||||
// convenience functions
|
||||
double next_double();
|
||||
int next_int();
|
||||
tagint next_tagint();
|
||||
bigint next_bigint();
|
||||
std::string next_string();
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
|
|
@ -1661,7 +1661,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr)
|
|||
while (nword < ninteger) {
|
||||
eof = fgets(&buffer[m],MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
ncount = utils::count_words(&buffer[m]);
|
||||
ncount = utils::trim_and_count_words(&buffer[m]);
|
||||
if (ncount == 0)
|
||||
error->one(FLERR,"Too few values in body lines in data file");
|
||||
nword += ncount;
|
||||
|
@ -1675,7 +1675,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr)
|
|||
while (nword < ndouble) {
|
||||
eof = fgets(&buffer[m],MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
ncount = utils::count_words(&buffer[m]);
|
||||
ncount = utils::trim_and_count_words(&buffer[m]);
|
||||
if (ncount == 0)
|
||||
error->one(FLERR,"Too few values in body lines in data file");
|
||||
nword += ncount;
|
||||
|
|
|
@ -162,7 +162,7 @@ bigint ReaderNative::read_header(double box[3][3], int &boxinfo, int &triclinic,
|
|||
|
||||
char *labelline = &line[strlen("ITEM: ATOMS ")];
|
||||
|
||||
nwords = utils::count_words(labelline);
|
||||
nwords = utils::trim_and_count_words(labelline);
|
||||
char **labels = new char*[nwords];
|
||||
labels[0] = strtok(labelline," \t\n\r\f");
|
||||
if (labels[0] == NULL) {
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing authors: Richard Berger (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "lammps.h"
|
||||
#include "error.h"
|
||||
#include "table_file_reader.h"
|
||||
#include "utils.h"
|
||||
#include "tokenizer.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
TableFileReader::TableFileReader(LAMMPS *lmp,
|
||||
const std::string &filename,
|
||||
const std::string &type) :
|
||||
PotentialFileReader(lmp, filename, type + " table")
|
||||
{
|
||||
}
|
||||
|
||||
TableFileReader::~TableFileReader() {
|
||||
}
|
||||
|
||||
char * TableFileReader::find_section_start(const std::string & keyword) {
|
||||
char * line = nullptr;
|
||||
while (line = reader->next_line()) {
|
||||
ValueTokenizer values(line);
|
||||
std::string word = values.next_string();
|
||||
|
||||
if (word == keyword) {
|
||||
// matching keyword
|
||||
return line;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing authors: Richard Berger (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_TABLE_FILE_READER_H
|
||||
#define LMP_TABLE_FILE_READER_H
|
||||
|
||||
#include "potential_file_reader.h"
|
||||
|
||||
namespace LAMMPS_NS
|
||||
{
|
||||
class TableFileReader : public PotentialFileReader {
|
||||
public:
|
||||
TableFileReader(class LAMMPS *lmp, const std::string &filename, const std::string & type);
|
||||
virtual ~TableFileReader();
|
||||
|
||||
char * find_section_start(const std::string & keyword);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
|
@ -0,0 +1,121 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing authors: Richard Berger (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "lammps.h"
|
||||
#include "force.h"
|
||||
#include "error.h"
|
||||
#include "comm.h"
|
||||
#include "utils.h"
|
||||
#include "text_file_reader.h"
|
||||
#include "tokenizer.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
TextFileReader::TextFileReader(const std::string &filename, const std::string &filetype)
|
||||
: filename(filename), filetype(filetype), ignore_comments(true)
|
||||
{
|
||||
fp = fopen(filename.c_str(), "r");
|
||||
|
||||
if (fp == nullptr) {
|
||||
throw FileReaderException(fmt::format("cannot open {} file {}", filetype, filename));
|
||||
}
|
||||
}
|
||||
|
||||
TextFileReader::~TextFileReader() {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void TextFileReader::skip_line() {
|
||||
char *ptr = fgets(line, MAXLINE, fp);
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
throw EOFException(fmt::format("Missing line in {} file!", filetype));
|
||||
}
|
||||
}
|
||||
|
||||
char *TextFileReader::next_line(int nparams) {
|
||||
// concatenate lines until have nparams words
|
||||
int n = 0;
|
||||
int nwords = 0;
|
||||
|
||||
char *ptr = fgets(line, MAXLINE, fp);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// strip comment
|
||||
if (ignore_comments && (ptr = strchr(line, '#'))) *ptr = '\0';
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
|
||||
if (nwords > 0) {
|
||||
n = strlen(line);
|
||||
}
|
||||
|
||||
while(nwords == 0 || nwords < nparams) {
|
||||
char *ptr = fgets(&line[n], MAXLINE - n, fp);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
if (nwords > 0 && nwords < nparams) {
|
||||
throw EOFException(fmt::format("Incorrect format in {} file! {}/{} parameters", filetype, nwords, nparams));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
// strip comment
|
||||
if (ignore_comments && (ptr = strchr(line, '#'))) *ptr = '\0';
|
||||
|
||||
nwords = utils::count_words(line);
|
||||
|
||||
// skip line if blank
|
||||
if (nwords > 0) {
|
||||
n = strlen(line);
|
||||
}
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void TextFileReader::next_dvector(double * list, int n) {
|
||||
int i = 0;
|
||||
while (i < n) {
|
||||
char *ptr = next_line();
|
||||
|
||||
if (ptr == nullptr) {
|
||||
// EOF
|
||||
if (i < n) {
|
||||
throw FileReaderException(fmt::format("Incorrect format in {} file! {}/{} values", filetype, i, n));
|
||||
}
|
||||
}
|
||||
|
||||
ValueTokenizer values(line);
|
||||
while(values.has_next()) {
|
||||
list[i++] = values.next_double();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ValueTokenizer TextFileReader::next_values(int nparams, const std::string & seperators) {
|
||||
return ValueTokenizer(next_line(nparams), seperators);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing authors: Richard Berger (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_TEXT_FILE_READER_H
|
||||
#define LMP_TEXT_FILE_READER_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include "tokenizer.h"
|
||||
|
||||
namespace LAMMPS_NS
|
||||
{
|
||||
class TextFileReader {
|
||||
std::string filename;
|
||||
std::string filetype;
|
||||
static const int MAXLINE = 1024;
|
||||
char line[MAXLINE];
|
||||
FILE *fp;
|
||||
|
||||
public:
|
||||
bool ignore_comments;
|
||||
|
||||
TextFileReader(const std::string &filename, const std::string &filetype);
|
||||
~TextFileReader();
|
||||
|
||||
void skip_line();
|
||||
char * next_line(int nparams = 0);
|
||||
|
||||
void next_dvector(double * list, int n);
|
||||
ValueTokenizer next_values(int nparams, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
};
|
||||
|
||||
class FileReaderException : public std::exception {
|
||||
std::string message;
|
||||
public:
|
||||
FileReaderException(const std::string & msg) : message(msg) {
|
||||
}
|
||||
|
||||
~FileReaderException() throw() {
|
||||
}
|
||||
|
||||
virtual const char * what() const throw() {
|
||||
return message.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
class EOFException : public FileReaderException {
|
||||
public:
|
||||
EOFException(const std::string & msg) : FileReaderException(msg) {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
|
@ -160,7 +160,7 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||
// allocate per-field memory
|
||||
// process line of keywords
|
||||
|
||||
nfield_initial = utils::count_words(line);
|
||||
nfield_initial = utils::trim_and_count_words(line);
|
||||
allocate();
|
||||
parse_fields(line);
|
||||
|
||||
|
|
|
@ -37,6 +37,12 @@ Tokenizer::Tokenizer(const std::string & str, const std::string & seperators) {
|
|||
} while(end != std::string::npos);
|
||||
}
|
||||
|
||||
Tokenizer::Tokenizer(const Tokenizer & rhs) : tokens(rhs.tokens) {
|
||||
}
|
||||
|
||||
Tokenizer::Tokenizer(Tokenizer && rhs) : tokens(std::move(rhs.tokens)) {
|
||||
}
|
||||
|
||||
Tokenizer::iterator Tokenizer::begin() {
|
||||
return tokens.begin();
|
||||
}
|
||||
|
@ -66,6 +72,14 @@ ValueTokenizer::ValueTokenizer(const std::string & str, const std::string & sepe
|
|||
current = tokens.begin();
|
||||
}
|
||||
|
||||
ValueTokenizer::ValueTokenizer(const ValueTokenizer & rhs) : tokens(rhs.tokens) {
|
||||
current = tokens.begin();
|
||||
}
|
||||
|
||||
ValueTokenizer::ValueTokenizer(ValueTokenizer && rhs) : tokens(std::move(rhs.tokens)) {
|
||||
current = tokens.begin();
|
||||
}
|
||||
|
||||
bool ValueTokenizer::has_next() const {
|
||||
return current != tokens.cend();
|
||||
}
|
||||
|
|
|
@ -25,13 +25,19 @@
|
|||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
#define TOKENIZER_DEFAULT_SEPERATORS " \t\r\n\f"
|
||||
|
||||
class Tokenizer {
|
||||
std::vector<std::string> tokens;
|
||||
public:
|
||||
typedef std::vector<std::string>::iterator iterator;
|
||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||
|
||||
Tokenizer(const std::string & str, const std::string & seperators = " \t\r\n\f");
|
||||
Tokenizer(const std::string & str, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
Tokenizer(Tokenizer &&);
|
||||
Tokenizer(const Tokenizer &);
|
||||
Tokenizer& operator=(const Tokenizer&) = default;
|
||||
Tokenizer& operator=(Tokenizer&&) = default;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
|
@ -72,7 +78,11 @@ class ValueTokenizer {
|
|||
Tokenizer tokens;
|
||||
Tokenizer::const_iterator current;
|
||||
public:
|
||||
ValueTokenizer(const std::string & str, const std::string & seperators = " \t\r\n\f");
|
||||
ValueTokenizer(const std::string & str, const std::string & seperators = TOKENIZER_DEFAULT_SEPERATORS);
|
||||
ValueTokenizer(const ValueTokenizer &);
|
||||
ValueTokenizer(ValueTokenizer &&);
|
||||
ValueTokenizer& operator=(const ValueTokenizer&) = default;
|
||||
ValueTokenizer& operator=(ValueTokenizer&&) = default;
|
||||
|
||||
std::string next_string();
|
||||
tagint next_tagint();
|
||||
|
|
111
src/utils.cpp
111
src/utils.cpp
|
@ -18,6 +18,7 @@
|
|||
#include "lammps.h"
|
||||
#include "error.h"
|
||||
#include "tokenizer.h"
|
||||
#include "text_file_reader.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
|
@ -364,14 +365,22 @@ std::string utils::trim_comment(const std::string & line) {
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Trim comment from string and return number of words
|
||||
Return number of words
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
size_t utils::count_words(const std::string & text, const std::string & seperators) {
|
||||
Tokenizer words(utils::trim_comment(text), seperators);
|
||||
ValueTokenizer words(text, seperators);
|
||||
return words.count();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Trim comment from string and return number of words
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
size_t utils::trim_and_count_words(const std::string & text, const std::string & seperators) {
|
||||
return utils::count_words(utils::trim_comment(text), seperators);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Return whether string is a valid integer number
|
||||
------------------------------------------------------------------------- */
|
||||
|
@ -406,6 +415,104 @@ bool utils::is_double(const std::string & str) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
strip off leading part of path, return just the filename
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::path_basename(const std::string & path) {
|
||||
#if defined(_WIN32)
|
||||
size_t start = path.find_last_of('/\\');
|
||||
#else
|
||||
size_t start = path.find_last_of('/');
|
||||
#endif
|
||||
|
||||
if (start == std::string::npos) {
|
||||
start = 0;
|
||||
} else {
|
||||
start += 1;
|
||||
}
|
||||
|
||||
return path.substr(start);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
join two paths
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::path_join(const std::string & a, const std::string & b) {
|
||||
#if defined(_WIN32)
|
||||
return fmt::format("{}\\{}", a, b);
|
||||
#else
|
||||
return fmt::format("{}/{}", a, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
try to open file for reading
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
bool utils::file_is_readable(const std::string & path) {
|
||||
FILE * fp = fopen(path.c_str(), "r");
|
||||
if(fp) {
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
try to find potential file as specified by name
|
||||
search current directory and the LAMMPS_POTENTIALS directory if
|
||||
specified
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::get_potential_file_path(const std::string& path) {
|
||||
std::string filepath = path;
|
||||
std::string filename = utils::path_basename(path);
|
||||
|
||||
if(utils::file_is_readable(filepath)) {
|
||||
return filepath;
|
||||
} else {
|
||||
// try the environment variable directory
|
||||
const char *path = getenv("LAMMPS_POTENTIALS");
|
||||
|
||||
if (path != nullptr){
|
||||
std::string pot = utils::path_basename(filepath);
|
||||
filepath = utils::path_join(path, pot);
|
||||
|
||||
if (utils::file_is_readable(filepath)) {
|
||||
return filepath;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
read first line of potential file
|
||||
if has DATE field, print following word
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
std::string utils::get_potential_date(const std::string & path, const std::string & potential_name) {
|
||||
TextFileReader reader(path, potential_name);
|
||||
reader.ignore_comments = false;
|
||||
char * line = nullptr;
|
||||
|
||||
while (line = reader.next_line()) {
|
||||
ValueTokenizer values(line);
|
||||
while (values.has_next()) {
|
||||
std::string word = values.next_string();
|
||||
if (word == "DATE:") {
|
||||
if (values.has_next()) {
|
||||
std::string date = values.next_string();
|
||||
return date;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
extern "C" {
|
||||
|
|
48
src/utils.h
48
src/utils.h
|
@ -150,13 +150,21 @@ namespace LAMMPS_NS {
|
|||
*/
|
||||
std::string trim_comment(const std::string & line);
|
||||
|
||||
/**
|
||||
* \brief Count words in string
|
||||
* \param text string that should be searched
|
||||
* \param seperators string containing characters that will be treated as whitespace
|
||||
* \return number of words found
|
||||
*/
|
||||
size_t count_words(const std::string & text, const std::string & seperators = " \t\r\n\f");
|
||||
|
||||
/**
|
||||
* \brief Count words in a single line, trim anything from '#' onward
|
||||
* \param text string that should be trimmed and searched
|
||||
* \param seperators string containing characters that will be treated as whitespace
|
||||
* \return number of words found
|
||||
*/
|
||||
size_t count_words(const std::string & text, const std::string & seperators = " \t\r\n\f");
|
||||
size_t trim_and_count_words(const std::string & text, const std::string & seperators = " \t\r\n\f");
|
||||
|
||||
/**
|
||||
* \brief Check if string can be converted to valid integer
|
||||
|
@ -171,6 +179,44 @@ namespace LAMMPS_NS {
|
|||
* \return true, if string contains valid floating-point number, false otherwise
|
||||
*/
|
||||
bool is_double(const std::string & str);
|
||||
|
||||
/**
|
||||
* \brief Strip off leading part of path, return just the filename
|
||||
* \param path file path
|
||||
* \return file name
|
||||
*/
|
||||
std::string path_basename(const std::string & path);
|
||||
|
||||
/**
|
||||
* \brief Join two paths
|
||||
* \param a first path
|
||||
* \param b second path
|
||||
* \return combined path
|
||||
*/
|
||||
std::string path_join(const std::string & a, const std::string & b);
|
||||
|
||||
/**
|
||||
* \brief Check if file exists and is readable
|
||||
* \param path file path
|
||||
* \return true if file exists and is readable
|
||||
*/
|
||||
bool file_is_readable(const std::string & path);
|
||||
|
||||
/**
|
||||
* \brief Determine full path of potential file
|
||||
* If file is not found in current directory, search LAMMPS_POTENTIALS folder
|
||||
* \param path file path
|
||||
* \return full path to potential file
|
||||
*/
|
||||
std::string get_potential_file_path(const std::string& path);
|
||||
|
||||
/**
|
||||
* \brief Read potential file and return DATE field if it is present
|
||||
* \param path file path
|
||||
* \param potential_name name of potential that is being read
|
||||
* \return DATE field if present
|
||||
*/
|
||||
std::string get_potential_date(const std::string & path, const std::string & potential_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,43 @@ From: centos:7
|
|||
hdf5-devel python36-virtualenv python36-pip python-pip \
|
||||
netcdf-devel netcdf-cxx-devel netcdf-mpich-devel netcdf-openmpi-devel \
|
||||
python-virtualenv fftw-devel voro++-devel eigen3-devel gsl-devel openblas-devel enchant \
|
||||
blas-devel lapack-devel libyaml-devel
|
||||
blas-devel lapack-devel libyaml-devel openkim-models kim-api-devel
|
||||
yum clean all
|
||||
|
||||
# we need to reset any module variables
|
||||
# inherited from the host.
|
||||
unset __LMOD_REF_COUNT__LMFILES_
|
||||
unset __LMOD_REF_COUNT_PATH
|
||||
unset __LMOD_REF_COUNT_LD_LIBRARY_PATH
|
||||
unset __LMOD_REF_COUNT_MANPATH
|
||||
unset __LMOD_REF_COUNT_MODULEPATH
|
||||
unset __LMOD_REF_COUNT_LOADEDMODULES
|
||||
unset _LMFILES_
|
||||
unset MODULEPATH
|
||||
unset MODULESHOME
|
||||
unset MODULEPATH_ROOT
|
||||
unset LOADEDMODULES
|
||||
unset LMOD_SYSTEM_DEFAULT_MODULES
|
||||
|
||||
# load MPI by default
|
||||
. /etc/profile
|
||||
module load mpi
|
||||
|
||||
# manually install Plumed
|
||||
mkdir plumed
|
||||
cd plumed
|
||||
version=2.6.0
|
||||
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${version}/plumed-src-${version}.tgz
|
||||
tar -xzf plumed.tar.gz
|
||||
cd plumed-${version}
|
||||
./configure --disable-doc --prefix=/usr
|
||||
make
|
||||
make install
|
||||
# fix up installation for CentOS and Fedora
|
||||
mv -v /usr/lib/pkgconfig/plumed* /usr/share/pkgconfig/
|
||||
cd ../../
|
||||
rm -rvf plumed
|
||||
|
||||
# set custom prompt indicating the container name
|
||||
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
|
||||
cat >$CUSTOM_PROMPT_ENV <<EOF
|
||||
|
|
|
@ -16,9 +16,43 @@ From: centos:8
|
|||
texlive-latex-bin texlive-lualatex-math texlive-fncychap texlive-tabulary \
|
||||
texlive-framed texlive-wrapfig texlive-upquote texlive-capt-of \
|
||||
texlive-needspace texlive-titlesec texlive-anysize texlive-dvipng \
|
||||
blas-devel lapack-devel libyaml-devel
|
||||
blas-devel lapack-devel libyaml-devel openkim-models kim-api-devel
|
||||
dnf clean all
|
||||
|
||||
# we need to reset any module variables
|
||||
# inherited from the host.
|
||||
unset __LMOD_REF_COUNT__LMFILES_
|
||||
unset __LMOD_REF_COUNT_PATH
|
||||
unset __LMOD_REF_COUNT_LD_LIBRARY_PATH
|
||||
unset __LMOD_REF_COUNT_MANPATH
|
||||
unset __LMOD_REF_COUNT_MODULEPATH
|
||||
unset __LMOD_REF_COUNT_LOADEDMODULES
|
||||
unset _LMFILES_
|
||||
unset MODULEPATH
|
||||
unset MODULESHOME
|
||||
unset MODULEPATH_ROOT
|
||||
unset LOADEDMODULES
|
||||
unset LMOD_SYSTEM_DEFAULT_MODULES
|
||||
|
||||
# load MPI by default
|
||||
. /etc/profile
|
||||
module load mpi
|
||||
|
||||
# manually install Plumed
|
||||
mkdir plumed
|
||||
cd plumed
|
||||
version=2.6.0
|
||||
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${version}/plumed-src-${version}.tgz
|
||||
tar -xzf plumed.tar.gz
|
||||
cd plumed-${version}
|
||||
./configure --disable-doc --prefix=/usr
|
||||
make
|
||||
make install
|
||||
# fix up installation for CentOS and Fedora
|
||||
mv -v /usr/lib64/pkgconfig/plumed* /usr/share/pkgconfig/
|
||||
cd ../../
|
||||
rm -rvf plumed
|
||||
|
||||
# set custom prompt indicating the container name
|
||||
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
|
||||
cat >$CUSTOM_PROMPT_ENV <<EOF
|
||||
|
|
|
@ -35,9 +35,29 @@ From: fedora:32
|
|||
texlive-latex-bin texlive-lualatex-math texlive-fncychap texlive-tabulary \
|
||||
texlive-framed texlive-wrapfig texlive-upquote texlive-capt-of \
|
||||
texlive-needspace texlive-titlesec texlive-anysize texlive-dvipng \
|
||||
blas-devel lapack-devel libyaml-devel
|
||||
blas-devel lapack-devel libyaml-devel openkim-models kim-api-devel
|
||||
dnf clean all
|
||||
|
||||
# enable Lmod and load MPI
|
||||
source /usr/share/lmod/lmod/init/profile
|
||||
module purge
|
||||
module load mpi
|
||||
|
||||
# manually install Plumed
|
||||
mkdir plumed
|
||||
cd plumed
|
||||
version=2.6.0
|
||||
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${version}/plumed-src-${version}.tgz
|
||||
tar -xzf plumed.tar.gz
|
||||
cd plumed-${version}
|
||||
./configure --disable-doc --prefix=/usr
|
||||
make
|
||||
make install
|
||||
# fix up installation for CentOS and Fedora
|
||||
mv -v /usr/lib64/pkgconfig/plumed* /usr/share/pkgconfig/
|
||||
cd ../../
|
||||
rm -rvf plumed
|
||||
|
||||
# set custom prompt indicating the container name
|
||||
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
|
||||
cat >$CUSTOM_PROMPT_ENV <<EOF
|
||||
|
|
|
@ -4,6 +4,9 @@ From: ubuntu:18.04
|
|||
%post
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y software-properties-common
|
||||
add-apt-repository ppa:openkim/latest
|
||||
apt-get update
|
||||
apt-get upgrade --no-install-recommends -y
|
||||
apt-get install --no-install-recommends -y \
|
||||
bc \
|
||||
|
@ -66,11 +69,28 @@ From: ubuntu:18.04
|
|||
wget \
|
||||
xxd \
|
||||
valgrind \
|
||||
gdb
|
||||
gdb \
|
||||
libkim-api-dev \
|
||||
openkim-models
|
||||
|
||||
# clean cache
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# manually install Plumed
|
||||
mkdir plumed
|
||||
cd plumed
|
||||
version=2.6.0
|
||||
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${version}/plumed-src-${version}.tgz
|
||||
tar -xzf plumed.tar.gz
|
||||
cd plumed-${version}
|
||||
./configure --disable-doc --prefix=/usr
|
||||
make
|
||||
make install
|
||||
# fix up installation for CentOS and Fedora
|
||||
# mv -v /usr/lib/pkgconfig/plumed* /usr/share/pkgconfig/
|
||||
cd ../../
|
||||
rm -rvf plumed
|
||||
|
||||
# set custom prompt indicating the container name
|
||||
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
|
||||
cat >$CUSTOM_PROMPT_ENV <<EOF
|
||||
|
|
|
@ -4,6 +4,9 @@ From: ubuntu:20.04
|
|||
%post
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y software-properties-common
|
||||
add-apt-repository ppa:openkim/latest
|
||||
apt-get update
|
||||
apt-get upgrade --no-install-recommends -y
|
||||
apt-get install --no-install-recommends -y \
|
||||
bc \
|
||||
|
@ -62,11 +65,28 @@ From: ubuntu:20.04
|
|||
wget \
|
||||
xxd \
|
||||
valgrind \
|
||||
gdb
|
||||
gdb \
|
||||
libkim-api-dev \
|
||||
openkim-models
|
||||
|
||||
# clean cache
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# manually install Plumed
|
||||
mkdir plumed
|
||||
cd plumed
|
||||
version=2.6.0
|
||||
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${version}/plumed-src-${version}.tgz
|
||||
tar -xzf plumed.tar.gz
|
||||
cd plumed-${version}
|
||||
./configure --disable-doc --prefix=/usr
|
||||
make
|
||||
make install
|
||||
# fix up installation for CentOS and Fedora
|
||||
# mv -v /usr/lib/pkgconfig/plumed* /usr/share/pkgconfig/
|
||||
cd ../../
|
||||
rm -rvf plumed
|
||||
|
||||
# set custom prompt indicating the container name
|
||||
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
|
||||
cat >$CUSTOM_PROMPT_ENV <<EOF
|
||||
|
@ -75,10 +95,10 @@ PS1="[ubuntu20.04:\u@\h] \W> "
|
|||
EOF
|
||||
chmod 755 $CUSTOM_PROMPT_ENV
|
||||
|
||||
|
||||
%environment
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
export PATH=/usr/lib/ccache:$PATH
|
||||
# restrict OpenMPI to shared memory comm by default
|
||||
OMPI_MCA_btl="tcp,self"
|
||||
# do not warn about unused components as this messes up testing
|
||||
|
|
|
@ -288,7 +288,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||
// equilibrium angle
|
||||
std::stringstream eqstr;
|
||||
eqstr << lmp->atom->nangletypes;
|
||||
for (std::size_t i=0; i < lmp->atom->nangletypes; ++i) {
|
||||
for (int i=0; i < lmp->atom->nangletypes; ++i) {
|
||||
eqstr << " " << lmp->force->angle->equilibrium_angle(i+1);
|
||||
}
|
||||
writer.emit("equilibrium", eqstr.str());
|
||||
|
|
|
@ -288,7 +288,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
|||
// equilibrium distance
|
||||
std::stringstream eqstr;
|
||||
eqstr << lmp->atom->nbondtypes;
|
||||
for (std::size_t i=0; i < lmp->atom->nbondtypes; ++i) {
|
||||
for (int i=0; i < lmp->atom->nbondtypes; ++i) {
|
||||
eqstr << " " << lmp->force->bond->equilibrium_distance(i+1);
|
||||
}
|
||||
writer.emit("equilibrium", eqstr.str());
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
lammps_version: 2 Jun 2020
|
||||
date_generated: Tue Jun 2 16:53:15 202
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
pair table
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.metal
|
||||
pair_style: table bitmap 10
|
||||
pair_coeff: ! |
|
||||
* * ${input_dir}/pair_table_bitmap.txt beck_1_1
|
||||
extract: ! ""
|
||||
natoms: 32
|
||||
init_vdwl: 1.66863069929167
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
6.1952827280949752e+00 6.0616458078803026e+00 5.8879068387604203e+00 2.0730193733654706e-01 -2.1217457971568116e-02 -8.9424946009241696e-02
|
||||
init_forces: ! |2
|
||||
1 1.3462021756359327e-02 6.5546484939056501e-02 1.4239378405106444e-02
|
||||
2 -2.2007228833976065e-02 -7.7589845112095546e-02 4.8902697347770523e-02
|
||||
3 -3.8360617077969741e-02 1.9000610721085417e-01 -4.8543675419659094e-02
|
||||
4 2.0909689528763566e-02 -9.9051714348463316e-03 -5.2627007649843807e-02
|
||||
5 5.6017317782444738e-02 1.4268372317778771e-01 3.5492113737546842e-02
|
||||
6 4.1557359610043018e-02 2.9641106441236388e-02 -6.9666505508374872e-03
|
||||
7 -6.4166646403998925e-02 8.9315602328966931e-02 -1.0227283854625933e-02
|
||||
8 -6.8596281778498247e-02 -6.0833941051629016e-02 4.4682109809175953e-02
|
||||
9 1.4368972530624599e-02 -5.5197060731424975e-02 -2.8201433919835286e-02
|
||||
10 -3.2703871825595171e-02 -1.4474456554468246e-01 -1.1516819202560430e-01
|
||||
11 -4.0405247666710227e-02 -5.0409352470214198e-02 4.2972316829875207e-02
|
||||
12 3.0916743299077298e-02 -8.8133140512779831e-02 -3.9753798941002949e-03
|
||||
13 -1.8590365196257386e-02 2.4575364499331190e-02 -4.7077193181172067e-02
|
||||
14 5.6675408248286062e-02 -1.8711344187186302e-02 7.0130262965183210e-02
|
||||
15 -3.1926591760213181e-02 3.1641397846490678e-02 -2.8162923341260547e-02
|
||||
16 1.1005724174097668e-01 -9.1797768313712017e-02 3.7455099430156756e-02
|
||||
17 4.3878459411519591e-02 1.3059623784047278e-01 -1.6097155896137277e-03
|
||||
18 -1.4777439020699670e-01 -3.5658427272011572e-02 -7.0718736029538459e-02
|
||||
19 -1.5580794194082498e-01 -8.1567700677555310e-02 3.7488943756308291e-02
|
||||
20 2.4266515940572463e-02 1.9762354212930246e-02 -3.4097639624214998e-02
|
||||
21 1.6277874455848959e-01 5.0800476849828920e-02 4.3314810824989737e-03
|
||||
22 2.9893704848344602e-03 -8.1978960608305021e-02 -1.1775536941431530e-02
|
||||
23 4.6993698780955703e-02 1.2309490227999968e-01 -8.0573799329662799e-02
|
||||
24 1.2797425247184574e-01 9.4738372709908938e-02 8.3761735780926952e-02
|
||||
25 6.9930077496344431e-02 4.2200999537168552e-03 -4.6754566887666743e-02
|
||||
26 -5.1872497435892714e-02 -1.5107287052733298e-01 1.2864569803094950e-01
|
||||
27 4.6175201131873622e-02 -4.7147053051923900e-03 -2.1152042044204553e-04
|
||||
28 1.1139415424523944e-02 5.7577179243740957e-02 7.3714500884676210e-02
|
||||
29 4.8901565126232033e-02 1.0736209516268529e-01 -3.2125425217601846e-03
|
||||
30 -4.2584465166652936e-02 -3.0054615946788474e-02 -8.4428957096643942e-02
|
||||
31 -2.0649926244740491e-02 -1.1590442114762316e-01 7.4794527710849712e-02
|
||||
32 -1.9354598378544019e-01 -6.3287613853627508e-02 -2.2278111493111191e-02
|
||||
run_vdwl: 1.66741314145205
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
6.1931374572792954e+00 6.0579168006450157e+00 5.8831944925174655e+00 2.0546568651742717e-01 -2.2310825568610582e-02 -9.0786598388712531e-02
|
||||
run_forces: ! |2
|
||||
1 1.0245582840443836e-02 6.5151854710940468e-02 1.3361955389177321e-02
|
||||
2 -2.2314027604621318e-02 -7.7535528641419729e-02 4.9002169116395371e-02
|
||||
3 -3.9051836443840873e-02 1.8729640241706769e-01 -5.0368800191922920e-02
|
||||
4 2.1556848319449432e-02 -9.6560257281038397e-03 -5.2226270227499996e-02
|
||||
5 5.5692513794487093e-02 1.4100131039803696e-01 3.6433829498680612e-02
|
||||
6 4.2104114940438239e-02 2.9061099461956740e-02 -8.0757486645345530e-03
|
||||
7 -6.4974396400004103e-02 9.0834827653364231e-02 -1.1497303228903639e-02
|
||||
8 -6.9891945210390563e-02 -6.1365585968288172e-02 4.5058971443054034e-02
|
||||
9 1.5494788785065767e-02 -5.6313873741252601e-02 -2.9239516346795842e-02
|
||||
10 -3.0025791257554668e-02 -1.4356984394446920e-01 -1.1248096343757182e-01
|
||||
11 -4.0162199915935268e-02 -5.1244062549941558e-02 4.2120428458812920e-02
|
||||
12 3.2219067015055440e-02 -8.8023947653775636e-02 -4.0000605662452050e-03
|
||||
13 -1.9322021317182518e-02 2.3705996957186400e-02 -4.6458078927757253e-02
|
||||
14 5.7515188139881337e-02 -1.5720861856457415e-02 6.8903466211661560e-02
|
||||
15 -3.1550376834563972e-02 3.2004964657920229e-02 -2.7509931415147928e-02
|
||||
16 1.0690614440695038e-01 -9.0850865144888507e-02 3.6425761956666795e-02
|
||||
17 4.4576246121271583e-02 1.3023640557355332e-01 -7.6587762084134013e-04
|
||||
18 -1.4790335009012934e-01 -3.4561193108141076e-02 -7.1476252590456105e-02
|
||||
19 -1.5517474793926253e-01 -8.1735148865468926e-02 3.6534263240961207e-02
|
||||
20 2.3564800733902859e-02 2.0130469558539449e-02 -3.4093822740206496e-02
|
||||
21 1.6267868459547039e-01 4.8910520011812009e-02 4.9415963505101621e-03
|
||||
22 3.9143651683370253e-03 -8.1172695145679000e-02 -1.0834230526190378e-02
|
||||
23 4.9870311913370033e-02 1.2420611623040828e-01 -7.7833840076172459e-02
|
||||
24 1.2773385871506515e-01 9.4431969129075782e-02 8.4509868356579518e-02
|
||||
25 7.0376169719190279e-02 4.4792786930559310e-03 -4.6803763947891978e-02
|
||||
26 -5.0364526911511179e-02 -1.4929711058338557e-01 1.2850817811267942e-01
|
||||
27 4.6472580366719141e-02 -4.1923069078539394e-03 -1.3401923595724521e-03
|
||||
28 1.1441857387906706e-02 5.8173904345736008e-02 7.3370361778840071e-02
|
||||
29 4.7811159682183739e-02 1.0733827504367408e-01 -1.9879309433676450e-03
|
||||
30 -4.2511930547412778e-02 -2.9916695214642831e-02 -8.4066745720912481e-02
|
||||
31 -2.1952102296720562e-02 -1.1662029578060293e-01 7.4721379144302519e-02
|
||||
32 -1.9497502987605872e-01 -6.5187354007956666e-02 -2.2832899526331281e-02
|
||||
...
|
|
@ -0,0 +1,91 @@
|
|||
---
|
||||
lammps_version: 2 Jun 2020
|
||||
date_generated: Tue Jun 2 16:46:19 202
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
pair table
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.metal
|
||||
pair_style: table linear 10000
|
||||
pair_coeff: ! |
|
||||
1 1 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
1 2 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
2 2 ${input_dir}/pair_table_beck.txt beck_2_2
|
||||
extract: ! ""
|
||||
natoms: 32
|
||||
init_vdwl: 1.66849758741132
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
6.1946715433684973e+00 6.0610621944595691e+00 5.8874237884568794e+00 2.0726669272562587e-01 -2.1210093847498168e-02 -8.9416411707758034e-02
|
||||
init_forces: ! |2
|
||||
1 1.3461768519573423e-02 6.5534109919214642e-02 1.4238046153935983e-02
|
||||
2 -2.2001532385230976e-02 -7.7578110900587721e-02 4.8895494306522291e-02
|
||||
3 -3.8355274675308998e-02 1.8998944460354011e-01 -4.8534579158997129e-02
|
||||
4 2.0908450525723498e-02 -9.9065259851936448e-03 -5.2618638347233404e-02
|
||||
5 5.6008845819212463e-02 1.4266708026293753e-01 3.5487913450023841e-02
|
||||
6 4.1552575164020243e-02 2.9642511828555394e-02 -6.9641129743398126e-03
|
||||
7 -6.4155910069342403e-02 8.9302215279040434e-02 -1.0225629221330955e-02
|
||||
8 -6.8587774765165088e-02 -6.0829429175094735e-02 4.4680410492059397e-02
|
||||
9 1.4366115666253289e-02 -5.5193010436797592e-02 -2.8199868469874739e-02
|
||||
10 -3.2696772118295803e-02 -1.4472907530040827e-01 -1.1516096653547711e-01
|
||||
11 -4.0401292979786972e-02 -5.0403260261100417e-02 4.2969363549390502e-02
|
||||
12 3.0908963526062479e-02 -8.8120722839359025e-02 -3.9792237714215200e-03
|
||||
13 -1.8590586442952396e-02 2.4570524680954029e-02 -4.7073976129125013e-02
|
||||
14 5.6668681846789561e-02 -1.8708035295572849e-02 7.0129732306455847e-02
|
||||
15 -3.1927433330968973e-02 3.1638369787962112e-02 -2.8162497777685959e-02
|
||||
16 1.1004266778296544e-01 -9.1785066871052839e-02 3.7455063670217288e-02
|
||||
17 4.3874209968260171e-02 1.3058176120978526e-01 -1.6077990215935685e-03
|
||||
18 -1.4775183032052960e-01 -3.5651338364660598e-02 -7.0714213256030112e-02
|
||||
19 -1.5579450123857666e-01 -8.1557435871161682e-02 3.7491976413329374e-02
|
||||
20 2.4262106793077946e-02 1.9762251986969553e-02 -3.4094105051678786e-02
|
||||
21 1.6276246770534447e-01 5.0791644250007900e-02 4.3248360141969555e-03
|
||||
22 2.9904687035853137e-03 -8.1967139210456882e-02 -1.1772377300447360e-02
|
||||
23 4.6987794141318706e-02 1.2308604930197996e-01 -8.0566882858205235e-02
|
||||
24 1.2795930744437653e-01 9.4726737159825200e-02 8.3749152147737538e-02
|
||||
25 6.9925482162420033e-02 4.2199513301063160e-03 -4.6743912320864334e-02
|
||||
26 -5.1856917641538880e-02 -1.5105261662137287e-01 1.2862943385759271e-01
|
||||
27 4.6163997109484788e-02 -4.7144533487617334e-03 -2.0769859565411553e-04
|
||||
28 1.1137606033726113e-02 5.7570749823347561e-02 7.3702486316706894e-02
|
||||
29 4.8892603764312044e-02 1.0734444862695605e-01 -3.2133899506260749e-03
|
||||
30 -4.2587368463202192e-02 -3.0047436022746527e-02 -8.4421201266270535e-02
|
||||
31 -2.0646231349659299e-02 -1.1590205379082782e-01 7.4785818423894770e-02
|
||||
32 -1.9352068689594826e-01 -6.3282139756026798e-02 -2.2278655095207611e-02
|
||||
run_vdwl: 1.66727802356891
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
6.1925738027578641e+00 6.0573149352705613e+00 5.8826519662480035e+00 2.0544288354756310e-01 -2.2314569036134008e-02 -9.0767397150969681e-02
|
||||
run_forces: ! |2
|
||||
1 1.0239417972012135e-02 6.5143936411888370e-02 1.3356763777998637e-02
|
||||
2 -2.2314835701632570e-02 -7.7524477122967728e-02 4.8999346575662309e-02
|
||||
3 -3.9043638693828556e-02 1.8727196361074283e-01 -5.0358906369839446e-02
|
||||
4 2.1555046910191538e-02 -9.6562479880345862e-03 -5.2220025740068080e-02
|
||||
5 5.5684458879600447e-02 1.4098102798381096e-01 3.6430504994586173e-02
|
||||
6 4.2104147709418713e-02 2.9055058600247489e-02 -8.0778112152718948e-03
|
||||
7 -6.4963866924303920e-02 9.0824824870264262e-02 -1.1492621439859574e-02
|
||||
8 -6.9888106386663568e-02 -6.1362238801327997e-02 4.5061669154972568e-02
|
||||
9 1.5493057273285156e-02 -5.6307006366398599e-02 -2.9234755420043165e-02
|
||||
10 -3.0006706586658188e-02 -1.4355133290296190e-01 -1.1246538976169368e-01
|
||||
11 -4.0156699765253455e-02 -5.1238883202820718e-02 4.2112202625462891e-02
|
||||
12 3.2215165580774301e-02 -8.8013396380619557e-02 -4.0047290710007333e-03
|
||||
13 -1.9322767417550984e-02 2.3711197649086194e-02 -4.6454058795633212e-02
|
||||
14 5.7508424194302507e-02 -1.5717730349026085e-02 6.8892268883266869e-02
|
||||
15 -3.1552192265302363e-02 3.2002449140037137e-02 -2.7508481800674743e-02
|
||||
16 1.0688955089657577e-01 -9.0842508916126788e-02 3.6418887829925486e-02
|
||||
17 4.4577236329712736e-02 1.3022532646095397e-01 -7.5825494000398793e-04
|
||||
18 -1.4789247023417521e-01 -3.4554869410601124e-02 -7.1472651306375229e-02
|
||||
19 -1.5516659799350990e-01 -8.1733259734237992e-02 3.6528023380248152e-02
|
||||
20 2.3565292501585497e-02 2.0131963706666492e-02 -3.4090460756558867e-02
|
||||
21 1.6266349958385409e-01 4.8905943278807026e-02 4.9357951969207243e-03
|
||||
22 3.9108463662172284e-03 -8.1159914942901146e-02 -1.0833213112554453e-02
|
||||
23 4.9862761614696910e-02 1.2418695431753196e-01 -7.7818580582703634e-02
|
||||
24 1.2773299190190621e-01 9.4426552636226180e-02 8.4500013220674824e-02
|
||||
25 7.0366190135544543e-02 4.4772942266913711e-03 -4.6793931216364631e-02
|
||||
26 -5.0367407305875939e-02 -1.4928033291926532e-01 1.2849353197675831e-01
|
||||
27 4.6468146723438429e-02 -4.1892634838488693e-03 -1.3380548635599163e-03
|
||||
28 1.1447706368862415e-02 5.8175438626723523e-02 7.3359635688296038e-02
|
||||
29 4.7807434863290775e-02 1.0732112842460283e-01 -1.9886348252873588e-03
|
||||
30 -4.2515720470887731e-02 -2.9914625470396135e-02 -8.4056579797267661e-02
|
||||
31 -2.1956047762899965e-02 -1.1661348485300055e-01 7.4709459326432123e-02
|
||||
32 -1.9494431829672756e-01 -6.5181487099745139e-02 -2.2830961616444944e-02
|
||||
...
|
|
@ -0,0 +1,91 @@
|
|||
---
|
||||
lammps_version: 2 Jun 2020
|
||||
date_generated: Tue Jun 2 16:45:40 202
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
pair table
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.metal
|
||||
pair_style: table lookup 10000
|
||||
pair_coeff: ! |
|
||||
1 1 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
1 2 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
2 2 ${input_dir}/pair_table_beck.txt beck_2_2
|
||||
extract: ! ""
|
||||
natoms: 32
|
||||
init_vdwl: 1.66822081098814
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
6.1925708391090373e+00 6.0607873158796632e+00 5.8866502515961283e+00 2.0635047994864009e-01 -2.2304749096038870e-02 -8.9977381381968910e-02
|
||||
init_forces: ! |2
|
||||
1 1.3652870615947011e-02 6.5292578314726832e-02 1.4401786849082793e-02
|
||||
2 -2.2075986500789631e-02 -7.7530344175629484e-02 4.8918295738716797e-02
|
||||
3 -3.8548065982306853e-02 1.9049129535293563e-01 -4.8497042796395010e-02
|
||||
4 2.0883993795891603e-02 -9.8004460881346168e-03 -5.2544284235507610e-02
|
||||
5 5.6473535558532267e-02 1.4259381967545881e-01 3.5283580728998398e-02
|
||||
6 4.1436803654676703e-02 2.9757415671595559e-02 -6.9441568265177812e-03
|
||||
7 -6.4342009716857218e-02 8.9407090045572943e-02 -1.0076354375758356e-02
|
||||
8 -6.8438588566627351e-02 -6.0719143235589357e-02 4.4375134570496459e-02
|
||||
9 1.4267631647248345e-02 -5.5225493516036783e-02 -2.8235579582748780e-02
|
||||
10 -3.2874735468490235e-02 -1.4496018410464423e-01 -1.1522122672190530e-01
|
||||
11 -4.0439244564162688e-02 -5.0797057909291822e-02 4.2990522799705479e-02
|
||||
12 3.1118238818285009e-02 -8.8117800460577142e-02 -4.0963549347812021e-03
|
||||
13 -1.8421701898180837e-02 2.4603479320682679e-02 -4.6953330610188748e-02
|
||||
14 5.6779946032995847e-02 -1.8997405137617097e-02 7.0084749782857475e-02
|
||||
15 -3.1872432338948091e-02 3.1520110382368773e-02 -2.8177989701802592e-02
|
||||
16 1.1013395678084995e-01 -9.1707318824236786e-02 3.7083770573599802e-02
|
||||
17 4.3975078896704253e-02 1.3054106752514974e-01 -1.5760211066586478e-03
|
||||
18 -1.4753246799540981e-01 -3.5398540009504140e-02 -7.0784984645480470e-02
|
||||
19 -1.5562703896771166e-01 -8.1533158870799177e-02 3.7998367628389429e-02
|
||||
20 2.4120555351187806e-02 1.9895957059386932e-02 -3.4031571261011077e-02
|
||||
21 1.6241181372756625e-01 5.0567395846590979e-02 4.0311135803611352e-03
|
||||
22 3.0847862699784918e-03 -8.2082703890837161e-02 -1.1813933267531539e-02
|
||||
23 4.6631319964723403e-02 1.2294704911631910e-01 -8.0759997950587623e-02
|
||||
24 1.2784615418643658e-01 9.4570579283427048e-02 8.4136049252381967e-02
|
||||
25 6.9854637188683621e-02 4.3796329364953045e-03 -4.6383679169275639e-02
|
||||
26 -5.1672371161515490e-02 -1.5093773642419464e-01 1.2890155107784523e-01
|
||||
27 4.6418514479134469e-02 -4.8647715941130543e-03 -3.3400893593061448e-04
|
||||
28 1.0837875140475392e-02 5.7768778789330170e-02 7.3335429938361563e-02
|
||||
29 4.8424486534314935e-02 1.0705191088477574e-01 -3.4221430692390835e-03
|
||||
30 -4.2678491461167409e-02 -3.0167096740169222e-02 -8.4323491798094938e-02
|
||||
31 -2.0446963122925290e-02 -1.1577119295225209e-01 7.4834425292344492e-02
|
||||
32 -1.9338210089853922e-01 -6.2777766271189708e-02 -2.2198626823726184e-02
|
||||
run_vdwl: 1.66790120138923
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
6.1954399052539300e+00 6.0597796933663810e+00 5.8839846490596770e+00 2.0464958122047128e-01 -2.2990948428733799e-02 -9.0561388880444543e-02
|
||||
run_forces: ! |2
|
||||
1 1.0357196419898495e-02 6.5372257333873959e-02 1.3514409758410917e-02
|
||||
2 -2.2518946587964585e-02 -7.7700478129363010e-02 4.8980708027650338e-02
|
||||
3 -3.9187350884245992e-02 1.8746598368586515e-01 -5.0095509280450985e-02
|
||||
4 2.1505122391926864e-02 -9.8121998835355474e-03 -5.2197325168546041e-02
|
||||
5 5.6368397082486393e-02 1.4115837375527868e-01 3.6749677569935905e-02
|
||||
6 4.2042380520510882e-02 2.9049092654418140e-02 -8.0059207630978693e-03
|
||||
7 -6.5262053410956963e-02 9.1189712395790753e-02 -1.1162106417995799e-02
|
||||
8 -6.9823982763573419e-02 -6.1642359327017858e-02 4.5148186601411129e-02
|
||||
9 1.5581717631005403e-02 -5.6464988109373171e-02 -2.9179373549110328e-02
|
||||
10 -2.9936010364121191e-02 -1.4403347574591194e-01 -1.1249323547874966e-01
|
||||
11 -4.0279718641423851e-02 -5.1267663186455890e-02 4.2308426648069226e-02
|
||||
12 3.2548290765190446e-02 -8.8360090934889973e-02 -4.1059424850670304e-03
|
||||
13 -1.9100876563736404e-02 2.3923943182546592e-02 -4.6654992572323889e-02
|
||||
14 5.7003886104469645e-02 -1.5977942426948746e-02 6.9080947733147463e-02
|
||||
15 -3.1419200863690128e-02 3.2134894708585104e-02 -2.7460582419399034e-02
|
||||
16 1.0678077169426231e-01 -9.0718758218836820e-02 3.6086450730476470e-02
|
||||
17 4.4432206292973897e-02 1.3053785119638170e-01 -8.8349832217821166e-04
|
||||
18 -1.4847693210486995e-01 -3.4770804844180284e-02 -7.1598050906370336e-02
|
||||
19 -1.5584406172770648e-01 -8.1902850262455335e-02 3.6401901739187829e-02
|
||||
20 2.3632828687886766e-02 2.0210640568054113e-02 -3.3962375402201296e-02
|
||||
21 1.6251200328353549e-01 4.8509762572667509e-02 4.6262805117567836e-03
|
||||
22 3.9297251786593766e-03 -8.1271664355599668e-02 -1.0814196256901271e-02
|
||||
23 4.9681279655079395e-02 1.2435597457773782e-01 -7.8146336899556537e-02
|
||||
24 1.2830345267622284e-01 9.4849763681645619e-02 8.4755594763442382e-02
|
||||
25 7.0574066259719931e-02 4.7738855789510749e-03 -4.6746928071330643e-02
|
||||
26 -5.0012323977413009e-02 -1.4919205052782003e-01 1.2835423785227032e-01
|
||||
27 4.6693855278230161e-02 -4.3926905018267671e-03 -1.5097765818073844e-03
|
||||
28 1.1103730609808571e-02 5.8020761280684265e-02 7.3177666578219974e-02
|
||||
29 4.8063412527103180e-02 1.0769074559895483e-01 -1.8637969627234715e-03
|
||||
30 -4.2307197338881525e-02 -2.9602719505751475e-02 -8.4192072289735478e-02
|
||||
31 -2.2008710097816863e-02 -1.1651727431063712e-01 7.4819836125210509e-02
|
||||
32 -1.9493695773256986e-01 -6.5615632500831411e-02 -2.2932304811643992e-02
|
||||
...
|
|
@ -0,0 +1,91 @@
|
|||
---
|
||||
lammps_version: 2 Jun 2020
|
||||
date_generated: Tue Jun 2 16:47:29 202
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
pair table
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.metal
|
||||
pair_style: table spline 10000
|
||||
pair_coeff: ! |
|
||||
1 1 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
1 2 ${input_dir}/pair_table_beck.txt beck_1_1
|
||||
2 2 ${input_dir}/pair_table_beck.txt beck_2_2
|
||||
extract: ! ""
|
||||
natoms: 32
|
||||
init_vdwl: 1.66849237317226
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
6.1946491697735437e+00 6.0610401365658024e+00 5.8874025724620429e+00 2.0726580316940962e-01 -2.1210361695457737e-02 -8.9415208770840096e-02
|
||||
init_forces: ! |2
|
||||
1 1.3461900166603218e-02 6.5533756921056424e-02 1.4237872357245411e-02
|
||||
2 -2.2001295274018444e-02 -7.7577892895343906e-02 4.8895379860549121e-02
|
||||
3 -3.8355321598214184e-02 1.8998901399717005e-01 -4.8534413942792565e-02
|
||||
4 2.0908396793481509e-02 -9.9066117521727070e-03 -5.2618403012712124e-02
|
||||
5 5.6008413316644114e-02 1.4266663667152152e-01 3.5487859843299545e-02
|
||||
6 4.1552391358114872e-02 2.9642295673519448e-02 -6.9640527234652461e-03
|
||||
7 -6.4155546133542837e-02 8.9301753561023003e-02 -1.0225594515349757e-02
|
||||
8 -6.8587453028246703e-02 -6.0829070542048190e-02 4.4680193619080481e-02
|
||||
9 1.4366068063822880e-02 -5.5192738935146854e-02 -2.8199665411938767e-02
|
||||
10 -3.2697019980711756e-02 -1.4472840813665638e-01 -1.1516072254520793e-01
|
||||
11 -4.0401272804121854e-02 -5.0402863668631913e-02 4.2969197904076183e-02
|
||||
12 3.0908680631425673e-02 -8.8120244487072494e-02 -3.9791730686956463e-03
|
||||
13 -1.8590573588915013e-02 2.4570208722629043e-02 -4.7073683697064536e-02
|
||||
14 5.6668374919472228e-02 -1.8707913260279440e-02 7.0129358194749039e-02
|
||||
15 -3.1927219149443416e-02 3.1638287874549260e-02 -2.8162304610562044e-02
|
||||
16 1.1004228625210850e-01 -9.1784876878925489e-02 3.7455203664712555e-02
|
||||
17 4.3874110434413707e-02 1.3058123184332987e-01 -1.6078470938548138e-03
|
||||
18 -1.4775126775856298e-01 -3.5651201719208082e-02 -7.0713629953624360e-02
|
||||
19 -1.5579381073821677e-01 -8.1556836647145553e-02 3.7492096227633373e-02
|
||||
20 2.4262149455103726e-02 1.9762082500828778e-02 -3.4093995317030654e-02
|
||||
21 1.6276229493138114e-01 5.0791551859706734e-02 4.3245301958938116e-03
|
||||
22 2.9902891288209246e-03 -8.1966958449035843e-02 -1.1772410092696793e-02
|
||||
23 4.6987757268038249e-02 1.2308546657800162e-01 -8.0566592682958557e-02
|
||||
24 1.2795842291296708e-01 9.4726040785926641e-02 8.3748524809472952e-02
|
||||
25 6.9925310941154381e-02 4.2197730528178625e-03 -4.6744097166442150e-02
|
||||
26 -5.1856965388326640e-02 -1.5105237092347160e-01 1.2862892445018109e-01
|
||||
27 4.6163842732722504e-02 -4.7145326827103505e-03 -2.0770802868259192e-04
|
||||
28 1.1137379858917107e-02 5.7570783215990615e-02 7.3702487792676769e-02
|
||||
29 4.8892657028303636e-02 1.0734409425986763e-01 -3.2134995127967849e-03
|
||||
30 -4.2587398133307960e-02 -3.0047443784418228e-02 -8.4420705386072381e-02
|
||||
31 -2.0646215207926085e-02 -1.1590108886476506e-01 7.4785520470549566e-02
|
||||
32 -1.9351936740994052e-01 -6.3281923890906297e-02 -2.2278650628172247e-02
|
||||
run_vdwl: 1.667273130413
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
6.1925535687585693e+00 6.0572952105271769e+00 5.8826298841000604e+00 2.0544338949977917e-01 -2.2313078114848450e-02 -9.0766976514897041e-02
|
||||
run_forces: ! |2
|
||||
1 1.0239633061502058e-02 6.5143827221595174e-02 1.3356826587515483e-02
|
||||
2 -2.2314719792140746e-02 -7.7524048417887792e-02 4.8999119168703323e-02
|
||||
3 -3.9043356307568236e-02 1.8727112901323323e-01 -5.0358319574288206e-02
|
||||
4 2.1555031522153656e-02 -9.6560578347078038e-03 -5.2219714561247452e-02
|
||||
5 5.5684799810960112e-02 1.4098076857747269e-01 3.6430385068854737e-02
|
||||
6 4.2103921190025241e-02 2.9054969033758940e-02 -8.0777612807259296e-03
|
||||
7 -6.4964007703587665e-02 9.0824767825338215e-02 -1.1492723720965943e-02
|
||||
8 -6.9887912879430303e-02 -6.1361831723537673e-02 4.5061147281770325e-02
|
||||
9 1.5493100733112084e-02 -5.6306897360260899e-02 -2.9234346339233039e-02
|
||||
10 -3.0007119234870205e-02 -1.4355108819988596e-01 -1.1246502096182201e-01
|
||||
11 -4.0156584042997157e-02 -5.1238608709860869e-02 4.2111943089822509e-02
|
||||
12 3.2215137999640264e-02 -8.8013573068877235e-02 -4.0049314316609446e-03
|
||||
13 -1.9322692643690253e-02 2.3710729865779583e-02 -4.6453771618837091e-02
|
||||
14 5.7508119522746703e-02 -1.5717550954823703e-02 6.8891636524075137e-02
|
||||
15 -3.1551853579254628e-02 3.2002270904692251e-02 -2.7508263221790400e-02
|
||||
16 1.0688913506500985e-01 -9.0842063672437995e-02 3.6419114766505958e-02
|
||||
17 4.4576981599750799e-02 1.3022472720372444e-01 -7.5802573483000615e-04
|
||||
18 -1.4789239369554841e-01 -3.4554795916705260e-02 -7.1472573328781749e-02
|
||||
19 -1.5516657008010420e-01 -8.1733453599869749e-02 3.6527707427395764e-02
|
||||
20 2.3565108550513952e-02 2.0131835710028016e-02 -3.4090223278000355e-02
|
||||
21 1.6266310434046480e-01 4.8905845083266029e-02 4.9357148091662226e-03
|
||||
22 3.9108125555495730e-03 -8.1159764595007206e-02 -1.0833146565530810e-02
|
||||
23 4.9862133358188218e-02 1.2418637371342198e-01 -7.7818397024808514e-02
|
||||
24 1.2773306535829987e-01 9.4426378198700950e-02 8.4499926668801975e-02
|
||||
25 7.0365780658878857e-02 4.4772437288752168e-03 -4.6793953502009267e-02
|
||||
26 -5.0367468278612715e-02 -1.4927976307827082e-01 1.2849283634143213e-01
|
||||
27 4.6468158385616867e-02 -4.1893770730035470e-03 -1.3381218640924168e-03
|
||||
28 1.1447647509745237e-02 5.8175457185785213e-02 7.3359279966104529e-02
|
||||
29 4.7807504512594315e-02 1.0732100993527130e-01 -1.9887010850049803e-03
|
||||
30 -4.2515398596597830e-02 -2.9914524234883048e-02 -8.4055979568242525e-02
|
||||
31 -2.1955840630845491e-02 -1.1661294434426502e-01 7.4709133379083956e-02
|
||||
32 -1.9494325826950429e-01 -6.5180990416658327e-02 -2.2830796417360581e-02
|
||||
...
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sat May 30 17:49:16 202
|
||||
epsilon: 2.5e-13
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
bond gromos
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sat May 30 17:49:16 202
|
||||
epsilon: 2.5e-13
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
bond nonlinear
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sun May 31 08:39:49 202
|
||||
epsilon: 5e-14
|
||||
epsilon: 1e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
pair coul/cut
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sun May 31 08:50:20 202
|
||||
epsilon: 1e-13
|
||||
epsilon: 2e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
pair coul/dsf
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sun May 31 09:23:33 202
|
||||
epsilon: 1e-13
|
||||
epsilon: 5e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
pair coul/wolf
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
lammps_version: 5 May 2020
|
||||
date_generated: Sun May 31 07:05:48 202
|
||||
epsilon: 5e-14
|
||||
epsilon: 2e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
pair lj/charmm/coul/charmm/implicit
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
---
|
||||
lammps_version: 2 Jun 2020
|
||||
date_generated: Tue Jun 2 17:07:52 202
|
||||
epsilon: 5e-14
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
pair table
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.fourmol
|
||||
pair_style: table linear 1000
|
||||
pair_coeff: ! |
|
||||
1 1 ${input_dir}/pair_table_lj_cut.txt lj_1_1
|
||||
1 2 ${input_dir}/pair_table_lj_cut.txt lj_1_2
|
||||
1 3 ${input_dir}/pair_table_lj_cut.txt lj_1_3
|
||||
1 4 ${input_dir}/pair_table_lj_cut.txt lj_1_4
|
||||
1 5 ${input_dir}/pair_table_lj_cut.txt lj_1_5
|
||||
2 2 ${input_dir}/pair_table_lj_cut.txt lj_2_2
|
||||
2 3 ${input_dir}/pair_table_lj_cut.txt lj_2_3
|
||||
2 4 ${input_dir}/pair_table_lj_cut.txt lj_2_4
|
||||
2 5 ${input_dir}/pair_table_lj_cut.txt lj_2_5
|
||||
3 3 ${input_dir}/pair_table_lj_cut.txt lj_3_3
|
||||
3 4 ${input_dir}/pair_table_lj_cut.txt lj_3_4
|
||||
3 5 ${input_dir}/pair_table_lj_cut.txt lj_3_5
|
||||
4 4 ${input_dir}/pair_table_lj_cut.txt lj_4_4
|
||||
4 5 ${input_dir}/pair_table_lj_cut.txt lj_4_5
|
||||
5 5 ${input_dir}/pair_table_lj_cut.txt lj_5_5
|
||||
extract: ! ""
|
||||
natoms: 29
|
||||
init_vdwl: 756.641645798358
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
2.2090340377185967e+03 2.2244453255747117e+03 4.7288126624664974e+03 -7.6403326905269398e+02 2.8082113929050504e+01 6.7633740837364439e+02
|
||||
init_forces: ! |2
|
||||
21 -7.4152834115258486e+01 -8.4097799952580075e+01 2.3159619440133380e+02
|
||||
22 -1.1068613517882235e+02 -2.6823333923316500e+01 -1.7365467444566553e+02
|
||||
23 1.8482904133388223e+02 1.1093264541659750e+02 -5.7930741636712071e+01
|
||||
19 3.1933948922635905e-04 -2.3852967242197055e-04 1.7434557181616340e-03
|
||||
18 -1.8861300062111192e-02 -3.3400052294502179e-02 3.0998859026254152e-02
|
||||
20 -9.9899500683441750e-04 -1.0223083257768326e-03 3.6965867058990032e-04
|
||||
28 -1.8537423924296499e+02 7.9666126830459447e+01 -1.2542634211727822e+02
|
||||
4 -7.9160281367275722e+00 2.1475153087741110e+00 -5.6273386055724828e+00
|
||||
10 5.3659703631942352e+02 -6.1638821121220133e+02 -1.8524754345847680e+02
|
||||
11 -2.3998246191028687e+00 -6.0237447250432350e+00 -9.8493429965792298e+00
|
||||
12 1.7521141359856628e+01 1.0629841850210417e+01 -7.9312291032117042e+00
|
||||
14 -3.4254573458881881e+00 6.9454087271157916e-01 -8.8549490264531219e+00
|
||||
3 -1.3601366655597215e+02 -3.8933969547126463e+02 -1.4673165295081574e+02
|
||||
6 -8.3976623131970030e+02 9.7421656440040920e+02 1.1689035557011593e+03
|
||||
7 5.9087836043818115e+01 -3.4067040950997404e+02 -1.7408617984623156e+03
|
||||
15 -2.0812424842265748e-01 8.6236045287663003e+00 3.0626696691420956e+00
|
||||
8 1.4404606696350953e+02 -1.1101530899074169e+02 3.9802209126866262e+02
|
||||
9 8.1112222258717168e+01 8.7379022925008144e+01 3.5897466875849778e+02
|
||||
16 4.6872469487658930e+02 -3.3472142759962014e+02 -1.2036108146826032e+03
|
||||
17 -4.5876131348491481e+02 3.1932075524331395e+02 1.2202196485462191e+03
|
||||
5 -2.5605507618514016e+00 -4.1184521759347588e+00 1.2369824594500452e+01
|
||||
13 8.2458457495438626e+00 -3.2680411194697614e+00 -1.5173080370124606e-01
|
||||
2 1.5875070222736517e+02 1.3063288077538610e+02 -1.8684429323195315e+02
|
||||
1 -2.3000580006052314e+01 2.7192815329191200e+02 3.3414196848607327e+02
|
||||
27 5.3953257632741014e+01 -2.3246330657484364e+02 9.3521822143445291e+01
|
||||
29 1.3142887167232908e+02 1.5280375224826219e+02 3.1900088976429561e+01
|
||||
24 3.6069363323679390e+01 -2.1770366344996296e+02 1.1410578468006614e+02
|
||||
25 -1.5123846858732526e+02 2.4345575024648110e+01 -1.2714600914378309e+02
|
||||
26 1.1515691479712817e+02 1.9334707687878640e+02 1.3017031466176082e+01
|
||||
run_vdwl: 146.327829985032
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
6.2914745307898283e+02 6.7439990734333583e+02 4.8382994180885322e+02 -3.2311602844067630e+02 -2.9168790037089135e+01 1.2280146536160866e+02
|
||||
run_forces: ! |2
|
||||
21 -9.8223704263420135e+00 -1.1937831142654984e+01 3.8747486275879332e+01
|
||||
22 -1.8260879394786041e+01 -4.4231132834754163e+00 -2.9364817699370402e+01
|
||||
23 2.8071936064676528e+01 1.6373759184425133e+01 -9.3702350107338450e+00
|
||||
19 2.5604832046069535e-04 -2.4189898030892005e-04 1.6743691237745819e-03
|
||||
18 -1.8054106711718410e-02 -3.1568964918282955e-02 2.9599553823736552e-02
|
||||
20 -8.8390456832979493e-04 -9.1401459749508313e-04 3.6013486968785625e-04
|
||||
28 -2.5002749675394742e+01 1.1546639020795190e+01 -1.6860888288423549e+01
|
||||
4 -8.7521679338772564e+00 3.2350894298919783e+00 -6.3183019964749780e+00
|
||||
10 6.3968310015089294e+01 -7.5154164336910185e+01 -7.5921779563234097e+01
|
||||
11 -6.3974181801433527e+00 -8.2015044886741890e+00 -1.6623131445951760e+01
|
||||
12 1.4375970778558539e+01 1.2183815698169100e+01 -8.2849268567516905e+00
|
||||
14 -2.8220099744921270e+00 4.4312152330104282e-01 -7.1784838499077441e+00
|
||||
3 -2.5170415829369691e+02 1.0807957243252388e+02 8.7902068634117185e+01
|
||||
6 1.2021318256369948e+02 -1.0159989935597440e+02 -1.4455046866801038e+02
|
||||
7 3.7064970613492512e+00 -1.0481522858827926e+01 -4.1617502928655071e+01
|
||||
15 -4.0482676064288375e-01 8.2478176580999758e+00 3.1232194954592902e+00
|
||||
8 -1.9012552812922401e+01 1.9341369900133493e+01 5.6061660162509632e+01
|
||||
9 1.1002966844626583e+01 1.2955046425976752e+01 4.8964009756379951e+01
|
||||
16 5.3215666467083004e+01 -6.8452018298715132e+01 1.6067414590921679e+01
|
||||
17 -1.4543993736556850e+01 9.9518135650728148e+00 4.0557829246754260e+01
|
||||
5 -1.7372909950509312e+00 -2.5663073053399832e+00 1.0327280945285382e+01
|
||||
13 7.4327969687776196e+00 -2.8316539598264616e+00 -1.0441307986265116e-01
|
||||
2 1.8402173670762625e+01 1.3899059683375182e+01 -2.2581973215530972e+01
|
||||
1 1.3092386727121557e+01 8.0975258006863527e+01 6.0162717183582615e+01
|
||||
27 3.0641658609965634e+00 -3.8727506359895912e+01 1.1409481341404170e+01
|
||||
29 2.1946401102557179e+01 2.7187485766660277e+01 5.4471747925943950e+00
|
||||
24 1.2590957134158188e+01 -3.6189602254037929e+01 2.3845923499083668e+01
|
||||
25 -3.0061118850595161e+01 5.3993721695176697e+00 -2.5809444960387523e+01
|
||||
26 1.7456807738003775e+01 3.0778628058022715e+01 1.9384675815059120e+00
|
||||
...
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,16 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "lammps.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue