From 7afcfccf48fb06deccf9d185cabc377a5124d437 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 24 Jun 2019 13:51:41 -0400 Subject: [PATCH 1/2] follow convention to list all commands in a file as header --- doc/src/kim_commands.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/src/kim_commands.txt b/doc/src/kim_commands.txt index f039202e4e..2aa705b483 100644 --- a/doc/src/kim_commands.txt +++ b/doc/src/kim_commands.txt @@ -6,7 +6,9 @@ :line -kim_commands :h3 +kim_init command :h3 +kim_interactions command :h3 +kim_query command :h3 [Syntax:] From f2380a24ef90945f421a90e5d482c58e0bef49b5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 24 Jun 2019 14:27:05 -0400 Subject: [PATCH 2/2] fix parallel processing input include bug --- src/input.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 268be5b774..2f617d2cd0 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -239,8 +239,8 @@ void Input::file() } /* ---------------------------------------------------------------------- - process all input from filename - called from library interface + process all input from file at filename + mostly called from library interface ------------------------------------------------------------------------- */ void Input::file(const char *filename) @@ -250,21 +250,30 @@ void Input::file(const char *filename) // call to file() will close filename and decrement nfile if (me == 0) { - if (nfile > 1) - error->one(FLERR,"Invalid use of library file() function"); + if (nfile == maxfile) { + maxfile++; + infiles = (FILE **) + memory->srealloc(infiles,maxfile*sizeof(FILE *),"input:infiles"); + } - if (infile && infile != stdin) fclose(infile); infile = fopen(filename,"r"); if (infile == NULL) { char str[128]; snprintf(str,128,"Cannot open input script %s",filename); error->one(FLERR,str); } - infiles[0] = infile; - nfile = 1; + infiles[nfile++] = infile; } + // process contents of file + file(); + + if (me == 0) { + fclose(infile); + nfile--; + infile = infiles[nfile-1]; + } } /* ---------------------------------------------------------------------- @@ -1041,7 +1050,13 @@ void Input::include() error->one(FLERR,str); } infiles[nfile++] = infile; - file(); + } + + // process contents of file + + file(); + + if (me == 0) { fclose(infile); nfile--; infile = infiles[nfile-1];