Merge pull request #613 from akohlmey/collected-small-changes

Collected small changes and bug fixes
This commit is contained in:
Steve Plimpton 2017-08-17 11:34:52 -06:00 committed by GitHub
commit 76cd61350d
14 changed files with 287 additions and 297 deletions

21
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,21 @@
# This file contains file patterns that triggers automatic
# code review requests from users that are owners of these files
# Order matters, the last match has the highest precedence
# library folders
lib/colvars/* @giacomofiorin
lib/compress/* @akohlmey
lib/kokkos/* @stanmoore1
lib/molfile/* @akohlmey
lib/qmmm/* @akohlmey
lib/vtk/* @rbberger
# packages
src/KOKKOS @stanmoore1
src/USER-CGSDK @akohlmey
src/USER-COLVARS @giacomofiorin
src/USER-OMP @akohlmey
src/USER-QMMM @akohlmey
# tools
tools/msi2lmp/* @akohlmey

View File

@ -79,7 +79,7 @@ bug reports and feature requests are mainly coordinated through the
"LAMMPS project on GitHub."_https://github.com/lammps/lammps
The lammps.org domain, currently hosting "public continuous integration
testing"_https://ci.lammps.org/job/lammps/ and "precompiled Linux
RPM and Windows installer packages"_http://rpm.lammps.org is located
RPM and Windows installer packages"_http://packages.lammps.org is located
at Temple University and managed by Richard Berger,
richard.berger at temple.edu.

View File

@ -7886,8 +7886,8 @@ keyword to allow for additional bonds to be formed :dd
{New bond exceeded special list size in fix bond/create} :dt
See the "special_bonds extra" command
(or the "read_data extra/special/per/atom" command)
See the "read_data extra/special/per/atom" command
(or the "create_box extra/special/per/atom" command)
for info on how to leave space in the special bonds
list to allow for additional bonds to be formed. :dd
@ -9666,8 +9666,8 @@ you are running. :dd
{Special list size exceeded in fix bond/create} :dt
See the special_bonds extra command
(or the read_data extra/special/per/atom command)
See the "read_data extra/special/per/atom" command
(or the "create_box extra/special/per/atom" command)
for info on how to leave space in the special bonds
list to allow for additional bonds to be formed. :dd

View File

@ -662,27 +662,25 @@ your own build system. Due to differences between the Windows OS
and Windows system libraries to Unix-like environments like Linux
or MacOS, when compiling for Windows a few adjustments may be needed:
Do not set the -DLAMMPS_MEMALIGN define (see LMP_INC makefile variable)
Do [not] set the -DLAMMPS_MEMALIGN define (see LMP_INC makefile variable)
Add -lwsock32 -lpsapi to the linker flags (see LIB makefile variable)
Try adding -static-libgcc or -static or both to the linker flags when your
LAMMPS executable complains about missing .dll files :ul
Try adding -static-libgcc or -static or both to the linker flags when your LAMMPS executable complains about missing .dll files :ul
Since none of the current LAMMPS core developers
has significant experience building executables on Windows, we are
happy to distribute contributed instructions and modifications, but
we cannot provide support for those.
Since none of the current LAMMPS core developers has significant
experience building executables on Windows, we are happy to distribute
contributed instructions and modifications to improve the situation,
but we cannot provide support for those.
With the so-called "Anniversary Update" to Windows 10, there is a
Ubuntu Linux subsystem available for Windows, that can be installed
and then used to compile/install LAMMPS as if you are running on a
Ubuntu Linux system instead of Windows.
As an alternative, you can download "daily builds" (and some older
versions) of the installer packages from
"rpm.lammps.org/windows.html"_http://rpm.lammps.org/windows.html.
These executables are built with most optional packages and the
download includes documentation, potential files, some tools and
many examples, but no source code.
As an alternative, you can download pre-compiled installer packages from
"packages.lammps.org/windows.html"_http://packages.lammps.org/windows.html.
These executables are built with most optional packages included and the
download includes documentation, potential files, some tools and many
examples, but no source code.
:line
@ -1095,7 +1093,7 @@ LAMMPS to be built with one or more of its optional packages.
:line
On a Windows box, you can skip making LAMMPS and simply download an
installer package from "here"_http://rpm.lammps.org/windows.html
installer package from "here"_http://packages.lammps.org/windows.html
For running the non-MPI executable, follow these steps:
@ -1107,18 +1105,27 @@ the [in.lj] input from the bench folder. (e.g. by typing: cd "Documents"). :l
At the command prompt, type "lmp_serial -in in.lj", replacing [in.lj]
with the name of your LAMMPS input script. :l
The serial executable includes support for multi-threading
parallelization from the styles in the USER-OMP packages.
To run with, e.g. 4 threads, type "lmp_serial -in in.lj -pk omp 4 -sf omp"
:ule
For the MPI version, which allows you to run LAMMPS under Windows on
multiple processors, follow these steps:
For the MPI version, which allows you to run LAMMPS under Windows with
the more general message passing parallel library (LAMMPS has been
designed from ground up to use MPI efficiently), follow these steps:
Download and install
"MPICH2"_http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads
for Windows. :ulb,l
Download and install a compatible MPI library binary package:
for 32-bit Windows
"mpich2-1.4.1p1-win-ia32.msi"_download.lammps.org/thirdparty/mpich2-1.4.1p1-win-ia32.msi
and for 64-bit Windows
"mpich2-1.4.1p1-win-x86-64.msi"_download.lammps.org/thirdparty/mpich2-1.4.1p1-win-x86-64.msi
:ulb,l
The LAMMPS Windows installer packages will automatically adjust your
path for the default location of this MPI package. After the installation
of the MPICH software, it needs to be integrated into the system.
of the MPICH2 software, it needs to be integrated into the system.
For this you need to start a Command Prompt in {Administrator Mode}
(right click on the icon and select it). Change into the MPICH2
installation directory, then into the subdirectory [bin] and execute
@ -1137,7 +1144,7 @@ or
mpiexec -np 4 lmp_mpi -in in.lj :pre
replacing in.lj with the name of your LAMMPS input script. For the latter
replacing [in.lj] with the name of your LAMMPS input script. For the latter
case, you may be prompted to enter your password. :l
In this mode, output may not immediately show up on the screen, so if
@ -1149,6 +1156,11 @@ something like:
lmp_mpi -in in.lj :pre
And the parallel executable also includes OpenMP multi-threading, which
can be combined with MPI using something like:
mpiexec -localonly 2 lmp_mpi -in in.lj -pk omp 2 -sf omp :pre
:ule
:line

View File

@ -150,10 +150,9 @@ atoms. Note that adding a single bond always adds a new 1st neighbor
but may also induce *many* new 2nd and 3rd neighbors, depending on the
molecular topology of your system. The "extra special per atom"
parameter must typically be set to allow for the new maximum total
size (1st + 2nd + 3rd neighbors) of this per-atom list. There are 3
size (1st + 2nd + 3rd neighbors) of this per-atom list. There are 2
ways to do this. See the "read_data"_read_data.html or
"create_box"_create_box.html or "special_bonds extra" commands for
details.
"create_box"_create_box.html commands for details.
NOTE: Even if you do not use the {atype}, {dtype}, or {itype}
keywords, the list of topological neighbors is updated for atoms

View File

@ -25,9 +25,7 @@ keyword = {amber} or {charmm} or {dreiding} or {fene} or {lj/coul} or {lj} or {c
{coul} values = w1,w2,w3
w1,w2,w3 = weights (0.0 to 1.0) on pairwise Coulombic interactions
{angle} value = {yes} or {no}
{dihedral} value = {yes} or {no}
{extra} value = N
N = number of extra 1-2,1-3,1-4 interactions to save space for :pre
{dihedral} value = {yes} or {no} :pre
:ule
Examples:
@ -36,8 +34,7 @@ special_bonds amber
special_bonds charmm
special_bonds fene dihedral no
special_bonds lj/coul 0.0 0.0 0.5 angle yes dihedral yes
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 0.0 dihedral yes
special_bonds lj/coul 0 1 1 extra 2 :pre
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 0.0 dihedral yes :pre
[Description:]
@ -178,14 +175,6 @@ interaction between atoms 2 and 5 will be unaffected (full weighting
of 1.0). If the {dihedral} keyword is specified as {no} which is the
default, then the 2,5 interaction will also be weighted by 0.5.
The {extra} keyword can be used when additional bonds will be created
during a simulation run, e.g. by the "fix
bond/create"_fix_bond_create.html command. It can also be used if
molecules will be added to the system, e.g. via the "fix
deposit"_fix_deposit.html, or "fix pour"_fix_pour.html commands, which
will have atoms with more special neighbors than any atom in the
current system has.
:line
NOTE: LAMMPS stores and maintains a data structure with a list of the
@ -194,8 +183,9 @@ the system). If new bonds are created (or molecules added containing
atoms with more special neighbors), the size of this list needs to
grow. Note that adding a single bond always adds a new 1st neighbor
but may also induce *many* new 2nd and 3rd neighbors, depending on the
molecular topology of your system. Using the {extra} keyword leaves
empty space in the list for this N additional 1st, 2nd, or 3rd
molecular topology of your system. Using the {extra/special/per/atom}
keyword to either "read_data"_read_data.html or "create_box"_create_box.html
reserves empty space in the list for this N additional 1st, 2nd, or 3rd
neighbors to be added. If you do not do this, you may get an error
when bonds (or molecules) are added.
@ -203,8 +193,7 @@ when bonds (or molecules) are added.
NOTE: If you reuse this command in an input script, you should set all
the options you need each time. This command cannot be used a 2nd
time incrementally, e.g. to add some extra storage locations via the
{extra} keyword. E.g. these two commands:
time incrementally. E.g. these two commands:
special_bonds lj 0.0 1.0 1.0
special_bonds coul 0.0 0.0 1.0
@ -221,25 +210,6 @@ Coul: coul 0.0 0.0 1.0
because the LJ settings are reset to their default values
each time the command is issued.
Likewise
special_bonds amber
special_bonds extra 2 :pre
is not the same as this single command:
special_bonds amber extra 2 :pre
since in the former case, the 2nd command will reset all the LJ and
Coulombic weights to 0.0 (the default).
One exception to this rule is the {extra} option itself. It is not
reset to its default value of 0 each time the special_bonds command is
invoked. This is because it can also be set by the
"read_data"_read_data.html and "create_box"_create_box.html commands,
so this command will not override those settings unless you explicitly
use {extra} as an option.
[Restrictions:] none
[Related commands:]

0
doc/src/tutorial_bash_on_windows.txt Executable file → Normal file
View File

View File

@ -176,12 +176,13 @@ By recognizing the fix {drude}, LAMMPS will find and store matching
DC-DP pairs and will treat DP as equivalent to their DC in the
{special bonds} relations. It may be necessary to extend the space
for storing such special relations. In this case extra space should
be reserved by using the {extra} keyword of the {special_bonds}
be reserved by using the {extra/special/per/atom} keyword of either
the "read_data"_read_data.html or "create_box"_create_box.html
command. With our phenol, there is 1 more special neighbor for which
space is required. Otherwise LAMMPS crashes and gives the required
value.
special_bonds lj/coul 0.0 0.0 0.5 extra 1 :pre
read_data data-p.lmp extra/special/per/atom 1 :pre
Let us assume we want to run a simple NVT simulation at 300 K. Note
that Drude oscillators need to be thermalized at a low temperature in

0
doc/src/tutorials.txt Executable file → Normal file
View File

View File

@ -833,10 +833,6 @@ void Force::set_special(int narg, char **arg)
else if (strcmp(arg[iarg+1],"yes") == 0) special_dihedral = 1;
else error->all(FLERR,"Illegal special_bonds command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
special_extra = atoi(arg[iarg+1]);
iarg += 2;
} else error->all(FLERR,"Illegal special_bonds command");
}
@ -844,8 +840,6 @@ void Force::set_special(int narg, char **arg)
if (special_lj[i] < 0.0 || special_lj[i] > 1.0 ||
special_coul[i] < 0.0 || special_coul[i] > 1.0)
error->all(FLERR,"Illegal special_bonds command");
if (special_extra < 0) error->all(FLERR,"Illegal special_bonds command");
}
/* ----------------------------------------------------------------------

View File

@ -45,7 +45,7 @@
#include <algorithm>
#ifdef _WIN32
#define PSAPI_VERSION=1
#define PSAPI_VERSION 1
#include <windows.h>
#include <stdint.h>
#include <psapi.h>

View File

@ -1867,7 +1867,6 @@ void Input::special_bonds()
double coul3 = force->special_coul[3];
int angle = force->special_angle;
int dihedral = force->special_dihedral;
int extra = force->special_extra;
force->set_special(narg,arg);
@ -1877,8 +1876,7 @@ void Input::special_bonds()
if (lj2 != force->special_lj[2] || lj3 != force->special_lj[3] ||
coul2 != force->special_coul[2] || coul3 != force->special_coul[3] ||
angle != force->special_angle ||
dihedral != force->special_dihedral ||
extra != force->special_extra) {
dihedral != force->special_dihedral) {
Special special(lmp);
special.build();
}

View File

@ -427,47 +427,61 @@ void Molecule::read(int flag)
// search line for header keywords and set corresponding variable
if (strstr(line,"atoms")) sscanf(line,"%d",&natoms);
else if (strstr(line,"bonds")) sscanf(line,"%d",&nbonds);
else if (strstr(line,"angles")) sscanf(line,"%d",&nangles);
else if (strstr(line,"dihedrals")) sscanf(line,"%d",&ndihedrals);
else if (strstr(line,"impropers")) sscanf(line,"%d",&nimpropers);
else if (strstr(line,"mass")) {
int nmatch = 0;
int nwant = 0;
if (strstr(line,"atoms")) {
nmatch = sscanf(line,"%d",&natoms);
nwant = 1;
} else if (strstr(line,"bonds")) {
nmatch = sscanf(line,"%d",&nbonds);
nwant = 1;
} else if (strstr(line,"angles")) {
nmatch = sscanf(line,"%d",&nangles);
nwant = 1;
} else if (strstr(line,"dihedrals")) {
nmatch = sscanf(line,"%d",&ndihedrals);
nwant = 1;
} else if (strstr(line,"impropers")) {
nmatch = sscanf(line,"%d",&nimpropers);
nwant = 1;
} else if (strstr(line,"mass")) {
massflag = 1;
sscanf(line,"%lg",&masstotal);
nmatch = sscanf(line,"%lg",&masstotal);
nwant = 1;
masstotal *= sizescale*sizescale*sizescale;
}
else if (strstr(line,"com")) {
} else if (strstr(line,"com")) {
comflag = 1;
sscanf(line,"%lg %lg %lg",&com[0],&com[1],&com[2]);
nmatch = sscanf(line,"%lg %lg %lg",&com[0],&com[1],&com[2]);
nwant = 3;
com[0] *= sizescale;
com[1] *= sizescale;
com[2] *= sizescale;
if (domain->dimension == 2 && com[2] != 0.0)
error->all(FLERR,"Molecule file z center-of-mass must be 0.0 for 2d");
}
else if (strstr(line,"inertia")) {
} else if (strstr(line,"inertia")) {
inertiaflag = 1;
sscanf(line,"%lg %lg %lg %lg %lg %lg",
&itensor[0],&itensor[1],&itensor[2],
&itensor[3],&itensor[4],&itensor[5]);
itensor[0] *= sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[1] *= sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[2] *= sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[3] *= sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[4] *= sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[5] *= sizescale*sizescale*sizescale*sizescale*sizescale;
}
else if (strstr(line,"body")) {
nmatch = sscanf(line,"%lg %lg %lg %lg %lg %lg",
&itensor[0],&itensor[1],&itensor[2],
&itensor[3],&itensor[4],&itensor[5]);
nwant = 6;
const double scale5 = sizescale*sizescale*sizescale*sizescale*sizescale;
itensor[0] *= scale5;
itensor[1] *= scale5;
itensor[2] *= scale5;
itensor[3] *= scale5;
itensor[4] *= scale5;
itensor[5] *= scale5;
} else if (strstr(line,"body")) {
bodyflag = 1;
avec_body = (AtomVecBody *) atom->style_match("body");
if (!avec_body)
error->all(FLERR,"Molecule file requires atom style body");
sscanf(line,"%d %d",&nibody,&ndbody);
}
nmatch = sscanf(line,"%d %d",&nibody,&ndbody);
nwant = 2;
} else break;
else break;
if (nmatch != nwant)
error->all(FLERR,"Invalid header in molecule file");
}
// error checks
@ -493,7 +507,7 @@ void Molecule::read(int flag)
// loop over sections of molecule file
while (strlen(keyword)) {
while (strlen(keyword) > 0) {
if (strcmp(keyword,"Coords") == 0) {
xflag = 1;
if (flag) coords(line);
@ -517,22 +531,22 @@ void Molecule::read(int flag)
} else if (strcmp(keyword,"Bonds") == 0) {
if (nbonds == 0)
error->all(FLERR,"Molecule file has bonds but no nbonds setting");
error->all(FLERR,"Molecule file has bonds but no nbonds setting");
bondflag = tag_require = 1;
bonds(flag,line);
} else if (strcmp(keyword,"Angles") == 0) {
if (nangles == 0)
error->all(FLERR,"Molecule file has angles but no nangles setting");
error->all(FLERR,"Molecule file has angles but no nangles setting");
angleflag = tag_require = 1;
angles(flag,line);
} else if (strcmp(keyword,"Dihedrals") == 0) {
if (ndihedrals == 0) error->all(FLERR,"Molecule file has dihedrals "
"but no ndihedrals setting");
"but no ndihedrals setting");
dihedralflag = tag_require = 1;
dihedrals(flag,line);
} else if (strcmp(keyword,"Impropers") == 0) {
if (nimpropers == 0) error->all(FLERR,"Molecule file has impropers "
"but no nimpropers setting");
"but no nimpropers setting");
improperflag = tag_require = 1;
impropers(flag,line);
@ -552,26 +566,26 @@ void Molecule::read(int flag)
shakeatomflag = tag_require = 1;
if (shaketypeflag) shakeflag = 1;
if (!shakeflagflag)
error->all(FLERR,"Molecule file shake flags not before shake atoms");
error->all(FLERR,"Molecule file shake flags not before shake atoms");
if (flag) shakeatom_read(line);
else skip_lines(natoms,line);
} else if (strcmp(keyword,"Shake Bond Types") == 0) {
shaketypeflag = 1;
if (shakeatomflag) shakeflag = 1;
if (!shakeflagflag)
error->all(FLERR,"Molecule file shake flags not before shake bonds");
error->all(FLERR,"Molecule file shake flags not before shake bonds");
if (flag) shaketype_read(line);
else skip_lines(natoms,line);
} else if (strcmp(keyword,"Body Integers") == 0) {
if (bodyflag == 0 || nibody == 0)
error->all(FLERR,"Molecule file has body params "
error->all(FLERR,"Molecule file has body params "
"but no setting for them");
ibodyflag = 1;
body(flag,0,line);
} else if (strcmp(keyword,"Body Doubles") == 0) {
if (bodyflag == 0 || ndbody == 0)
error->all(FLERR,"Molecule file has body params "
error->all(FLERR,"Molecule file has body params "
"but no setting for them");
dbodyflag = 1;
body(flag,1,line);
@ -618,7 +632,7 @@ void Molecule::read(int flag)
// body particle must have natom = 1
// set radius by having body class compute its own radius
if (bodyflag) {
radiusflag = 1;
if (natoms != 1)
@ -641,12 +655,9 @@ void Molecule::coords(char *line)
int tmp;
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 4)
error->all(FLERR,"Invalid Coords section in molecule file");
}
sscanf(line,"%d %lg %lg %lg",&tmp,&x[i][0],&x[i][1],&x[i][2]);
if (4 != sscanf(line,"%d %lg %lg %lg",&tmp,&x[i][0],&x[i][1],&x[i][2]))
error->all(FLERR,"Invalid Coords section in molecule file");
x[i][0] *= sizescale;
x[i][1] *= sizescale;
x[i][2] *= sizescale;
@ -669,12 +680,8 @@ void Molecule::types(char *line)
int tmp;
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 2)
error->all(FLERR,"Invalid Types section in molecule file");
}
sscanf(line,"%d %d",&tmp,&type[i]);
if (2 != sscanf(line,"%d %d",&tmp,&type[i]))
error->all(FLERR,"Invalid Types section in molecule file");
type[i] += toffset;
}
@ -695,12 +702,8 @@ void Molecule::charges(char *line)
int tmp;
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 2)
error->all(FLERR,"Invalid Charges section in molecule file");
}
sscanf(line,"%d %lg",&tmp,&q[i]);
if (2 != sscanf(line,"%d %lg",&tmp,&q[i]))
error->all(FLERR,"Invalid Charges section in molecule file");
}
}
@ -714,12 +717,8 @@ void Molecule::diameters(char *line)
maxradius = 0.0;
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 2)
error->all(FLERR,"Invalid Diameters section in molecule file");
}
sscanf(line,"%d %lg",&tmp,&radius[i]);
if (2 != sscanf(line,"%d %lg",&tmp,&radius[i]))
error->all(FLERR,"Invalid Diameters section in molecule file");
radius[i] *= sizescale;
radius[i] *= 0.5;
maxradius = MAX(maxradius,radius[i]);
@ -739,12 +738,8 @@ void Molecule::masses(char *line)
int tmp;
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 2)
error->all(FLERR,"Invalid Masses section in molecule file");
}
sscanf(line,"%d %lg",&tmp,&rmass[i]);
if (2 != sscanf(line,"%d %lg",&tmp,&rmass[i]))
error->all(FLERR,"Invalid Masses section in molecule file");
rmass[i] *= sizescale*sizescale*sizescale;
}
@ -773,17 +768,13 @@ void Molecule::bonds(int flag, char *line)
for (int i = 0; i < nbonds; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 4)
error->all(FLERR,"Invalid Bonds section in molecule file");
}
sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&itype,&atom1,&atom2);
if (4 != sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&itype,&atom1,&atom2))
error->all(FLERR,"Invalid Bonds section in molecule file");
itype += boffset;
if (atom1 <= 0 || atom1 > natoms ||
atom2 <= 0 || atom2 > natoms)
atom2 <= 0 || atom2 > natoms)
error->one(FLERR,"Invalid atom ID in Bonds section of molecule file");
if (itype <= 0)
error->one(FLERR,"Invalid bond type in Bonds section of molecule file");
@ -795,10 +786,10 @@ void Molecule::bonds(int flag, char *line)
bond_atom[m][num_bond[m]] = atom2;
num_bond[m]++;
if (newton_bond == 0) {
m = atom2-1;
bond_type[m][num_bond[m]] = itype;
bond_atom[m][num_bond[m]] = atom1;
num_bond[m]++;
m = atom2-1;
bond_type[m][num_bond[m]] = itype;
bond_atom[m][num_bond[m]] = atom1;
num_bond[m]++;
}
} else {
count[atom1-1]++;
@ -835,13 +826,9 @@ void Molecule::angles(int flag, char *line)
for (int i = 0; i < nangles; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 5)
error->all(FLERR,"Invalid Angles section in molecule file");
}
sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&itype,&atom1,&atom2,&atom3);
if (5 != sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&itype,&atom1,&atom2,&atom3))
error->all(FLERR,"Invalid Angles section in molecule file");
itype += aoffset;
if (atom1 <= 0 || atom1 > natoms ||
@ -860,24 +847,24 @@ void Molecule::angles(int flag, char *line)
angle_atom3[m][num_angle[m]] = atom3;
num_angle[m]++;
if (newton_bond == 0) {
m = atom1-1;
angle_type[m][num_angle[m]] = itype;
angle_atom1[m][num_angle[m]] = atom1;
angle_atom2[m][num_angle[m]] = atom2;
angle_atom3[m][num_angle[m]] = atom3;
num_angle[m]++;
m = atom3-1;
angle_type[m][num_angle[m]] = itype;
angle_atom1[m][num_angle[m]] = atom1;
angle_atom2[m][num_angle[m]] = atom2;
angle_atom3[m][num_angle[m]] = atom3;
num_angle[m]++;
m = atom1-1;
angle_type[m][num_angle[m]] = itype;
angle_atom1[m][num_angle[m]] = atom1;
angle_atom2[m][num_angle[m]] = atom2;
angle_atom3[m][num_angle[m]] = atom3;
num_angle[m]++;
m = atom3-1;
angle_type[m][num_angle[m]] = itype;
angle_atom1[m][num_angle[m]] = atom1;
angle_atom2[m][num_angle[m]] = atom2;
angle_atom3[m][num_angle[m]] = atom3;
num_angle[m]++;
}
} else {
count[atom2-1]++;
if (newton_bond == 0) {
count[atom1-1]++;
count[atom3-1]++;
count[atom1-1]++;
count[atom3-1]++;
}
}
}
@ -911,14 +898,10 @@ void Molecule::dihedrals(int flag, char *line)
for (int i = 0; i < ndihedrals; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 6)
error->all(FLERR,"Invalid Dihedrals section in molecule file");
}
sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " "
if (6 != sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " "
TAGINT_FORMAT " " TAGINT_FORMAT " ",
&tmp,&itype,&atom1,&atom2,&atom3,&atom4);
&tmp,&itype,&atom1,&atom2,&atom3,&atom4))
error->all(FLERR,"Invalid Dihedrals section in molecule file");
itype += doffset;
if (atom1 <= 0 || atom1 > natoms ||
@ -926,10 +909,10 @@ void Molecule::dihedrals(int flag, char *line)
atom3 <= 0 || atom3 > natoms ||
atom4 <= 0 || atom4 > natoms)
error->one(FLERR,
"Invalid atom ID in dihedrals section of molecule file");
"Invalid atom ID in dihedrals section of molecule file");
if (itype <= 0)
error->one(FLERR,
"Invalid dihedral type in dihedrals section of molecule file");
"Invalid dihedral type in dihedrals section of molecule file");
if (flag) {
m = atom2-1;
@ -941,34 +924,34 @@ void Molecule::dihedrals(int flag, char *line)
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
if (newton_bond == 0) {
m = atom1-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
m = atom3-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
m = atom4-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
m = atom1-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
m = atom3-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
m = atom4-1;
dihedral_type[m][num_dihedral[m]] = itype;
dihedral_atom1[m][num_dihedral[m]] = atom1;
dihedral_atom2[m][num_dihedral[m]] = atom2;
dihedral_atom3[m][num_dihedral[m]] = atom3;
dihedral_atom4[m][num_dihedral[m]] = atom4;
num_dihedral[m]++;
}
} else {
count[atom2-1]++;
if (newton_bond == 0) {
count[atom1-1]++;
count[atom3-1]++;
count[atom4-1]++;
count[atom1-1]++;
count[atom3-1]++;
count[atom4-1]++;
}
}
}
@ -1002,14 +985,10 @@ void Molecule::impropers(int flag, char *line)
for (int i = 0; i < nimpropers; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 6)
error->all(FLERR,"Invalid Impropers section in molecule file");
}
sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " "
if (6 != sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " "
TAGINT_FORMAT " " TAGINT_FORMAT " ",
&tmp,&itype,&atom1,&atom2,&atom3,&atom4);
&tmp,&itype,&atom1,&atom2,&atom3,&atom4))
error->all(FLERR,"Invalid Impropers section in molecule file");
itype += ioffset;
if (atom1 <= 0 || atom1 > natoms ||
@ -1017,10 +996,10 @@ void Molecule::impropers(int flag, char *line)
atom3 <= 0 || atom3 > natoms ||
atom4 <= 0 || atom4 > natoms)
error->one(FLERR,
"Invalid atom ID in impropers section of molecule file");
"Invalid atom ID in impropers section of molecule file");
if (itype <= 0)
error->one(FLERR,
"Invalid improper type in impropers section of molecule file");
"Invalid improper type in impropers section of molecule file");
if (flag) {
m = atom2-1;
@ -1032,34 +1011,34 @@ void Molecule::impropers(int flag, char *line)
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
if (newton_bond == 0) {
m = atom1-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
m = atom3-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
m = atom4-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
m = atom1-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
m = atom3-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
m = atom4-1;
improper_type[m][num_improper[m]] = itype;
improper_atom1[m][num_improper[m]] = atom1;
improper_atom2[m][num_improper[m]] = atom2;
improper_atom3[m][num_improper[m]] = atom3;
improper_atom4[m][num_improper[m]] = atom4;
num_improper[m]++;
}
} else {
count[atom2-1]++;
if (newton_bond == 0) {
count[atom1-1]++;
count[atom3-1]++;
count[atom4-1]++;
count[atom1-1]++;
count[atom3-1]++;
count[atom4-1]++;
}
}
}
@ -1087,13 +1066,9 @@ void Molecule::nspecial_read(int flag, char *line)
for (int i = 0; i < natoms; i++) {
readline(line);
if (i == 0) {
int nwords = atom->count_words(line);
if (nwords != 4)
error->all(FLERR,"Invalid Special Bond Counts section in "
"molecule file");
}
sscanf(line,"%d %d %d %d",&tmp,&c1,&c2,&c3);
if (4 != sscanf(line,"%d %d %d %d",&tmp,&c1,&c2,&c3))
error->all(FLERR,"Invalid Special Bond Counts section in "
"molecule file");
if (flag) {
nspecial[i][0] = c1;
@ -1117,13 +1092,13 @@ void Molecule::special_read(char *line)
nwords = parse(line,words,maxspecial+1);
if (nwords != nspecial[i][2]+1)
error->all(FLERR,"Molecule file special list "
"does not match special count");
"does not match special count");
for (m = 1; m < nwords; m++) {
special[i][m-1] = ATOTAGINT(words[m]);
if (special[i][m-1] <= 0 || special[i][m-1] > natoms ||
special[i][m-1] == i+1)
error->all(FLERR,"Invalid special atom index in molecule file");
special[i][m-1] == i+1)
error->all(FLERR,"Invalid special atom index in molecule file");
}
}
@ -1229,7 +1204,8 @@ void Molecule::shakeflag_read(char *line)
int tmp;
for (int i = 0; i < natoms; i++) {
readline(line);
sscanf(line,"%d %d",&tmp,&shake_flag[i]);
if (2 != sscanf(line,"%d %d",&tmp,&shake_flag[i]))
error->all(FLERR,"Invalid Shake Flags section in molecule file");
}
for (int i = 0; i < natoms; i++)
@ -1243,23 +1219,32 @@ void Molecule::shakeflag_read(char *line)
void Molecule::shakeatom_read(char *line)
{
int tmp;
int tmp, nmatch, nwant;
for (int i = 0; i < natoms; i++) {
readline(line);
if (shake_flag[i] == 1)
sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1],&shake_atom[i][2]);
else if (shake_flag[i] == 2)
sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1]);
else if (shake_flag[i] == 3)
sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1],&shake_atom[i][2]);
else if (shake_flag[i] == 4)
sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " "
TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1],
&shake_atom[i][2],&shake_atom[i][3]);
if (shake_flag[i] == 1) {
nmatch = sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT
" " TAGINT_FORMAT,&tmp,&shake_atom[i][0],
&shake_atom[i][1],&shake_atom[i][2]);
nwant = 4;
} else if (shake_flag[i] == 2) {
nmatch = sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1]);
nwant = 3;
} else if (shake_flag[i] == 3) {
nmatch = sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT
" " TAGINT_FORMAT,&tmp,&shake_atom[i][0],
&shake_atom[i][1],&shake_atom[i][2]);
nwant = 4;
} else if (shake_flag[i] == 4) {
nmatch = sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " "
TAGINT_FORMAT " " TAGINT_FORMAT,
&tmp,&shake_atom[i][0],&shake_atom[i][1],
&shake_atom[i][2],&shake_atom[i][3]);
nwant = 5;
}
if (nmatch != nwant)
error->all(FLERR,"Invalid shake atom in molecule file");
}
for (int i = 0; i < natoms; i++) {
@ -1277,19 +1262,27 @@ void Molecule::shakeatom_read(char *line)
void Molecule::shaketype_read(char *line)
{
int tmp;
int tmp,nmatch,nwant;
for (int i = 0; i < natoms; i++) {
readline(line);
if (shake_flag[i] == 1)
sscanf(line,"%d %d %d %d",&tmp,
&shake_type[i][0],&shake_type[i][1],&shake_type[i][2]);
else if (shake_flag[i] == 2)
sscanf(line,"%d %d",&tmp,&shake_type[i][0]);
else if (shake_flag[i] == 3)
sscanf(line,"%d %d %d",&tmp,&shake_type[i][0],&shake_type[i][1]);
else if (shake_flag[i] == 4)
sscanf(line,"%d %d %d %d",&tmp,
&shake_type[i][0],&shake_type[i][1],&shake_type[i][2]);
if (shake_flag[i] == 1) {
nmatch = sscanf(line,"%d %d %d %d",&tmp,&shake_type[i][0],
&shake_type[i][1],&shake_type[i][2]);
nwant = 4;
} else if (shake_flag[i] == 2) {
nmatch = sscanf(line,"%d %d",&tmp,&shake_type[i][0]);
nwant = 2;
} else if (shake_flag[i] == 3) {
nmatch = sscanf(line,"%d %d %d",&tmp,&shake_type[i][0],
&shake_type[i][1]);
nwant = 3;
} else if (shake_flag[i] == 4) {
nmatch = sscanf(line,"%d %d %d %d",&tmp,&shake_type[i][0],
&shake_type[i][1],&shake_type[i][2]);
nwant = 4;
}
if (nmatch != nwant)
error->all(FLERR,"Invalid shake type data in molecule file");
}
for (int i = 0; i < natoms; i++) {
@ -1501,46 +1494,46 @@ void Molecule::allocate()
if (bondflag) {
memory->create(bond_type,natoms,bond_per_atom,
"molecule:bond_type");
"molecule:bond_type");
memory->create(bond_atom,natoms,bond_per_atom,
"molecule:bond_atom");
"molecule:bond_atom");
}
if (angleflag) {
memory->create(angle_type,natoms,angle_per_atom,
"molecule:angle_type");
"molecule:angle_type");
memory->create(angle_atom1,natoms,angle_per_atom,
"molecule:angle_atom1");
"molecule:angle_atom1");
memory->create(angle_atom2,natoms,angle_per_atom,
"molecule:angle_atom2");
"molecule:angle_atom2");
memory->create(angle_atom3,natoms,angle_per_atom,
"molecule:angle_atom3");
"molecule:angle_atom3");
}
if (dihedralflag) {
memory->create(dihedral_type,natoms,dihedral_per_atom,
"molecule:dihedral_type");
"molecule:dihedral_type");
memory->create(dihedral_atom1,natoms,dihedral_per_atom,
"molecule:dihedral_atom1");
"molecule:dihedral_atom1");
memory->create(dihedral_atom2,natoms,dihedral_per_atom,
"molecule:dihedral_atom2");
"molecule:dihedral_atom2");
memory->create(dihedral_atom3,natoms,dihedral_per_atom,
"molecule:dihedral_atom3");
"molecule:dihedral_atom3");
memory->create(dihedral_atom4,natoms,dihedral_per_atom,
"molecule:dihedral_atom4");
"molecule:dihedral_atom4");
}
if (improperflag) {
memory->create(improper_type,natoms,improper_per_atom,
"molecule:improper_type");
"molecule:improper_type");
memory->create(improper_atom1,natoms,improper_per_atom,
"molecule:improper_atom1");
"molecule:improper_atom1");
memory->create(improper_atom2,natoms,improper_per_atom,
"molecule:improper_atom2");
"molecule:improper_atom2");
memory->create(improper_atom3,natoms,improper_per_atom,
"molecule:improper_atom3");
"molecule:improper_atom3");
memory->create(improper_atom4,natoms,improper_per_atom,
"molecule:improper_atom4");
"molecule:improper_atom4");
}
if (shakeflag) {
@ -1653,7 +1646,7 @@ void Molecule::parse_keyword(int flag, char *line, char *keyword)
if (me == 0) {
if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) {
if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
}
if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1;
}

View File

@ -140,6 +140,8 @@ msi2lmp has the following known limitations:
- there is no support for auto-equivalences to supplement fully
parameterized interactions with heuristic ones
- there is no support for bond increments
- there is no support for coordinates defined by symmetry operations,
i.e. the .mdf file has to be set up for space group P1
------------------------------------------------------------------------