simplify and modernize
This commit is contained in:
@ -73,7 +73,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
|
||||
format_default = nullptr;
|
||||
flush_flag = 0;
|
||||
unwrap_flag = 0;
|
||||
datafile_from_dump = -1;
|
||||
other_dump = nullptr;
|
||||
author_name = nullptr;
|
||||
|
||||
every_dump = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
@ -141,11 +141,8 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
|
||||
}
|
||||
if (box_is_set||create_group_is_set)
|
||||
error->all(FLERR, "Cannot set file_from in dump h5md after box or create_group");
|
||||
int idump;
|
||||
for (idump = 0; idump < output->ndump; idump++)
|
||||
if (strcmp(arg[iarg+1],output->dump[idump]->id) == 0) break;
|
||||
if (idump == output->ndump) error->all(FLERR,"Cound not find dump_modify ID");
|
||||
datafile_from_dump = idump;
|
||||
other_dump = dynamic_cast<DumpH5MD *>(output->get_dump_by_id(arg[iarg+1]));
|
||||
if (!other_dump) error->all(FLERR,"Cound not find dump_modify H5MD dump ID {}", arg[iarg+1]);
|
||||
do_box=false;
|
||||
create_group=false;
|
||||
iarg+=2;
|
||||
@ -262,7 +259,7 @@ void DumpH5MD::openfile()
|
||||
}
|
||||
|
||||
if (me == 0) {
|
||||
if (datafile_from_dump<0) {
|
||||
if (!other_dump) {
|
||||
if (author_name==nullptr) {
|
||||
datafile = h5md_create_file(filename, "N/A", nullptr, "lammps", LAMMPS_VERSION);
|
||||
} else {
|
||||
@ -296,8 +293,6 @@ void DumpH5MD::openfile()
|
||||
h5md_write_string_attribute(particles_data.group, "charge", "type", "effective");
|
||||
}
|
||||
} else {
|
||||
DumpH5MD* other_dump;
|
||||
other_dump=(DumpH5MD*)output->dump[datafile_from_dump];
|
||||
datafile = other_dump->datafile;
|
||||
group_name_length = strlen(group->names[igroup]);
|
||||
group_name = new char[group_name_length];
|
||||
|
||||
@ -35,9 +35,9 @@ class DumpH5MD : public Dump {
|
||||
int natoms, ntotal;
|
||||
int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no
|
||||
h5md_file datafile;
|
||||
int datafile_from_dump;
|
||||
h5md_particles_group particles_data;
|
||||
char *author_name;
|
||||
DumpH5MD *other_dump;
|
||||
|
||||
bool do_box;
|
||||
bool create_group;
|
||||
|
||||
Reference in New Issue
Block a user