Feature request: '*' and '.gz' option for fix reax/c/bonds

It would be really handy if the fix reax/c/bonds command had the ‘*’ option to output one file per timestep and the ‘.gz’ option to save to a compressed file like the dump command.

I don’t know much programming, perhaps if there is enough interest this could be included.

Thanks.

-Ben

​adding support for on-the-fly compression is straightforward​ and just
looks a bit awkward due to the ifdefs required (see diff below).
adding processing for '*' requires a much larger programming effort,
though, and thus is not likely to happen soon, unless somebody else feels
motivated to contribute such a feature.

axel.

​diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp
b/src/USER-REAXC/fix_reaxc_bonds.cpp
index cf9e478..fe830b5 100644
--- a/src/USER-REAXC/fix_reaxc_bonds.cpp
+++ b/src/USER-REAXC/fix_reaxc_bonds.cpp
@@ -58,7 +58,21 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char
**arg) :
     error->all(FLERR,"Illegal fix reax/c/bonds command");

   if (me == 0) {
- fp = fopen(arg[4],"w");
+ char *suffix = strrchr(arg[4],'.');
+ if (suffix && strcmp(suffix,".gz") == 0) {
+#ifdef LAMMPS_GZIP
+ char gzip[128];
+ sprintf(gzip,"gzip -6 > %s",arg[4]);
+#ifdef _WIN32
+ fp = _popen(gzip,"wb");
+#else
+ fp = popen(gzip,"w");
+#endif
+#else
+ error->one(FLERR,"Cannot open gzipped file");
+#endif
+ } else fp = fopen(arg[4],"w");

Thanks Axel for adding the “.gz” feature, this will be useful for myself and hopefully others.

Maybe there is a motivated programmer on the list with some time to tackle the “*” option and who would also benefit from this feature?

Thanks again.

-Ben

Thanks Axel for adding the ".gz" feature, this will be useful for myself and hopefully others.

Maybe there is a motivated programmer on the list with some time to tackle the "*" option and who would also benefit from this feature?

This is exactly how many of the new features were added! Strong motivation and sufficient time/funding are the necessary conditions to make this happen.

Ray

Thanks again.

-Ben