[gmx-users] Overwrite output file
Nguyen Hoang Phuong
phuong at theochem.uni-frankfurt.de
Fri Jun 4 10:24:54 CEST 2004
> Hi,
>
> >> I am a kind of beginner of Gromacs.
> >> When I try to compile Gromacs job, they always to back up previous
> >> file started
> >> with #aaa_md.edr.1# (for example). Is there any other way to
> >> overwrite output
> >> file instead of back up? If someone knows the answer, I'll be greatly
> >> appreciate
> >> this.
> > you can change COUNTMAX in src/gmxlib/futil.c
>
> Don't think that will work, since the code halts with an error when
> COUNTMAX backups have been reached, so just disable the call to the
> backup_fn() routine instead.
I did as the following and it works for me
char *backup_fn(char *file)
{
/* Use a reasonably low value for countmax; we might
* generate 4-5 files in each round, and we dont
* want to hit directory limits of 1024 or 2048 files.
*/
#define COUNTMAX 0
int i,count=0;
char *directory,*fn;
static char buf[256];
for(i=strlen(file)-1; ((i > 0) && (file[i] != '/')); i--)
;
/* Must check whether i > 0, i.e. whether there is a directory
* in the file name. In that case we overwrite the / sign with
* a '\0' to end the directory string .
*/
/* if (i > 0) {
directory = strdup(file);
directory[i] = '\0';
fn = strdup(file+i+1);
}
else {
directory = strdup(".");
fn = strdup(file);
}
do {
sprintf(buf,"%s/#%s.%d#",directory,fn,count);
count++;
} while ((count < COUNTMAX) && fexist(buf));
*/
/* Arbitrarily bail out */
/* if (count == COUNTMAX)
fatal_error(0,"Won't make more than %d backups of %s for you",
COUNTMAX,fn);
sfree(directory);
sfree(fn);
*/
return buf;
}
Phuong
More information about the gromacs.org_gmx-users
mailing list