git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@84 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -17,6 +17,7 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "universe.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
@ -786,13 +787,17 @@ void Input::log()
|
|||||||
if (logfile) fclose(logfile);
|
if (logfile) fclose(logfile);
|
||||||
if (strcmp(arg[0],"none") == 0) logfile = NULL;
|
if (strcmp(arg[0],"none") == 0) logfile = NULL;
|
||||||
else {
|
else {
|
||||||
logfile = fopen(arg[0],"w");
|
char fname[128];
|
||||||
|
if (universe->nworlds == 1) strcpy(fname,arg[0]);
|
||||||
|
else sprintf(fname,"%s.%d",arg[0],universe->iworld);
|
||||||
|
logfile = fopen(fname,"w");
|
||||||
if (logfile == NULL) {
|
if (logfile == NULL) {
|
||||||
char str[128];
|
char str[128];
|
||||||
sprintf(str,"Cannot open logfile %s",arg[0]);
|
sprintf(str,"Cannot open logfile %s",fname);
|
||||||
error->one(str);
|
error->one(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (universe->nworlds == 1) universe->ulogfile = logfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ void System::open(int narg, char **arg, MPI_Comm communicator)
|
|||||||
} else if (strcmp(arg[screenflag],"none") == 0)
|
} else if (strcmp(arg[screenflag],"none") == 0)
|
||||||
screen = NULL;
|
screen = NULL;
|
||||||
else {
|
else {
|
||||||
char str[32];
|
char str[128];
|
||||||
sprintf(str,"%s.%d",arg[screenflag],universe->iworld);
|
sprintf(str,"%s.%d",arg[screenflag],universe->iworld);
|
||||||
screen = fopen(str,"w");
|
screen = fopen(str,"w");
|
||||||
if (screen == NULL) error->one("Cannot open screen file");
|
if (screen == NULL) error->one("Cannot open screen file");
|
||||||
@ -190,7 +190,7 @@ void System::open(int narg, char **arg, MPI_Comm communicator)
|
|||||||
} else if (strcmp(arg[logflag],"none") == 0)
|
} else if (strcmp(arg[logflag],"none") == 0)
|
||||||
logfile = NULL;
|
logfile = NULL;
|
||||||
else {
|
else {
|
||||||
char str[32];
|
char str[128];
|
||||||
sprintf(str,"%s.%d",arg[logflag],universe->iworld);
|
sprintf(str,"%s.%d",arg[logflag],universe->iworld);
|
||||||
logfile = fopen(str,"w");
|
logfile = fopen(str,"w");
|
||||||
if (logfile == NULL) error->one("Cannot open logfile");
|
if (logfile == NULL) error->one("Cannot open logfile");
|
||||||
@ -307,11 +307,13 @@ void System::destroy()
|
|||||||
|
|
||||||
void System::close()
|
void System::close()
|
||||||
{
|
{
|
||||||
if (universe->nworlds > 1) {
|
if (universe->nworlds == 1) {
|
||||||
|
if (logfile) fclose(logfile);
|
||||||
|
} else {
|
||||||
if (screen && screen != stdout) fclose(screen);
|
if (screen && screen != stdout) fclose(screen);
|
||||||
if (logfile) fclose(logfile);
|
if (logfile) fclose(logfile);
|
||||||
|
if (universe->ulogfile) fclose(universe->ulogfile);
|
||||||
}
|
}
|
||||||
if (universe->ulogfile) fclose(universe->ulogfile);
|
|
||||||
|
|
||||||
if (world != universe->uworld) MPI_Comm_free(&world);
|
if (world != universe->uworld) MPI_Comm_free(&world);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user