git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5523 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2011-01-11 00:43:41 +00:00
parent 4558c28bbc
commit 663cd083d8

View File

@ -39,6 +39,7 @@
typedef int tagint; typedef int tagint;
typedef int64_t bigint; typedef int64_t bigint;
#define BIGINT_FORMAT "%lld"
// same as write_restart.cpp // same as write_restart.cpp
@ -2615,22 +2616,25 @@ Data::Data() {}
void Data::stats() void Data::stats()
{ {
char fstr[64];
printf(" Restart file version = %s\n",version); printf(" Restart file version = %s\n",version);
printf(" Ntimestep = %d\n",ntimestep); sprintf(fstr," Ntimestep = %s\n",BIGINT_FORMAT);
printf(fstr,ntimestep);
printf(" Nprocs = %d\n",nprocs); printf(" Nprocs = %d\n",nprocs);
if (size_bigint == 8) {
printf(" Natoms = %ld\n",natoms); sprintf(fstr," Natoms = %s\n",BIGINT_FORMAT);
printf(" Nbonds = %ld\n",nbonds); printf(fstr,natoms);
printf(" Nangles = %ld\n",nangles); sprintf(fstr," Nbonds = %s\n",BIGINT_FORMAT);
printf(" Ndihedrals = %ld\n",ndihedrals); printf(fstr,nbonds);
printf(" Nimpropers = %ld\n",nimpropers); sprintf(fstr," Nangles = %s\n",BIGINT_FORMAT);
} else if (size_bigint == 4) { printf(fstr,nangles);
printf(" Natoms = %d\n",natoms); sprintf(fstr," Ndihedrals = %s\n",BIGINT_FORMAT);
printf(" Nbonds = %d\n",nbonds); printf(fstr,ndihedrals);
printf(" Nangles = %d\n",nangles); sprintf(fstr," Nimpropers = %s\n",BIGINT_FORMAT);
printf(" Ndihedrals = %d\n",ndihedrals); printf(fstr,nimpropers);
printf(" Nimpropers = %d\n",nimpropers);
}
printf(" Unit style = %s\n",unit_style); printf(" Unit style = %s\n",unit_style);
printf(" Atom style = %s\n",atom_style); printf(" Atom style = %s\n",atom_style);
printf(" Pair style = %s\n",pair_style); printf(" Pair style = %s\n",pair_style);
@ -2648,35 +2652,36 @@ void Data::stats()
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// write the data file // write the data file and input file
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
void Data::write(FILE *fp, FILE *fp2) void Data::write(FILE *fp, FILE *fp2)
{ {
if (size_bigint == 8) char fstr[128];
fprintf(fp, sprintf(fstr,
"LAMMPS data file from restart file: timestep = %ld, procs = %d\n", "LAMMPS data file from restart file: timestep = %s, procs = %%d\n",
ntimestep,nprocs); BIGINT_FORMAT);
else fprintf(fp,fstr,ntimestep,nprocs);
fprintf(fp,
"LAMMPS data file from restart file: timestep = %d, procs = %d\n",
ntimestep,nprocs);
fprintf(fp,"\n"); fprintf(fp,"\n");
if (size_bigint == 8) { sprintf(fstr,"%s atoms\n",BIGINT_FORMAT);
fprintf(fp,"%ld atoms\n",natoms); fprintf(fp,fstr,natoms);
if (nbonds) fprintf(fp,"%ld bonds\n",nbonds); if (nbonds) {
if (nangles) fprintf(fp,"%ld angles\n",nangles); sprintf(fstr,"%s bonds\n",BIGINT_FORMAT);
if (ndihedrals) fprintf(fp,"%ld dihedrals\n",ndihedrals); fprintf(fp,fstr,nbonds);
if (nimpropers) fprintf(fp,"%ld impropers\n",nimpropers); }
} else if (size_bigint == 4) { if (nangles) {
fprintf(fp,"%d atoms\n",natoms); sprintf(fstr,"%s angles\n",BIGINT_FORMAT);
if (nbonds) fprintf(fp,"%d bonds\n",nbonds); fprintf(fp,fstr,nangles);
if (nangles) fprintf(fp,"%d angles\n",nangles); }
if (ndihedrals) fprintf(fp,"%d dihedrals\n",ndihedrals); if (ndihedrals) {
if (nimpropers) fprintf(fp,"%d impropers\n",nimpropers); sprintf(fstr,"%s dihedrals\n",BIGINT_FORMAT);
} else fprintf(fp,fstr,ndihedrals);
}
if (nimpropers) {
sprintf(fstr,"%s impropers\n",BIGINT_FORMAT);
fprintf(fp,fstr,nimpropers);
}
fprintf(fp,"\n"); fprintf(fp,"\n");
@ -2696,8 +2701,12 @@ void Data::write(FILE *fp, FILE *fp2)
// write ff styles to input file // write ff styles to input file
if (fp2) { if (fp2) {
fprintf(fp2,"# LAMMPS input file from restart file: timestep = %d, procs = %d\n\n", sprintf(fstr,
ntimestep,nprocs); "# LAMMPS input file from restart file: "
"timestep = %s, procs = %%d\n\n",
BIGINT_FORMAT);
fprintf(fp2,fstr,ntimestep,nprocs);
if (pair_style) fprintf(fp2,"pair_style %s\n",pair_style); if (pair_style) fprintf(fp2,"pair_style %s\n",pair_style);
if (bond_style) fprintf(fp2,"bond_style %s\n",bond_style); if (bond_style) fprintf(fp2,"bond_style %s\n",bond_style);
if (angle_style) fprintf(fp2,"angle_style %s\n",angle_style); if (angle_style) fprintf(fp2,"angle_style %s\n",angle_style);