git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10926 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -34,7 +34,7 @@ namespace LAMMPS_NS {
|
|||||||
class DumpXTC : public Dump {
|
class DumpXTC : public Dump {
|
||||||
public:
|
public:
|
||||||
DumpXTC(class LAMMPS *, int, char**);
|
DumpXTC(class LAMMPS *, int, char**);
|
||||||
~DumpXTC();
|
virtual ~DumpXTC();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int natoms,ntotal;
|
int natoms,ntotal;
|
||||||
|
|||||||
@ -404,7 +404,11 @@ void Dump::openfile()
|
|||||||
#ifdef LAMMPS_GZIP
|
#ifdef LAMMPS_GZIP
|
||||||
char gzip[128];
|
char gzip[128];
|
||||||
sprintf(gzip,"gzip -6 > %s",filecurrent);
|
sprintf(gzip,"gzip -6 > %s",filecurrent);
|
||||||
|
#ifdef _WIN32
|
||||||
|
fp = _popen(gzip,"wb");
|
||||||
|
#else
|
||||||
fp = popen(gzip,"w");
|
fp = popen(gzip,"w");
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
error->one(FLERR,"Cannot open gzipped file");
|
error->one(FLERR,"Cannot open gzipped file");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
11
src/dump.h
11
src/dump.h
@ -1,4 +1,4 @@
|
|||||||
/* ----------------------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
@ -149,13 +149,14 @@ integer for dump.
|
|||||||
|
|
||||||
E: Cannot open gzipped file
|
E: Cannot open gzipped file
|
||||||
|
|
||||||
LAMMPS is attempting to open a gzipped version of the specified file
|
LAMMPS was compiled without support for reading and writing gzipped
|
||||||
but was unsuccessful. Check that the path and name are correct.
|
files through a pipeline to the gzip program with -DLAMMPS_GZIP.
|
||||||
|
|
||||||
E: Cannot open dump file
|
E: Cannot open dump file
|
||||||
|
|
||||||
The output file for the dump command cannot be opened. Check that the
|
The specified file cannot be opened. Check that the path and name are
|
||||||
path and name are correct.
|
correct. If the file is a compressed file, also check that the gzip
|
||||||
|
executable can be found and run.
|
||||||
|
|
||||||
E: Illegal ... command
|
E: Illegal ... command
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,6 @@ using namespace MathConst;
|
|||||||
|
|
||||||
#define BIG 1.0e20
|
#define BIG 1.0e20
|
||||||
|
|
||||||
enum{PPM,JPG,PNG};
|
|
||||||
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
|
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
|
||||||
enum{STATIC,DYNAMIC};
|
enum{STATIC,DYNAMIC};
|
||||||
enum{NO,YES};
|
enum{NO,YES};
|
||||||
@ -547,7 +546,10 @@ void DumpImage::write()
|
|||||||
if (filetype == JPG) image->write_JPG(fp);
|
if (filetype == JPG) image->write_JPG(fp);
|
||||||
else if (filetype == PNG) image->write_PNG(fp);
|
else if (filetype == PNG) image->write_PNG(fp);
|
||||||
else image->write_PPM(fp);
|
else image->write_PPM(fp);
|
||||||
fclose(fp);
|
if (multifile) {
|
||||||
|
fclose(fp);
|
||||||
|
fp = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* ----------------------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
@ -27,12 +27,14 @@ namespace LAMMPS_NS {
|
|||||||
class DumpImage : public DumpCustom {
|
class DumpImage : public DumpCustom {
|
||||||
public:
|
public:
|
||||||
DumpImage(class LAMMPS *, int, char**);
|
DumpImage(class LAMMPS *, int, char**);
|
||||||
~DumpImage();
|
virtual ~DumpImage();
|
||||||
int pack_comm(int, int *, double *, int, int *);
|
int pack_comm(int, int *, double *, int, int *);
|
||||||
void unpack_comm(int, int, double *);
|
void unpack_comm(int, int, double *);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
int filetype;
|
int filetype;
|
||||||
|
enum{PPM,JPG,PNG};
|
||||||
|
|
||||||
int acolor,adiam; // what determines color/diam of atoms
|
int acolor,adiam; // what determines color/diam of atoms
|
||||||
double adiamvalue; // atom diameter value
|
double adiamvalue; // atom diameter value
|
||||||
int atomflag,bondflag; // 0/1 for draw atoms,bonds
|
int atomflag,bondflag; // 0/1 for draw atoms,bonds
|
||||||
@ -62,7 +64,7 @@ class DumpImage : public DumpCustom {
|
|||||||
double **bufcopy; // buffer for communicating bond/atom info
|
double **bufcopy; // buffer for communicating bond/atom info
|
||||||
int maxbufcopy;
|
int maxbufcopy;
|
||||||
|
|
||||||
void init_style();
|
virtual void init_style();
|
||||||
int modify_param(int, char **);
|
int modify_param(int, char **);
|
||||||
void write();
|
void write();
|
||||||
|
|
||||||
@ -85,10 +87,14 @@ E: Invalid dump image filename
|
|||||||
The file produced by dump image cannot be binary and must
|
The file produced by dump image cannot be binary and must
|
||||||
be for a single processor.
|
be for a single processor.
|
||||||
|
|
||||||
E: Cannot dump JPG file
|
E: Support for writing images in JPEG format not included
|
||||||
|
|
||||||
LAMMPS was not built with the -DLAMMPS_JPEG switch in the Makefile.
|
LAMMPS was not built with the -DLAMMPS_JPEG switch in the Makefile.
|
||||||
|
|
||||||
|
E: Support for writing images in PNG format not included
|
||||||
|
|
||||||
|
LAMMPS was not built with the -DLAMMPS_PNG switch in the Makefile.
|
||||||
|
|
||||||
E: Illegal ... command
|
E: Illegal ... command
|
||||||
|
|
||||||
Self-explanatory. Check the input script syntax and compare to the
|
Self-explanatory. Check the input script syntax and compare to the
|
||||||
|
|||||||
106
src/dump_movie.cpp
Normal file
106
src/dump_movie.cpp
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Axel Kohlmeyer (Temple U)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "dump_movie.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
DumpImage(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
if (multiproc || compressed || multifile)
|
||||||
|
error->all(FLERR,"Invalid dump movie filename");
|
||||||
|
|
||||||
|
filetype = PPM;
|
||||||
|
bitrate = 2000;
|
||||||
|
framerate = 24;
|
||||||
|
fp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DumpMovie::openfile()
|
||||||
|
{
|
||||||
|
char moviecmd[1024];
|
||||||
|
|
||||||
|
if ((comm->me == 0) && (fp == NULL)) {
|
||||||
|
|
||||||
|
#ifdef LAMMPS_FFMPEG
|
||||||
|
sprintf(moviecmd,"ffmpeg -v error -y -r %.2f -f image2pipe -c:v ppm -i - "
|
||||||
|
"-r 24.0 -b:v %dk %s ", framerate, bitrate, filename);
|
||||||
|
#else
|
||||||
|
error->one(FLERR,"Cannot generate movie file");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
fp = _popen(moviecmd,"wb");
|
||||||
|
#else
|
||||||
|
fp = popen(moviecmd,"w");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fp == NULL) {
|
||||||
|
char str[128];
|
||||||
|
sprintf(str,"Failed to open FFmpeg pipeline to file %s",filename);
|
||||||
|
error->one(FLERR,str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void DumpMovie::init_style()
|
||||||
|
{
|
||||||
|
// initialize image style circumventing multifile check
|
||||||
|
|
||||||
|
multifile = 1;
|
||||||
|
DumpImage::init_style();
|
||||||
|
multifile = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int DumpMovie::modify_param(int narg, char **arg)
|
||||||
|
{
|
||||||
|
int n = DumpImage::modify_param(narg,arg);
|
||||||
|
if (n) return n;
|
||||||
|
|
||||||
|
if (strcmp(arg[0],"bitrate") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
bitrate = force->inumeric(FLERR,arg[1]);
|
||||||
|
if (bitrate <= 0.0) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(arg[0],"framerate") == 0) {
|
||||||
|
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||||
|
framerate = force->numeric(FLERR,arg[1]);
|
||||||
|
if ((framerate <= 0.1) || (framerate > 24.0))
|
||||||
|
error->all(FLERR,"Illegal dump_modify framerate command");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
73
src/dump_movie.h
Normal file
73
src/dump_movie.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef DUMP_CLASS
|
||||||
|
|
||||||
|
DumpStyle(movie,DumpMovie)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_DUMP_MOVIE_H
|
||||||
|
#define LMP_DUMP_MOVIE_H
|
||||||
|
|
||||||
|
#include "dump_image.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class DumpMovie : public DumpImage {
|
||||||
|
public:
|
||||||
|
DumpMovie(LAMMPS *, int, char**);
|
||||||
|
|
||||||
|
virtual void openfile();
|
||||||
|
virtual void init_style();
|
||||||
|
virtual int modify_param(int, char **);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
double framerate; // frame rate of animation
|
||||||
|
int bitrate; // bitrate of video file in kbps
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
E: Invalid dump movie filename
|
||||||
|
|
||||||
|
The file produced by dump movie cannot be binary or compressed
|
||||||
|
and must be a single file for a single processor.
|
||||||
|
|
||||||
|
E: Cannot generate movie file
|
||||||
|
|
||||||
|
LAMMPS was built without the -DLAMMPS_FFMPEG switch in the Makefile
|
||||||
|
|
||||||
|
E: Illegal ... command
|
||||||
|
|
||||||
|
Self-explanatory. Check the input script syntax and compare to the
|
||||||
|
documentation for the command. You can use -echo screen as a
|
||||||
|
command-line option when running LAMMPS to see the offending line.
|
||||||
|
|
||||||
|
E: pipe:: Input/output error
|
||||||
|
|
||||||
|
Harmless. This happens when the pipeline to FFmpeg is closed and no
|
||||||
|
more image data is sent to be appended to the movie. FFmpeg will
|
||||||
|
simply terminate and close the movie file.
|
||||||
|
|
||||||
|
E: Failed to open FFmpeg pipeline to file %s
|
||||||
|
|
||||||
|
The specified file cannot be opened. Check that the path and name are
|
||||||
|
correct and writable and that the FFmpeg executable can be found and run.
|
||||||
|
|
||||||
|
*/
|
||||||
@ -393,7 +393,7 @@ void FixTMD::readfile(char *file)
|
|||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
char *buffer = new char[CHUNK*MAXLINE];
|
char *buffer = new char[CHUNK*MAXLINE];
|
||||||
char *ptr,*next,*bufptr;
|
char *next,*bufptr;
|
||||||
int i,m,nlines,tag,imageflag,ix,iy,iz;
|
int i,m,nlines,tag,imageflag,ix,iy,iz;
|
||||||
double x,y,z,xprd,yprd,zprd;
|
double x,y,z,xprd,yprd,zprd;
|
||||||
|
|
||||||
@ -518,8 +518,14 @@ void FixTMD::open(char *file)
|
|||||||
else {
|
else {
|
||||||
#ifdef LAMMPS_GZIP
|
#ifdef LAMMPS_GZIP
|
||||||
char gunzip[128];
|
char gunzip[128];
|
||||||
sprintf(gunzip,"gunzip -c %s",file);
|
sprintf(gunzip,"gzip -c -d %s",file);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
fp = _popen(gunzip,"rb");
|
||||||
|
#else
|
||||||
fp = popen(gunzip,"r");
|
fp = popen(gunzip,"r");
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
error->one(FLERR,"Cannot open gzipped file");
|
error->one(FLERR,"Cannot open gzipped file");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* ----------------------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
@ -98,12 +98,13 @@ fix group.
|
|||||||
|
|
||||||
E: Cannot open gzipped file
|
E: Cannot open gzipped file
|
||||||
|
|
||||||
LAMMPS is attempting to open a gzipped version of the specified file
|
LAMMPS was compiled without support for reading and writing gzipped
|
||||||
but was unsuccessful. Check that the path and name are correct.
|
files through a pipeline to the gzip program with -DLAMMPS_GZIP.
|
||||||
|
|
||||||
E: Cannot open file %s
|
E: Cannot open file %s
|
||||||
|
|
||||||
The specified file cannot be opened. Check that the path and name are
|
The specified file cannot be opened. Check that the path and name are
|
||||||
correct.
|
correct. If the file is a compressed file, also check that the gzip
|
||||||
|
executable can be found and run.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -41,8 +41,14 @@ void Reader::open_file(const char *file)
|
|||||||
else {
|
else {
|
||||||
#ifdef LAMMPS_GZIP
|
#ifdef LAMMPS_GZIP
|
||||||
char gunzip[1024];
|
char gunzip[1024];
|
||||||
sprintf(gunzip,"gunzip -c %s",file);
|
sprintf(gunzip,"gzip -c -d %s",file);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
fp = _popen(gunzip,"rb");
|
||||||
|
#else
|
||||||
fp = popen(gunzip,"r");
|
fp = popen(gunzip,"r");
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
error->one(FLERR,"Cannot open gzipped file");
|
error->one(FLERR,"Cannot open gzipped file");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -49,12 +49,13 @@ class Reader : protected Pointers {
|
|||||||
|
|
||||||
E: Cannot open gzipped file
|
E: Cannot open gzipped file
|
||||||
|
|
||||||
LAMMPS is attempting to open a gzipped version of the specified file
|
LAMMPS was compiled without support for reading and writing gzipped
|
||||||
but was unsuccessful. Check that the path and name are correct.
|
files through a pipeline to the gzip program with -DLAMMPS_GZIP.
|
||||||
|
|
||||||
E: Cannot open file %s
|
E: Cannot open file %s
|
||||||
|
|
||||||
The specified file cannot be opened. Check that the path and name are
|
The specified file cannot be opened. Check that the path and name are
|
||||||
correct.
|
correct. If the file is a compressed file, also check that the gzip
|
||||||
|
executable can be found and run.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user