mirror of https://github.com/lammps/lammps.git
recover failing unit tests and whitespace fixes
This commit is contained in:
parent
7018ba65be
commit
a653ee6b2c
|
@ -128,7 +128,7 @@ void DumpXTC::init_style()
|
|||
int idump;
|
||||
for (idump = 0; idump < output->ndump; idump++)
|
||||
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
||||
|
||||
|
||||
if (output->mode_dump[idump] == 1)
|
||||
error->all(FLERR,"Cannot use every/time setting for dump xtc");
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void Integrate::ev_setup()
|
|||
(1) computes that need energy/virial info on this timestep
|
||||
(2) time dumps that may need per-atom compute info on this timestep
|
||||
NOTE: inefficient to add all per-atom eng/virial computes
|
||||
but don't know which ones the dump needs
|
||||
but don't know which ones the dump needs
|
||||
see NOTE in output.cpp
|
||||
invoke matchstep() on all timestep-dependent computes to clear their arrays
|
||||
eflag: set any or no bits
|
||||
|
@ -140,7 +140,7 @@ void Integrate::ev_set(bigint ntimestep)
|
|||
int i,flag;
|
||||
|
||||
int tdflag = 0;
|
||||
if (output->any_time_dumps &&
|
||||
if (output->any_time_dumps &&
|
||||
output->next_time_dump_any == ntimestep) tdflag = 1;
|
||||
|
||||
flag = 0;
|
||||
|
|
|
@ -199,9 +199,9 @@ void Output::setup(int memflag)
|
|||
// (2) and (3) only apply for non-variable dump intervals
|
||||
// finally, do not write if same snapshot written previously,
|
||||
// i.e. on last timestep of previous run
|
||||
|
||||
|
||||
int writeflag = 0;
|
||||
|
||||
|
||||
if (last_dump[idump] < 0 && dump[idump]->first_flag == 1) writeflag = 1;
|
||||
|
||||
if (mode_dump[idump] == 0) {
|
||||
|
@ -209,7 +209,7 @@ void Output::setup(int memflag)
|
|||
writeflag = 1;
|
||||
} else {
|
||||
if (every_time_dump[idump] > 0.0) {
|
||||
double tcurrent = update->atime +
|
||||
double tcurrent = update->atime +
|
||||
(ntimestep - update->atimestep) * update->dt;
|
||||
double remainder = fmod(tcurrent,every_time_dump[idump]);
|
||||
if ((remainder < EPSDT*update->dt) ||
|
||||
|
@ -234,7 +234,7 @@ void Output::setup(int memflag)
|
|||
if (writeflag || last_dump[idump] < 0)
|
||||
calculate_next_dump(0,idump,ntimestep);
|
||||
|
||||
// if dump not written now, use addstep_compute_all()
|
||||
// if dump not written now, use addstep_compute_all()
|
||||
// since don't know what computes the dump will invoke
|
||||
|
||||
if (mode_dump[idump] == 0 &&
|
||||
|
@ -354,7 +354,7 @@ void Output::setup(int memflag)
|
|||
if (next_dump[idump] == ntimestep) {
|
||||
if (last_dump[idump] == ntimestep) continue;
|
||||
|
||||
if (mode_dump[idump] == 0 &&
|
||||
if (mode_dump[idump] == 0 &&
|
||||
(dump[idump]->clearstep || var_dump[idump]))
|
||||
modify->clearstep_compute();
|
||||
|
||||
|
@ -365,7 +365,7 @@ void Output::setup(int memflag)
|
|||
last_dump[idump] = ntimestep;
|
||||
calculate_next_dump(1,idump,ntimestep);
|
||||
|
||||
if (mode_dump[idump] == 0 &&
|
||||
if (mode_dump[idump] == 0 &&
|
||||
(dump[idump]->clearstep || var_dump[idump]))
|
||||
modify->addstep_compute(next_dump[idump]);
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ void Output::setup(int memflag)
|
|||
if (which == 0)
|
||||
next_dump[idump] =
|
||||
(ntimestep/every_dump[idump])*every_dump[idump] + every_dump[idump];
|
||||
else if (which == 1)
|
||||
else if (which == 1)
|
||||
next_dump[idump] += every_dump[idump];
|
||||
|
||||
} else {
|
||||
|
@ -507,7 +507,7 @@ void Output::setup(int memflag)
|
|||
|
||||
bigint nextdump;
|
||||
double nexttime;
|
||||
double tcurrent = update->atime +
|
||||
double tcurrent = update->atime +
|
||||
(ntimestep - update->atimestep) * update->dt;
|
||||
|
||||
if (every_time_dump[idump] > 0.0) {
|
||||
|
@ -517,27 +517,27 @@ void Output::setup(int memflag)
|
|||
// which = 2: no change to previous nexttime (only timestep has changed)
|
||||
|
||||
if (which == 0)
|
||||
nexttime = static_cast<bigint> (tcurrent/every_time_dump[idump]) *
|
||||
nexttime = static_cast<bigint> (tcurrent/every_time_dump[idump]) *
|
||||
every_time_dump[idump] + every_time_dump[idump];
|
||||
else if (which == 1)
|
||||
else if (which == 1)
|
||||
nexttime = next_time_dump[idump] + every_time_dump[idump];
|
||||
else if (which == 2)
|
||||
nexttime = next_time_dump[idump];
|
||||
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
update->dt) + 1;
|
||||
|
||||
// if delta is too small to reach next timestep, use multiple of delta
|
||||
|
||||
if (nextdump == ntimestep) {
|
||||
double tnext = update->atime +
|
||||
double tnext = update->atime +
|
||||
(ntimestep+1 - update->atimestep) * update->dt;
|
||||
int multiple = static_cast<int>
|
||||
int multiple = static_cast<int>
|
||||
((tnext - nexttime) / every_time_dump[idump]);
|
||||
nexttime = nexttime + (multiple+1)*every_time_dump[idump];
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
update->dt) + 1;
|
||||
}
|
||||
|
||||
|
@ -548,14 +548,14 @@ void Output::setup(int memflag)
|
|||
|
||||
if (which < 2 || next_time_dump[idump] < 0.0) {
|
||||
nexttime = input->variable->compute_equal(ivar_dump[idump]);
|
||||
} else
|
||||
} else
|
||||
nexttime = next_time_dump[idump];
|
||||
|
||||
if (nexttime <= tcurrent)
|
||||
error->all(FLERR,"Dump every/time variable returned a bad time");
|
||||
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
nextdump = ntimestep +
|
||||
static_cast<bigint> ((nexttime - tcurrent - EPSDT*update->dt) /
|
||||
update->dt) + 1;
|
||||
if (nextdump <= ntimestep)
|
||||
error->all(FLERR,"Dump every/time variable too small for next timestep");
|
||||
|
@ -704,7 +704,7 @@ void Output::reset_dt()
|
|||
// reset next_dump but do not change next_time_dump, 2 arg for reset_dt()
|
||||
// do not invoke for a dump already scheduled for this step
|
||||
// since timestep change affects next step
|
||||
|
||||
|
||||
if (next_dump[idump] != ntimestep)
|
||||
calculate_next_dump(2,idump,update->ntimestep);
|
||||
|
||||
|
|
|
@ -74,6 +74,13 @@ public:
|
|||
END_HIDE_OUTPUT();
|
||||
}
|
||||
|
||||
void close_dump()
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("undump id");
|
||||
END_HIDE_OUTPUT();
|
||||
}
|
||||
|
||||
void generate_text_and_binary_dump(std::string text_file, std::string binary_file,
|
||||
std::string dump_modify_options, int ntimesteps)
|
||||
{
|
||||
|
@ -505,6 +512,7 @@ TEST_F(DumpAtomTest, rerun)
|
|||
ASSERT_FILE_EXISTS(dump_file);
|
||||
ASSERT_EQ(count_lines(dump_file), 82);
|
||||
continue_dump(1);
|
||||
close_dump();
|
||||
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
ASSERT_EQ(count_lines(dump_file), 123);
|
||||
|
@ -532,6 +540,7 @@ TEST_F(DumpAtomTest, rerun_bin)
|
|||
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
continue_dump(1);
|
||||
close_dump();
|
||||
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
HIDE_OUTPUT([&] {
|
||||
|
|
|
@ -73,6 +73,13 @@ public:
|
|||
END_HIDE_OUTPUT();
|
||||
}
|
||||
|
||||
void close_dump()
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("undump id");
|
||||
END_HIDE_OUTPUT();
|
||||
}
|
||||
|
||||
void generate_text_and_binary_dump(std::string text_file, std::string binary_file,
|
||||
std::string fields, std::string dump_modify_options,
|
||||
int ntimesteps)
|
||||
|
@ -330,6 +337,7 @@ TEST_F(DumpCustomTest, rerun)
|
|||
ASSERT_FILE_EXISTS(dump_file);
|
||||
ASSERT_EQ(count_lines(dump_file), 82);
|
||||
continue_dump(1);
|
||||
close_dump();
|
||||
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
ASSERT_EQ(count_lines(dump_file), 123);
|
||||
|
@ -338,6 +346,7 @@ TEST_F(DumpCustomTest, rerun)
|
|||
});
|
||||
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||
ASSERT_DOUBLE_EQ(pe_1, pe_rerun);
|
||||
|
||||
HIDE_OUTPUT([&] {
|
||||
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||
});
|
||||
|
@ -359,6 +368,7 @@ TEST_F(DumpCustomTest, rerun_bin)
|
|||
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
continue_dump(1);
|
||||
close_dump();
|
||||
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
HIDE_OUTPUT([&] {
|
||||
|
|
Loading…
Reference in New Issue