Revert to previous code without plug-in interface
This commit is contained in:
@ -38,14 +38,21 @@
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
|
||||
#include "KIM_LAMMPS_PlugIn.h"
|
||||
// includes from KIM
|
||||
#include "KIM_API.h"
|
||||
#include "KIM_API_status.h"
|
||||
|
||||
#ifndef KIM_API_VERSION_MAJOR
|
||||
// support v1.5.0
|
||||
#define KIM_API_VERSION_MAJOR 1
|
||||
#define KIM_API_VERSION_MINOR 5
|
||||
#define KIM_API_VERSION_PATCH 0
|
||||
#endif
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void * (*PairKIM::kim_get_sim_buffer)(void *, int *);
|
||||
|
||||
PairKIM::PairKIM(LAMMPS *lmp) :
|
||||
Pair(lmp),
|
||||
settings_call_count(0),
|
||||
@ -55,7 +62,6 @@ PairKIM::PairKIM(LAMMPS *lmp) :
|
||||
lmps_unique_elements(0),
|
||||
lmps_num_unique_elements(0),
|
||||
lmps_units(METAL),
|
||||
kim(new KIM_LAMMPS_PlugIn),
|
||||
pkim(0),
|
||||
kim_ind_coordinates(-1),
|
||||
kim_ind_numberOfParticles(-1),
|
||||
@ -98,42 +104,35 @@ PairKIM::PairKIM(LAMMPS *lmp) :
|
||||
|
||||
PairKIM::~PairKIM()
|
||||
{
|
||||
if (kim->library != NULL)
|
||||
{
|
||||
// clean up kim_modelname
|
||||
if (kim_modelname != 0) delete [] kim_modelname;
|
||||
// clean up kim_modelname
|
||||
if (kim_modelname != 0) delete [] kim_modelname;
|
||||
|
||||
// clean up lammps atom species number to unique particle names mapping
|
||||
if (lmps_unique_elements)
|
||||
// clean up lammps atom species number to unique particle names mapping
|
||||
if (lmps_unique_elements)
|
||||
for (int i = 0; i < lmps_num_unique_elements; i++)
|
||||
delete [] lmps_unique_elements[i];
|
||||
delete [] lmps_unique_elements;
|
||||
delete [] lmps_unique_elements;
|
||||
|
||||
// clean up local memory used to support KIM interface
|
||||
memory->destroy(kim_particleSpecies);
|
||||
memory->destroy(lmps_force_tmp);
|
||||
memory->destroy(lmps_stripped_neigh_list);
|
||||
// clean up local memory used to support KIM interface
|
||||
memory->destroy(kim_particleSpecies);
|
||||
memory->destroy(lmps_force_tmp);
|
||||
memory->destroy(lmps_stripped_neigh_list);
|
||||
|
||||
// clean up allocated memory for standard Pair class usage
|
||||
// also, we allocate lmps_map_species_to_uniuqe in the allocate() function
|
||||
if (allocated) {
|
||||
// clean up allocated memory for standard Pair class usage
|
||||
// also, we allocate lmps_map_species_to_uniuqe in the allocate() function
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
delete [] lmps_map_species_to_unique;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up Rij array
|
||||
memory->destroy(Rij);
|
||||
// clean up Rij array
|
||||
memory->destroy(Rij);
|
||||
|
||||
// clean up KIM interface (if necessary)
|
||||
kim_free();
|
||||
// clean up KIM interface (if necessary)
|
||||
kim_free();
|
||||
|
||||
dlclose(kim->library);
|
||||
}
|
||||
|
||||
delete kim;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -179,17 +178,17 @@ void PairKIM::compute(int eflag , int vflag)
|
||||
// pass current atom pointers to KIM
|
||||
set_volatiles();
|
||||
|
||||
kim->setm_compute_by_index(pkim, &kimerror,3*3,
|
||||
kim_ind_particleEnergy, eflag_atom,
|
||||
(int) kim_model_has_particleEnergy,
|
||||
kim_ind_particleVirial, vflag_atom,
|
||||
(int) kim_model_has_particleVirial,
|
||||
kim_ind_virial, vflag_global!=0,
|
||||
no_virial_fdotr_compute);
|
||||
pkim->setm_compute_by_index(&kimerror,3*3,
|
||||
kim_ind_particleEnergy, eflag_atom,
|
||||
(int) kim_model_has_particleEnergy,
|
||||
kim_ind_particleVirial, vflag_atom,
|
||||
(int) kim_model_has_particleVirial,
|
||||
kim_ind_virial, vflag_global!=0,
|
||||
no_virial_fdotr_compute);
|
||||
kim_error(__LINE__,"setm_compute_by_index",kimerror);
|
||||
|
||||
// compute via KIM model
|
||||
kimerror = kim->model_compute(pkim);
|
||||
kimerror = pkim->model_compute();
|
||||
kim_error(__LINE__,"PairKIM::pkim->model_compute() error",kimerror);
|
||||
// assemble force and particleVirial if needed
|
||||
if (!lmps_using_newton) comm->reverse_comm_pair(this);
|
||||
@ -265,10 +264,6 @@ void PairKIM::settings(int narg, char **arg)
|
||||
{
|
||||
// This is called when "pair_style kim ..." is read from input
|
||||
// may be called multiple times
|
||||
|
||||
kim->setup_kim_api_library(error); // exits on failure
|
||||
kim_get_sim_buffer = kim->get_sim_buffer;
|
||||
|
||||
++settings_call_count;
|
||||
init_style_call_count = 0;
|
||||
|
||||
@ -418,7 +413,7 @@ void PairKIM::init_style()
|
||||
if (!kim_init_ok)
|
||||
{
|
||||
kim_init();
|
||||
kimerror = kim->model_init(pkim);
|
||||
kimerror = pkim->model_init();
|
||||
if (kimerror != KIM_STATUS_OK)
|
||||
kim_error(__LINE__, "KIM API:model_init() failed", kimerror);
|
||||
else
|
||||
@ -490,7 +485,7 @@ void PairKIM::reinit()
|
||||
|
||||
// Then reinit KIM model
|
||||
int kimerror;
|
||||
kimerror = kim->model_reinit(pkim);
|
||||
kimerror = pkim->model_reinit();
|
||||
kim_error(__LINE__,"model_reinit unsuccessful", kimerror);
|
||||
}
|
||||
|
||||
@ -632,7 +627,7 @@ double PairKIM::memory_usage()
|
||||
void PairKIM::kim_error(int ln, const char* msg, int errcode)
|
||||
{
|
||||
if (errcode == KIM_STATUS_OK) return;
|
||||
kim->report_error(ln,(char *) __FILE__, (char *) msg,errcode);
|
||||
KIM_API_model::report_error(ln,(char *) __FILE__, (char *) msg,errcode);
|
||||
error->all(__FILE__,ln,"Internal KIM error");
|
||||
|
||||
return;
|
||||
@ -643,10 +638,10 @@ void PairKIM::kim_error(int ln, const char* msg, int errcode)
|
||||
int PairKIM::get_neigh(void **kimmdl,int *mode,int *request,
|
||||
int *atom, int *numnei, int **nei1atom, double **pRij)
|
||||
{
|
||||
void * pkim = *kimmdl;
|
||||
KIM_API_model *pkim = (KIM_API_model *) *kimmdl;
|
||||
|
||||
int kimerror;
|
||||
PairKIM *self = (PairKIM *) kim_get_sim_buffer(pkim, &kimerror);
|
||||
PairKIM *self = (PairKIM *) pkim->get_sim_buffer(&kimerror);
|
||||
|
||||
if (self->kim_model_using_Rij) {
|
||||
*pRij = &(self->Rij[0]);
|
||||
@ -697,8 +692,8 @@ int PairKIM::get_neigh(void **kimmdl,int *mode,int *request,
|
||||
// set Rij if needed
|
||||
if (self->kim_model_using_Rij) {
|
||||
double* x = (double *)
|
||||
self->kim->get_data_by_index(pkim, self->kim_ind_coordinates,
|
||||
&kimerror);
|
||||
(*pkim).get_data_by_index(self->kim_ind_coordinates,
|
||||
&kimerror);
|
||||
for (jj=0; jj < *numnei; jj++) {
|
||||
int i = *atom;
|
||||
j = (*nei1atom)[jj];
|
||||
@ -745,8 +740,7 @@ int PairKIM::get_neigh(void **kimmdl,int *mode,int *request,
|
||||
// set Rij if needed
|
||||
if (self->kim_model_using_Rij){
|
||||
double* x = (double *)
|
||||
self->kim->get_data_by_index(pkim, self->kim_ind_coordinates,
|
||||
&kimerror);
|
||||
(*pkim).get_data_by_index(self->kim_ind_coordinates, &kimerror);
|
||||
for(int jj=0; jj < *numnei; jj++){
|
||||
int i = *atom;
|
||||
int j = (*nei1atom)[jj];
|
||||
@ -777,16 +771,17 @@ void PairKIM::kim_free()
|
||||
|
||||
if (kim_model_init_ok)
|
||||
{
|
||||
kimerror = kim->model_destroy(pkim);
|
||||
kimerror = pkim->model_destroy();
|
||||
kim_model_init_ok = false;
|
||||
}
|
||||
if (kim_init_ok)
|
||||
{
|
||||
kim->free(&pkim, &kimerror);
|
||||
pkim->free(&kimerror);
|
||||
kim_init_ok = false;
|
||||
}
|
||||
if (pkim != 0)
|
||||
{
|
||||
delete pkim;
|
||||
pkim = 0;
|
||||
}
|
||||
if (kim_particle_codes_ok)
|
||||
@ -821,7 +816,8 @@ void PairKIM::kim_init()
|
||||
}
|
||||
|
||||
// initialize KIM model
|
||||
kimerror = kim->string_init(&pkim, test_descriptor_string, kim_modelname);
|
||||
pkim = new KIM_API_model();
|
||||
kimerror = pkim->string_init(test_descriptor_string, kim_modelname);
|
||||
if (kimerror != KIM_STATUS_OK)
|
||||
kim_error(__LINE__,"KIM initialization failed", kimerror);
|
||||
else
|
||||
@ -834,10 +830,10 @@ void PairKIM::kim_init()
|
||||
// determine kim_model_using_* true/false values
|
||||
//
|
||||
// check for half or full list
|
||||
kim_model_using_half = kim->is_half_neighbors(pkim, &kimerror);
|
||||
kim_model_using_half = (pkim->is_half_neighbors(&kimerror));
|
||||
//
|
||||
const char* NBC_method;
|
||||
kimerror = kim->get_NBC_method(pkim, &NBC_method);
|
||||
kimerror = pkim->get_NBC_method(&NBC_method);
|
||||
kim_error(__LINE__,"NBC method not set",kimerror);
|
||||
// check for CLUSTER mode
|
||||
kim_model_using_cluster = (strcmp(NBC_method,"CLUSTER")==0);
|
||||
@ -846,18 +842,17 @@ void PairKIM::kim_init()
|
||||
(strcmp(NBC_method,"NEIGH_RVEC_F")==0));
|
||||
|
||||
// get correct index of each variable in kim_api object
|
||||
kim->getm_index(pkim, &kimerror, 3*15,
|
||||
pkim->getm_index(&kimerror, 3*13,
|
||||
"coordinates", &kim_ind_coordinates, 1,
|
||||
"cutoff", &kim_ind_cutoff, 1,
|
||||
"numberOfParticles", &kim_ind_numberOfParticles, 1,
|
||||
"numberParticleTypes", &kim_ind_numberOfSpecies,
|
||||
! kim->is_strictly_between_1_5_and_2_0,
|
||||
"particleTypes", &kim_ind_particleSpecies,
|
||||
! kim->is_strictly_between_1_5_and_2_0,
|
||||
"numberOfSpecies", &kim_ind_numberOfSpecies,
|
||||
kim->is_strictly_between_1_5_and_2_0,
|
||||
"particleSpecies", &kim_ind_particleSpecies,
|
||||
kim->is_strictly_between_1_5_and_2_0,
|
||||
#if KIM_API_VERSION_MAJOR == 1 && KIM_API_VERSON_MINOR == 5
|
||||
"numberParticleTypes", &kim_ind_numberOfSpecies, 1,
|
||||
"particleTypes", &kim_ind_particleSpecies, 1,
|
||||
#else
|
||||
"numberOfSpecies", &kim_ind_numberOfSpecies, 1,
|
||||
"particleSpecies", &kim_ind_particleSpecies, 1,
|
||||
#endif
|
||||
"numberContributingParticles", &kim_ind_numberContributingParticles,
|
||||
kim_model_using_half,
|
||||
"particleEnergy", &kim_ind_particleEnergy,
|
||||
@ -877,7 +872,7 @@ void PairKIM::kim_init()
|
||||
for(int i = 0; i < lmps_num_unique_elements; i++){
|
||||
int kimerror;
|
||||
kim_particle_codes[i]
|
||||
= kim->get_species_code(pkim, lmps_unique_elements[i], &kimerror);
|
||||
= pkim->get_species_code(lmps_unique_elements[i], &kimerror);
|
||||
kim_error(__LINE__, "create_kim_particle_codes: symbol not found ",
|
||||
kimerror);
|
||||
}
|
||||
@ -896,7 +891,7 @@ void PairKIM::set_statics()
|
||||
lmps_local_tot_num_atoms = (int) (atom->nghost + atom->nlocal);
|
||||
|
||||
int kimerror;
|
||||
kim->setm_data_by_index(pkim, &kimerror, 4*6,
|
||||
pkim->setm_data_by_index(&kimerror, 4*6,
|
||||
kim_ind_numberOfSpecies, 1, (void *) &(atom->ntypes), 1,
|
||||
kim_ind_cutoff, 1, (void *) &(kim_global_cutoff), 1,
|
||||
kim_ind_numberOfParticles, 1, (void *) &lmps_local_tot_num_atoms, 1,
|
||||
@ -907,12 +902,12 @@ void PairKIM::set_statics()
|
||||
kim_error(__LINE__, "setm_data_by_index", kimerror);
|
||||
if (!kim_model_using_cluster)
|
||||
{
|
||||
kimerror = kim->set_method_by_index(pkim, kim_ind_get_neigh, 1,
|
||||
(void (*)()) &get_neigh);
|
||||
kimerror = pkim->set_method_by_index(kim_ind_get_neigh, 1,
|
||||
(func_ptr) &get_neigh);
|
||||
kim_error(__LINE__, "set_method_by_index", kimerror);
|
||||
}
|
||||
|
||||
kim->set_sim_buffer(pkim, (void *)this, &kimerror);
|
||||
pkim->set_sim_buffer((void *)this, &kimerror);
|
||||
kim_error(__LINE__, "set_sim_buffer", kimerror);
|
||||
|
||||
return;
|
||||
@ -926,33 +921,33 @@ void PairKIM::set_volatiles()
|
||||
lmps_local_tot_num_atoms = (int) (atom->nghost + atom->nlocal);
|
||||
intptr_t nall = (intptr_t) lmps_local_tot_num_atoms;
|
||||
|
||||
kim->setm_data_by_index(pkim, &kimerror, 4*2,
|
||||
pkim->setm_data_by_index(&kimerror, 4*2,
|
||||
kim_ind_coordinates, 3*nall, (void*) &(atom->x[0][0]), 1,
|
||||
kim_ind_particleSpecies, nall, (void*) kim_particleSpecies, 1);
|
||||
kim_error(__LINE__, "setm_data_by_index", kimerror);
|
||||
|
||||
if (kim_model_has_particleEnergy && (eflag_atom == 1))
|
||||
{
|
||||
kimerror = kim->set_data_by_index(pkim, kim_ind_particleEnergy, nall,
|
||||
(void*) eatom);
|
||||
kimerror = pkim->set_data_by_index(kim_ind_particleEnergy, nall,
|
||||
(void*) eatom);
|
||||
kim_error(__LINE__, "set_data_by_index", kimerror);
|
||||
}
|
||||
|
||||
if (kim_model_has_particleVirial && (vflag_atom == 1))
|
||||
{
|
||||
kimerror = kim->set_data_by_index(pkim, kim_ind_particleVirial, 6*nall,
|
||||
(void*) &(vatom[0][0]));
|
||||
kimerror = pkim->set_data_by_index(kim_ind_particleVirial, 6*nall,
|
||||
(void*) &(vatom[0][0]));
|
||||
kim_error(__LINE__, "set_data_by_index", kimerror);
|
||||
}
|
||||
|
||||
if (kim_model_has_forces)
|
||||
{
|
||||
if (lmps_hybrid)
|
||||
kimerror = kim->set_data_by_index(pkim, kim_ind_forces, nall*3,
|
||||
(void*) &(lmps_force_tmp[0][0]));
|
||||
kimerror = pkim->set_data_by_index(kim_ind_forces, nall*3,
|
||||
(void*) &(lmps_force_tmp[0][0]));
|
||||
else
|
||||
kimerror = kim->set_data_by_index(pkim, kim_ind_forces, nall*3,
|
||||
(void*) &(atom->f[0][0]));
|
||||
kimerror = pkim->set_data_by_index(kim_ind_forces, nall*3,
|
||||
(void*) &(atom->f[0][0]));
|
||||
kim_error(__LINE__, "setm_data_by_index", kimerror);
|
||||
}
|
||||
|
||||
@ -965,17 +960,17 @@ void PairKIM::set_volatiles()
|
||||
if (kim_model_has_particleVirial)
|
||||
{
|
||||
if(vflag_atom != 1) {
|
||||
kim->set_compute_by_index(pkim, kim_ind_particleVirial,
|
||||
KIM_COMPUTE_FALSE, &kimerror);
|
||||
pkim->set_compute_by_index(kim_ind_particleVirial, KIM_COMPUTE_FALSE,
|
||||
&kimerror);
|
||||
} else {
|
||||
kim->set_compute_by_index(pkim, kim_ind_particleVirial,
|
||||
KIM_COMPUTE_TRUE, &kimerror);
|
||||
pkim->set_compute_by_index(kim_ind_particleVirial, KIM_COMPUTE_TRUE,
|
||||
&kimerror);
|
||||
}
|
||||
}
|
||||
|
||||
if (no_virial_fdotr_compute == 1)
|
||||
{
|
||||
kim->set_compute_by_index(pkim, kim_ind_virial,
|
||||
pkim->set_compute_by_index(kim_ind_virial,
|
||||
((vflag_global != 1) ? KIM_COMPUTE_FALSE : KIM_COMPUTE_TRUE),
|
||||
&kimerror);
|
||||
}
|
||||
@ -1033,37 +1028,39 @@ void PairKIM::set_lmps_flags()
|
||||
|
||||
void PairKIM::set_kim_model_has_flags()
|
||||
{
|
||||
KIM_API_model mdl;
|
||||
|
||||
int kimerror;
|
||||
|
||||
// get KIM API object representing the KIM Model only
|
||||
kimerror = kim->model_info(&pkim, kim_modelname);
|
||||
kimerror = mdl.model_info(kim_modelname);
|
||||
kim_error(__LINE__,"KIM initialization failed", kimerror);
|
||||
|
||||
// determine if the KIM Model can compute the total energy
|
||||
kim->get_index(pkim, (char*) "energy", &kimerror);
|
||||
mdl.get_index((char*) "energy", &kimerror);
|
||||
kim_model_has_energy = (kimerror == KIM_STATUS_OK);
|
||||
if (!kim_model_has_energy)
|
||||
error->warning(FLERR,"KIM Model does not provide `energy'; "
|
||||
"Potential energy will be zero");
|
||||
|
||||
// determine if the KIM Model can compute the forces
|
||||
kim->get_index(pkim, (char*) "forces", &kimerror);
|
||||
mdl.get_index((char*) "forces", &kimerror);
|
||||
kim_model_has_forces = (kimerror == KIM_STATUS_OK);
|
||||
if (!kim_model_has_forces)
|
||||
error->warning(FLERR,"KIM Model does not provide `forces'; "
|
||||
"Forces will be zero");
|
||||
|
||||
// determine if the KIM Model can compute the particleEnergy
|
||||
kim->get_index(pkim, (char*) "particleEnergy", &kimerror);
|
||||
mdl.get_index((char*) "particleEnergy", &kimerror);
|
||||
kim_model_has_particleEnergy = (kimerror == KIM_STATUS_OK);
|
||||
if (!kim_model_has_particleEnergy)
|
||||
error->warning(FLERR,"KIM Model does not provide `particleEnergy'; "
|
||||
"energy per atom will be zero");
|
||||
|
||||
// determine if the KIM Model can compute the particleVerial
|
||||
kim->get_index(pkim, (char*) "particleVirial", &kimerror);
|
||||
mdl.get_index((char*) "particleVirial", &kimerror);
|
||||
kim_model_has_particleVirial = (kimerror == KIM_STATUS_OK);
|
||||
kim->get_index(pkim, (char*) "process_dEdr", &kimerror);
|
||||
mdl.get_index((char*) "process_dEdr", &kimerror);
|
||||
kim_model_has_particleVirial = kim_model_has_particleVirial ||
|
||||
(kimerror == KIM_STATUS_OK);
|
||||
if (!kim_model_has_particleVirial)
|
||||
@ -1071,7 +1068,7 @@ void PairKIM::set_kim_model_has_flags()
|
||||
"virial per atom will be zero");
|
||||
|
||||
// tear down KIM API object
|
||||
kim->free(&pkim, &kimerror);
|
||||
mdl.free(&kimerror);
|
||||
// now destructor will do the remaining tear down for mdl
|
||||
|
||||
return;
|
||||
@ -1096,7 +1093,6 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
|
||||
"#\n"
|
||||
"# This file is automatically generated from LAMMPS pair_style "
|
||||
"kim command\n");
|
||||
char tmp_version[100];
|
||||
strcat(*test_descriptor_string,
|
||||
"\n"
|
||||
"# The call number is (pair_style).(init_style): ");
|
||||
@ -1105,13 +1101,11 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
|
||||
strcat(*test_descriptor_string, tmp_num);
|
||||
strcat(*test_descriptor_string,
|
||||
"#\n"
|
||||
"\n");
|
||||
|
||||
if (kim->is_strictly_between_1_5_and_2_0)
|
||||
strcat(*test_descriptor_string,
|
||||
"KIM_API_Version := 1.6.0\n\n");
|
||||
|
||||
strcat(*test_descriptor_string,
|
||||
"\n"
|
||||
#if KIM_API_VERSION_MAJOR == 1 && KIM_API_VERSION_MINOR == 5
|
||||
#else
|
||||
"KIM_API_Version := 1.6.0\n\n"
|
||||
#endif
|
||||
"# Base units\n");
|
||||
switch (lmps_units)
|
||||
{
|
||||
@ -1158,15 +1152,13 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
|
||||
}
|
||||
|
||||
// Write Supported species section
|
||||
if (kim->is_strictly_between_1_5_and_2_0)
|
||||
strcat(*test_descriptor_string,
|
||||
"\n"
|
||||
"PARTICLE_SPECIES:\n");
|
||||
else
|
||||
strcat(*test_descriptor_string,
|
||||
"\n"
|
||||
"SUPPORTED_ATOM/PARTICLES_TYPES:\n");
|
||||
strcat(*test_descriptor_string,
|
||||
"\n"
|
||||
#if KIM_API_VERSION_MAJOR == 1 && KIM_API_VERSON_MINOR == 5
|
||||
"SUPPORTED_ATOM/PARTICLES_TYPES:\n"
|
||||
#else
|
||||
"PARTICLE_SPECIES:\n"
|
||||
#endif
|
||||
"# Symbol/name Type code\n");
|
||||
int code=1;
|
||||
char* tmp_line = 0;
|
||||
@ -1199,7 +1191,7 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
|
||||
"NEIGH_PURE_F flag\n"
|
||||
"NEIGH_RVEC_H flag\n"
|
||||
"NEIGH_RVEC_F flag\n");
|
||||
|
||||
// @@ add code for MI_OPBC_? support ????
|
||||
if (lmps_support_cluster)
|
||||
{
|
||||
strcat(*test_descriptor_string,
|
||||
@ -1216,16 +1208,14 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
|
||||
"MODEL_INPUT:\n"
|
||||
"# Name Type Unit Shape\n"
|
||||
"numberOfParticles integer none []\n"
|
||||
"numberContributingParticles integer none []\n");
|
||||
if (kim->is_strictly_between_1_5_and_2_0)
|
||||
strcat(*test_descriptor_string,
|
||||
"numberOfSpecies integer none []\n"
|
||||
"particleSpecies integer none ");
|
||||
else
|
||||
strcat(*test_descriptor_string,
|
||||
"numberContributingParticles integer none []\n"
|
||||
#if KIM_API_VERSION_MAJOR == 1 && KIM_API_VERSON_MINOR == 5
|
||||
"numberParticleTypes integer none []\n"
|
||||
"particleTypes integer none ");
|
||||
strcat(*test_descriptor_string,
|
||||
"particleTypes integer none "
|
||||
#else
|
||||
"numberOfSpecies integer none []\n"
|
||||
"particleSpecies integer none "
|
||||
#endif
|
||||
"[numberOfParticles]\n"
|
||||
"coordinates double length "
|
||||
"[numberOfParticles,3]\n"
|
||||
@ -1324,13 +1314,12 @@ void *PairKIM::extract(const char *str, int &dim)
|
||||
|
||||
// check to make sure that the requested parameter is a valid free parameter
|
||||
|
||||
kimerror = kim->get_num_params(pkim, &numParams, &dummyint);
|
||||
kimerror = pkim->get_num_params(&numParams, &dummyint);
|
||||
kim_error(__LINE__, "get_num_free_params", kimerror);
|
||||
char **freeParamNames = new char*[numParams];
|
||||
for (int k = 0; k < numParams; k++)
|
||||
{
|
||||
kimerror = kim->get_free_parameter(pkim, k,
|
||||
(const char**) &freeParamNames[k]);
|
||||
kimerror = pkim->get_free_parameter(k, (const char**) &freeParamNames[k]);
|
||||
kim_error(__LINE__, "get_free_parameter", kimerror);
|
||||
if (0 == strcmp(paramName, freeParamNames[k]))
|
||||
{
|
||||
@ -1348,7 +1337,7 @@ void *PairKIM::extract(const char *str, int &dim)
|
||||
}
|
||||
|
||||
// get the parameter arry from pkim object
|
||||
paramData = kim->get_data(pkim, paramName, &kimerror);
|
||||
paramData = pkim->get_data(paramName, &kimerror);
|
||||
if (kimerror == KIM_STATUS_FAIL)
|
||||
{
|
||||
delete [] speciesIndex, speciesIndex = 0;
|
||||
@ -1357,7 +1346,7 @@ void *PairKIM::extract(const char *str, int &dim)
|
||||
kim_error(__LINE__,"get_data",kimerror);
|
||||
|
||||
// get rank and shape of parameter
|
||||
rank = kim->get_rank(pkim, paramName, &kimerror);
|
||||
rank = (*pkim).get_rank(paramName, &kimerror);
|
||||
if (kimerror == KIM_STATUS_FAIL)
|
||||
{
|
||||
delete [] speciesIndex, speciesIndex = 0;
|
||||
@ -1366,7 +1355,7 @@ void *PairKIM::extract(const char *str, int &dim)
|
||||
kim_error(__LINE__,"get_rank",kimerror);
|
||||
|
||||
int *shape = new int[maxLine];
|
||||
dummyint = kim->get_shape(pkim, paramName, shape, &kimerror);
|
||||
dummyint = (*pkim).get_shape(paramName, shape, &kimerror);
|
||||
if (kimerror == KIM_STATUS_FAIL)
|
||||
{
|
||||
delete [] speciesIndex, speciesIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user