add support for gzip compressed output to fix reax/bonds, reax/c/bonds and reax/c/species

This commit is contained in:
Axel Kohlmeyer 2017-05-10 11:19:18 -04:00
parent a6e2d5b5f7
commit abeb1e096a
5 changed files with 59 additions and 3 deletions

View File

@ -36,6 +36,10 @@ please see the "fix reaxc/c/species"_fix_reaxc_species.html command.
The format of the output file should be self-explanatory.
If the filename ends with ".gz", the output file is written in gzipped
format. A gzipped dump file will be about 3x smaller than the text
version, but will also take longer to write.
:line
[Restart, fix_modify, output, run start/stop, minimize info:]
@ -85,6 +89,9 @@ USER-REAXC package. It is only enabled if LAMMPS was built with that
package. See the "Making LAMMPS"_Section_start.html#start_3 section
for more info.
To write gzipped bond files, you must compile LAMMPS with the
-DLAMMPS_GZIP option.
[Related commands:]
"pair_style reax"_pair_reax.html, "pair_style

View File

@ -52,6 +52,10 @@ number of molecules of each species. In this context, "species" means
a unique molecule. The chemical formula of each species is given in
the first line.
If the filename ends with ".gz", the output file is written in gzipped
format. A gzipped dump file will be about 3x smaller than the text version,
but will also take longer to write.
Optional keyword {cutoff} can be assigned to change the minimum
bond-order values used in identifying chemical bonds between pairs of
atoms. Bond-order cutoffs should be carefully chosen, as bond-order
@ -164,6 +168,9 @@ USER-REAXC package. It is only enabled if LAMMPS was built with that
package. See the "Making LAMMPS"_Section_start.html#start_3 section
for more info.
To write gzipped species files, you must compile LAMMPS with the
-DLAMMPS_GZIP option.
It should be possible to extend it to other reactive pair_styles (such as
"rebo"_pair_airebo.html, "airebo"_pair_airebo.html,
"comb"_pair_comb.html, and "bop"_pair_bop.html), but this has not yet been done.

View File

@ -49,7 +49,21 @@ FixReaxBonds::FixReaxBonds(LAMMPS *lmp, int narg, char **arg) :
if (nevery < 1) error->all(FLERR,"Illegal fix reax/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");
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open fix reax/bonds file %s",arg[4]);

View File

@ -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");
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open fix reax/c/bonds file %s",arg[4]);

View File

@ -110,7 +110,21 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) :
strcpy(tmparg[2],arg[5]);
if (me == 0) {
fp = fopen(arg[6],"w");
char *suffix = strrchr(arg[6],'.');
if (suffix && strcmp(suffix,".gz") == 0) {
#ifdef LAMMPS_GZIP
char gzip[128];
sprintf(gzip,"gzip -6 > %s",arg[6]);
#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[6],"w");
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open fix reax/c/species file %s",arg[6]);