consistently check for presence of all input mesh data
This commit is contained in:
@ -42,11 +42,11 @@ using namespace FixConst;
|
||||
|
||||
FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL),
|
||||
T_initial_set(NULL), gfactor1(NULL), gfactor2(NULL), ratio(NULL),
|
||||
flangevin(NULL), T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL),
|
||||
sum_mass_vsq(NULL), sum_vsq_all(NULL), sum_mass_vsq_all(NULL),
|
||||
net_energy_transfer(NULL), net_energy_transfer_all(NULL)
|
||||
random(NULL), fp(NULL), T_initial_set(NULL), nsum(NULL), nsum_all(NULL),
|
||||
gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL),
|
||||
T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL),
|
||||
sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL),
|
||||
net_energy_transfer_all(NULL)
|
||||
{
|
||||
if (narg < 15) error->all(FLERR,"Illegal fix ttm command");
|
||||
|
||||
@ -327,7 +327,7 @@ void FixTTM::reset_dt()
|
||||
|
||||
void FixTTM::read_initial_electron_temperatures(const char *filename)
|
||||
{
|
||||
memset(&T_initial_set[0][0][0],0,total_nnodes*sizeof(double));
|
||||
memset(&T_initial_set[0][0][0],0,total_nnodes*sizeof(int));
|
||||
|
||||
std::string name = utils::get_potential_file_path(filename);
|
||||
if (name.empty())
|
||||
@ -360,8 +360,9 @@ void FixTTM::read_initial_electron_temperatures(const char *filename)
|
||||
error->one(FLERR,"Fix ttm electron temperatures must be > 0.0");
|
||||
|
||||
T_electron[ixnode][iynode][iznode] = T_tmp;
|
||||
T_initial_set[ixnode][iynode][iznode] = 1.0;
|
||||
T_initial_set[ixnode][iynode][iznode] = 1;
|
||||
}
|
||||
fclose(fpr);
|
||||
|
||||
// check completeness of input data
|
||||
|
||||
@ -370,8 +371,6 @@ void FixTTM::read_initial_electron_temperatures(const char *filename)
|
||||
for (int iznode = 0; iznode < nznodes; iznode++)
|
||||
if (T_initial_set[ixnode][iynode][iznode] == 0)
|
||||
error->one(FLERR,"Initial temperatures not all set in fix ttm");
|
||||
|
||||
fclose(fpr);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -55,10 +55,9 @@ class FixTTM : public Fix {
|
||||
FILE *fp;
|
||||
int nxnodes,nynodes,nznodes;
|
||||
bigint total_nnodes;
|
||||
int ***nsum;
|
||||
int ***nsum_all,***T_initial_set;
|
||||
double *gfactor1,*gfactor2,*ratio;
|
||||
double **flangevin;
|
||||
int ***T_initial_set;
|
||||
int ***nsum, ***nsum_all;
|
||||
double *gfactor1,*gfactor2,*ratio,**flangevin;
|
||||
double ***T_electron,***T_electron_old;
|
||||
double ***sum_vsq,***sum_mass_vsq;
|
||||
double ***sum_vsq_all,***sum_mass_vsq_all;
|
||||
|
||||
@ -66,7 +66,12 @@ static const char cite_fix_ttm_mod[] =
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg), fp(NULL)
|
||||
Fix(lmp, narg, arg),
|
||||
random(NULL), fp(NULL), T_initial_set(NULL), nsum(NULL), nsum_all(NULL),
|
||||
gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL),
|
||||
T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL),
|
||||
sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL),
|
||||
net_energy_transfer_all(NULL)
|
||||
{
|
||||
if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod);
|
||||
|
||||
@ -521,7 +526,7 @@ void FixTTMMod::read_parameters(const char *filename)
|
||||
|
||||
void FixTTMMod::read_initial_electron_temperatures(const char *filename)
|
||||
{
|
||||
memset(&T_initial_set[0][0][0],0,total_nnodes*sizeof(double));
|
||||
memset(&T_initial_set[0][0][0],0,total_nnodes*sizeof(int));
|
||||
|
||||
std::string name = utils::get_potential_file_path(filename);
|
||||
if (name.empty())
|
||||
@ -557,6 +562,14 @@ void FixTTMMod::read_initial_electron_temperatures(const char *filename)
|
||||
T_initial_set[ixnode][iynode][iznode] = 1;
|
||||
}
|
||||
fclose(fpr);
|
||||
|
||||
// check completeness of input data
|
||||
|
||||
for (int ixnode = 0; ixnode < nxnodes; ixnode++)
|
||||
for (int iynode = 0; iynode < nynodes; iynode++)
|
||||
for (int iznode = 0; iznode < nznodes; iznode++)
|
||||
if (T_initial_set[ixnode][iynode][iznode] == 0)
|
||||
error->one(FLERR,"Initial temperatures not all set in fix ttm");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -58,11 +58,11 @@ class FixTTMMod : public Fix {
|
||||
int seed;
|
||||
class RanMars *random;
|
||||
FILE *fp;
|
||||
int nxnodes,nynodes,nznodes,total_nnodes;
|
||||
int ***nsum;
|
||||
int ***nsum_all,***T_initial_set;
|
||||
double *gfactor1,*gfactor2,*ratio;
|
||||
double **flangevin;
|
||||
int nxnodes,nynodes,nznodes;
|
||||
bigint total_nnodes;
|
||||
int ***T_initial_set;
|
||||
int ***nsum, ***nsum_all;
|
||||
double *gfactor1,*gfactor2,*ratio,**flangevin;
|
||||
double ***T_electron,***T_electron_old,***T_electron_first;
|
||||
double ***sum_vsq,***sum_mass_vsq;
|
||||
double ***sum_vsq_all,***sum_mass_vsq_all;
|
||||
|
||||
Reference in New Issue
Block a user