Compare commits
27 Commits
patch_18Oc
...
patch_19Oc
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d254780de | |||
| b0cf1ded38 | |||
| 0891ed83a5 | |||
| ffb8eb36da | |||
| 1a10857244 | |||
| 2634468676 | |||
| 58141e0559 | |||
| 393337e7cf | |||
| e0ed218cc4 | |||
| efc7b23bd8 | |||
| 566effc9c9 | |||
| 86f5b51133 | |||
| ccca642b3a | |||
| 019bc0ba0b | |||
| 7b7cb297e6 | |||
| 5a6dea7a22 | |||
| 27796b431e | |||
| 6e54443d8c | |||
| 2b47fa6653 | |||
| ae77664bdd | |||
| 4502d3276b | |||
| c5513c4f75 | |||
| 2e8edbd2b9 | |||
| da66c1e649 | |||
| e10ea91c5f | |||
| 69cb831705 | |||
| ecb03dd2df |
@ -37,6 +37,7 @@ Commands :h1
|
||||
dump_image
|
||||
dump_modify
|
||||
dump_molfile
|
||||
dump_nc
|
||||
echo
|
||||
fix
|
||||
fix_modify
|
||||
|
||||
64
doc/src/dump_nc.txt
Normal file
64
doc/src/dump_nc.txt
Normal file
@ -0,0 +1,64 @@
|
||||
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
|
||||
|
||||
:link(lws,http://lammps.sandia.gov)
|
||||
:link(ld,Manual.html)
|
||||
:link(lc,Section_commands.html#comm)
|
||||
|
||||
:line
|
||||
|
||||
dump nc command :h3
|
||||
dump nc/mpiio command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
dump ID group-ID nc N file.nc args
|
||||
dump ID group-ID nc/mpiio N file.nc args :pre
|
||||
|
||||
ID = user-assigned name for the dump :ulb,l
|
||||
group-ID = ID of the group of atoms to be imaged :l
|
||||
{nc} or {nc/mpiio} = style of dump command (other styles {atom} or {cfg} or {dcd} or {xtc} or {xyz} or {local} or {custom} are discussed on the "dump"_dump.html doc page) :l
|
||||
N = dump every this many timesteps :l
|
||||
file.nc = name of file to write to :l
|
||||
args = list of per atom data elements to dump, same as for the 'custom' dump style. :l,ule
|
||||
|
||||
[Examples:]
|
||||
|
||||
dump 1 all nc 100 traj.nc type x y z vx vy vz
|
||||
dump_modify 1 append yes at -1 global c_thermo_pe c_thermo_temp c_thermo_press :pre
|
||||
|
||||
dump 1 all nc/mpiio 1000 traj.nc id type x y z :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
Dump a snapshot of atom coordinates every N timesteps in Amber-style
|
||||
NetCDF file format. NetCDF files are binary, portable and self-describing.
|
||||
This dump style will write only one file on the root node. The dump
|
||||
style {nc} uses the "standard NetCDF library"_netcdf-home all data is
|
||||
collected on one processor and then written to the dump file. Dump style
|
||||
{nc/mpiio} used the "parallel NetCDF library"_pnetcdf-home and MPI-IO;
|
||||
it has better performance on a larger number of processors. Note that
|
||||
'nc' outputs all atoms sorted by atom tag while 'nc/mpiio' outputs in
|
||||
order of the MPI rank.
|
||||
|
||||
In addition to per-atom data, also global (i.e. not per atom, but per frame)
|
||||
quantities can be included in the dump file. This can be variables, output
|
||||
from computes or fixes data prefixed with v_, c_ and f_, respectively.
|
||||
These properties are included via "dump_modify"_dump_modify.html {global}.
|
||||
|
||||
:line
|
||||
|
||||
[Restrictions:]
|
||||
|
||||
The {nc} and {nc/mpiio} dump styles are part of the USER-NC-DUMP package.
|
||||
It is only enabled if LAMMPS was built with that package. See the "Making
|
||||
LAMMPS"_Section_start.html#start_3 section for more info.
|
||||
|
||||
:link(netcdf-home,http://www.unidata.ucar.edu/software/netcdf/)
|
||||
:link(pnetcdf-home,http://trac.mcs.anl.gov/projects/parallel-netcdf/)
|
||||
|
||||
:line
|
||||
|
||||
[Related commands:]
|
||||
|
||||
"dump"_dump.html, "dump_modify"_dump_modify.html, "undump"_undump.html
|
||||
|
||||
@ -48,6 +48,7 @@ Fixes :h1
|
||||
fix_gld
|
||||
fix_gle
|
||||
fix_gravity
|
||||
fix_halt
|
||||
fix_heat
|
||||
fix_imd
|
||||
fix_indent
|
||||
|
||||
@ -170,6 +170,7 @@ fix_gcmc.html
|
||||
fix_gld.html
|
||||
fix_gle.html
|
||||
fix_gravity.html
|
||||
fix_halt.html
|
||||
fix_heat.html
|
||||
fix_imd.html
|
||||
fix_indent.html
|
||||
|
||||
@ -106,8 +106,31 @@ more instructions on how to use the accelerated styles effectively.
|
||||
|
||||
[Mixing, shift, table, tail correction, restart, rRESPA info]:
|
||||
|
||||
These pair styles do not support mixing. Thus, coefficients for all
|
||||
I,J pairs must be specified explicitly.
|
||||
For atom type pairs I,J and I != J, the A, B, H, sigma_h, r_mh
|
||||
parameters, and the cutoff distance for these pair styles can be mixed:
|
||||
A (energy units)
|
||||
sqrt(1/B) (distance units, see below)
|
||||
H (energy units)
|
||||
sigma_h (distance units)
|
||||
r_mh (distance units)
|
||||
cutoff (distance units):ul
|
||||
|
||||
The default mix value is {geometric}.
|
||||
Only {arithmetic} and {geometric} mix values are supported.
|
||||
See the "pair_modify" command for details.
|
||||
|
||||
The A and H parameters are mixed using the same rules normally
|
||||
used to mix the "epsilon" parameter in a Lennard Jones interaction.
|
||||
The sigma_h, r_mh, and the cutoff distance are mixed using the same
|
||||
rules used to mix the "sigma" parameter in a Lennard Jones interaction.
|
||||
The B parameter is converted to a distance (sigma), before mixing
|
||||
(using sigma=B^-0.5), and converted back to a coefficient
|
||||
afterwards (using B=sigma^2).
|
||||
Negative A values are converted to positive A values (using abs(A))
|
||||
before mixing, and converted back after mixing
|
||||
(by multiplying by sign(Ai)*sign(Aj)).
|
||||
This way, if either particle is repulsive (if Ai<0 or Aj<0),
|
||||
then the default interaction between both particles will be repulsive.
|
||||
|
||||
The {gauss} style does not support the "pair_modify"_pair_modify.html
|
||||
shift option. There is no effect due to the Gaussian well beyond the
|
||||
|
||||
19
lib/netcdf/Makefile.lammps
Normal file
19
lib/netcdf/Makefile.lammps
Normal file
@ -0,0 +1,19 @@
|
||||
# Settings that the LAMMPS build will import when a package using the
|
||||
# netCDF library is installed. This tries to automate configuration
|
||||
# via the nc-config tool, which is part of the netCDF installation.
|
||||
|
||||
netcdf_SYSINC =
|
||||
netcdf_SYSLIB =
|
||||
netcdf_SYSPATH =
|
||||
|
||||
ifneq ($(shell which nc-config 2>> /dev/null),)
|
||||
netcdf_SYSINC += -DLMP_HAS_NETCDF $(shell nc-config --cflags)
|
||||
netcdf_SYSLIB += $(shell nc-config --libs)
|
||||
endif
|
||||
|
||||
ifneq ($(shell which ncmpidump 2>> /dev/null),)
|
||||
PNETCDF_PATH = $(shell which ncmpidump | sed -e 's,bin/ncmpidump,,')
|
||||
netcdf_SYSINC += -DLMP_HAS_PNETCDF -I$(PNETCDF_PATH)/include
|
||||
netcdf_SYSLIB += -lpnetcdf
|
||||
netcdf_SYSPATH += -L$(PNETCDF_PATH)/lib
|
||||
endif
|
||||
43
lib/netcdf/README
Normal file
43
lib/netcdf/README
Normal file
@ -0,0 +1,43 @@
|
||||
The Makefile.lammps file in this directory is used when building
|
||||
LAMMPS with packages that make use of the NetCDF library or its
|
||||
parallel version. The file has several settings needed to compile
|
||||
and link LAMMPS with the NetCDF and parallel NetCDF support.
|
||||
For any regular NetCDF installation, all required flags should be
|
||||
autodetected. Please note that parallel NetCDF support is
|
||||
beneficial only when you run on a machine with very many processors
|
||||
like an IBM BlueGene or Cray. For most people regular NetCDF
|
||||
support should be sufficient and not cause any performance
|
||||
penalties.
|
||||
|
||||
If you have problems compiling or linking, you may have to set
|
||||
the flags manually. There are three makefile variables
|
||||
|
||||
1) netcdf_SYSINC
|
||||
This is for setting preprocessor options and include file paths.
|
||||
Set -DLMP_HAS_NETCDF, if you have NetCDF installed.
|
||||
Set -DLMP_HAS_PNETCDF, if you have parallel NetCDF installed.
|
||||
You can have either or both defines set. If none of these are
|
||||
set, LAMMPS will compile, but the NetCDF enabled functionality
|
||||
will not be available.
|
||||
In addition you may have to point to the folder with the include
|
||||
with -I/path/to/netcdf/include
|
||||
|
||||
Example for a Fedora 24 machine with serial NetCDF installed as
|
||||
netcdf-devel-4.4.0-3.fc24.x86_64 RPM package:
|
||||
|
||||
netcdf_SYSINC = -DLMP_HAS_NETCDF -I/usr/include -I/usr/include/hdf
|
||||
|
||||
2) netcdf_SYSLIB
|
||||
This is the setting for all required libraries that need to be linked to.
|
||||
|
||||
Example for a Fedora 24 machine with serial NetCDF installed as
|
||||
netcdf-devel-4.4.0-3.fc24.x86_64 RPM package:
|
||||
|
||||
netcdf_SYSLIB = -lnetcdf
|
||||
|
||||
3) netcdf_SYSPATH
|
||||
This is the setting for the path of directories with the NetCDF libraries.
|
||||
Typically, this will be of the form -L/path/to/netcdf/lib
|
||||
|
||||
In the example from above, it can be left empty, because the Linux
|
||||
distribution provided libraries are installed in a system library location.
|
||||
4
src/.gitignore
vendored
4
src/.gitignore
vendored
@ -271,6 +271,10 @@
|
||||
/dump_custom_vtk.h
|
||||
/dump_h5md.cpp
|
||||
/dump_h5md.h
|
||||
/dump_nc.cpp
|
||||
/dump_nc.h
|
||||
/dump_nc_mpiio.cpp
|
||||
/dump_nc_mpiio.h
|
||||
/dump_xtc.cpp
|
||||
/dump_xtc.h
|
||||
/dump_xyz_mpiio.cpp
|
||||
|
||||
@ -50,14 +50,14 @@ PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \
|
||||
|
||||
PACKUSER = user-atc user-awpmd user-cg-cmm user-colvars \
|
||||
user-diffraction user-dpd user-drude user-eff user-fep user-h5md \
|
||||
user-intel user-lb user-manifold user-mgpt \
|
||||
user-misc user-molfile user-omp user-phonon user-qmmm user-qtb \
|
||||
user-intel user-lb user-manifold user-mgpt user-misc user-molfile \
|
||||
user-nc-dump user-omp user-phonon user-qmmm user-qtb \
|
||||
user-quip user-reaxc user-smd user-smtbq user-sph user-tally \
|
||||
user-vtk
|
||||
|
||||
PACKLIB = compress gpu kim kokkos meam mpiio poems python reax voronoi \
|
||||
user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \
|
||||
user-qmmm user-quip user-vtk
|
||||
user-nc-dump user-qmmm user-quip user-smd user-vtk
|
||||
|
||||
PACKALL = $(PACKAGE) $(PACKUSER)
|
||||
|
||||
|
||||
@ -795,7 +795,7 @@ void PRD::replicate(int ireplica)
|
||||
|
||||
if (cmode == SINGLE_PROC_DIRECT) {
|
||||
MPI_Bcast(atom->x[0],3*atom->nlocal,MPI_DOUBLE,ireplica,comm_replica);
|
||||
MPI_Bcast(atom->image,atom->nlocal,MPI_INT,ireplica,comm_replica);
|
||||
MPI_Bcast(atom->image,atom->nlocal,MPI_LMP_IMAGEINT,ireplica,comm_replica);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -815,9 +815,9 @@ void PRD::replicate(int ireplica)
|
||||
memcpy(imageall,image,nlocal*sizeof(imageint));
|
||||
}
|
||||
|
||||
MPI_Bcast(tagall,natoms,MPI_INT,ireplica,comm_replica);
|
||||
MPI_Bcast(tagall,natoms,MPI_LMP_TAGINT,ireplica,comm_replica);
|
||||
MPI_Bcast(xall[0],3*natoms,MPI_DOUBLE,ireplica,comm_replica);
|
||||
MPI_Bcast(imageall,natoms,MPI_INT,ireplica,comm_replica);
|
||||
MPI_Bcast(imageall,natoms,MPI_LMP_IMAGEINT,ireplica,comm_replica);
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
m = atom->map(tagall[i]);
|
||||
@ -844,8 +844,8 @@ void PRD::replicate(int ireplica)
|
||||
displacements[i+1] = displacements[i] + counts[i];
|
||||
MPI_Gatherv(atom->tag,atom->nlocal,MPI_LMP_TAGINT,
|
||||
tagall,counts,displacements,MPI_LMP_TAGINT,0,world);
|
||||
MPI_Gatherv(atom->image,atom->nlocal,MPI_LMP_TAGINT,
|
||||
imageall,counts,displacements,MPI_LMP_TAGINT,0,world);
|
||||
MPI_Gatherv(atom->image,atom->nlocal,MPI_LMP_IMAGEINT,
|
||||
imageall,counts,displacements,MPI_LMP_IMAGEINT,0,world);
|
||||
for (i = 0; i < nprocs; i++) counts[i] *= 3;
|
||||
for (i = 0; i < nprocs-1; i++)
|
||||
displacements[i+1] = displacements[i] + counts[i];
|
||||
@ -854,13 +854,13 @@ void PRD::replicate(int ireplica)
|
||||
}
|
||||
|
||||
if (me == 0) {
|
||||
MPI_Bcast(tagall,natoms,MPI_INT,ireplica,comm_replica);
|
||||
MPI_Bcast(imageall,natoms,MPI_INT,ireplica,comm_replica);
|
||||
MPI_Bcast(tagall,natoms,MPI_LMP_TAGINT,ireplica,comm_replica);
|
||||
MPI_Bcast(imageall,natoms,MPI_LMP_IMAGEINT,ireplica,comm_replica);
|
||||
MPI_Bcast(xall[0],3*natoms,MPI_DOUBLE,ireplica,comm_replica);
|
||||
}
|
||||
|
||||
MPI_Bcast(tagall,natoms,MPI_INT,0,world);
|
||||
MPI_Bcast(imageall,natoms,MPI_INT,0,world);
|
||||
MPI_Bcast(tagall,natoms,MPI_LMP_TAGINT,0,world);
|
||||
MPI_Bcast(imageall,natoms,MPI_LMP_IMAGEINT,0,world);
|
||||
MPI_Bcast(xall[0],3*natoms,MPI_DOUBLE,0,world);
|
||||
|
||||
double **x = atom->x;
|
||||
|
||||
@ -39,6 +39,7 @@ using namespace MathConst;
|
||||
PairGaussCut::PairGaussCut(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
respa_enable = 0;
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -96,7 +97,6 @@ void PairGaussCut::compute(int eflag, int vflag)
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
@ -221,7 +221,21 @@ void PairGaussCut::coeff(int narg, char **arg)
|
||||
|
||||
double PairGaussCut::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||
if (setflag[i][j] == 0) {
|
||||
hgauss[i][j] = mix_energy(fabs(hgauss[i][i]), fabs(hgauss[j][j]),
|
||||
fabs(sigmah[i][i]), fabs(sigmah[j][j]));
|
||||
|
||||
// If either of the particles is repulsive (ie, if hgauss > 0),
|
||||
// then the interaction between both is repulsive.
|
||||
double sign_hi = (hgauss[i][i] >= 0.0) ? 1.0 : -1.0;
|
||||
double sign_hj = (hgauss[j][j] >= 0.0) ? 1.0 : -1.0;
|
||||
hgauss[i][j] *= MAX(sign_hi, sign_hj);
|
||||
|
||||
sigmah[i][j] = mix_distance(sigmah[i][i], sigmah[j][j]);
|
||||
rmh[i][j] = mix_distance(rmh[i][i], rmh[j][j]);
|
||||
cut[i][j] = mix_distance(cut[i][i], cut[j][j]);
|
||||
}
|
||||
|
||||
pgauss[i][j] = hgauss[i][j] / sqrt(MY_2PI) / sigmah[i][j];
|
||||
|
||||
if (offset_flag) {
|
||||
@ -334,6 +348,27 @@ void PairGaussCut::read_restart_settings(FILE *fp)
|
||||
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairGaussCut::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
fprintf(fp,"%d %g %g %g\n",i,hgauss[i][i],rmh[i][i],sigmah[i][i]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairGaussCut::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
fprintf(fp,"%d %d %g %g %g %g\n",i,j,hgauss[i][j],rmh[i][j],sigmah[i][j],cut[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairGaussCut::single(int i, int j, int itype, int jtype, double rsq,
|
||||
|
||||
@ -42,6 +42,8 @@ class PairGaussCut : public Pair {
|
||||
virtual void read_restart(FILE *);
|
||||
virtual void write_restart_settings(FILE *);
|
||||
virtual void read_restart_settings(FILE *);
|
||||
virtual void write_data(FILE *fp);
|
||||
virtual void write_data_all(FILE *fp);
|
||||
|
||||
virtual double memory_usage();
|
||||
|
||||
|
||||
63
src/USER-NC-DUMP/Install.sh
Normal file
63
src/USER-NC-DUMP/Install.sh
Normal file
@ -0,0 +1,63 @@
|
||||
# Install/unInstall package files in LAMMPS
|
||||
# mode = 0/1/2 for uninstall/install/update
|
||||
|
||||
mode=$1
|
||||
|
||||
# enforce using portable C locale
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# arg1 = file, arg2 = file it depends on
|
||||
|
||||
action () {
|
||||
if (test $mode = 0) then
|
||||
rm -f ../$1
|
||||
elif (! cmp -s $1 ../$1) then
|
||||
if (test -z "$2" || test -e ../$2) then
|
||||
cp $1 ..
|
||||
if (test $mode = 2) then
|
||||
echo " updating src/$1"
|
||||
fi
|
||||
fi
|
||||
elif (test -n "$2") then
|
||||
if (test ! -e ../$2) then
|
||||
rm -f ../$1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
for file in *.cpp *.h; do
|
||||
action $file
|
||||
done
|
||||
|
||||
# edit 2 Makefile.package files to include/exclude package info
|
||||
|
||||
if (test $1 = 1) then
|
||||
|
||||
if (test -e ../Makefile.package) then
|
||||
sed -i -e 's/[^ \t]*netcdf[^ \t]* //g' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(netcdf_SYSINC) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(netcdf_SYSLIB) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(netcdf_SYSPATH) |' ../Makefile.package
|
||||
fi
|
||||
|
||||
if (test -e ../Makefile.package.settings) then
|
||||
sed -i -e '/^include.*netcdf.*$/d' ../Makefile.package.settings
|
||||
# multiline form needed for BSD sed on Macs
|
||||
sed -i -e '4 i \
|
||||
include ..\/..\/lib\/netcdf\/Makefile.lammps
|
||||
' ../Makefile.package.settings
|
||||
|
||||
fi
|
||||
|
||||
elif (test $1 = 0) then
|
||||
|
||||
if (test -e ../Makefile.package) then
|
||||
sed -i -e 's/[^ \t]*netcdf[^ \t]* //g' ../Makefile.package
|
||||
fi
|
||||
|
||||
if (test -e ../Makefile.package.settings) then
|
||||
sed -i -e '/^include.*netcdf.*$/d' ../Makefile.package.settings
|
||||
fi
|
||||
|
||||
fi
|
||||
39
src/USER-NC-DUMP/README
Normal file
39
src/USER-NC-DUMP/README
Normal file
@ -0,0 +1,39 @@
|
||||
USER-NC-DUMP
|
||||
============
|
||||
|
||||
This package provides the nc and (optionally) the nc/mpiio dump styles.
|
||||
See the doc page for dump nc or dump nc/mpiio command for how to use them.
|
||||
Compiling these dump styles requires having the netCDF library installed
|
||||
on your system. See lib/netcdf/README for additional details.
|
||||
|
||||
PACKAGE DESCRIPTION
|
||||
-------------------
|
||||
|
||||
This is a LAMMPS (http://lammps.sandia.gov/) dump style for output into a NetCDF
|
||||
database. The database format follows the AMBER NetCDF trajectory convention
|
||||
(http://ambermd.org/netcdf/nctraj.xhtml), but includes extensions to this
|
||||
convention. These extension are:
|
||||
* A variable "cell_origin" (of dimension "frame", "cell_spatial") that contains
|
||||
the bottom left corner of the simulation cell.
|
||||
* Any number of additional variables corresponding to per atom scalar, vector
|
||||
or tensor quantities available within LAMMPS. Tensor quantities are written in
|
||||
Voigt notation. An additional dimension "Voigt" of length 6 is created for
|
||||
this purpose.
|
||||
* Possibility to output to an HDF5 database.
|
||||
|
||||
NetCDF files can be directly visualized with the following tools:
|
||||
* Ovito (http://www.ovito.org/). Ovito supports the AMBER convention and all of
|
||||
the above extensions.
|
||||
* VMD (http://www.ks.uiuc.edu/Research/vmd/).
|
||||
* AtomEye (http://www.libatoms.org/). The libAtoms version of AtomEye contains
|
||||
a NetCDF reader that is not present in the standard distribution of AtomEye.
|
||||
|
||||
The person who created these files is Lars Pastewka at
|
||||
Karlsruhe Institute of Technology (lars.pastewka@kit.edu).
|
||||
Contact him directly if you have questions.
|
||||
|
||||
Lars Pastewka
|
||||
Institute for Applied Materials (IAM)
|
||||
Karlsruhe Institute of Technology (KIT)
|
||||
Kaiserstrasse 12, 76131 Karlsruhe
|
||||
e-mail: lars.pastewka@kit.edu
|
||||
1147
src/USER-NC-DUMP/dump_nc.cpp
Normal file
1147
src/USER-NC-DUMP/dump_nc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
143
src/USER-NC-DUMP/dump_nc.h
Normal file
143
src/USER-NC-DUMP/dump_nc.h
Normal file
@ -0,0 +1,143 @@
|
||||
/* ======================================================================
|
||||
LAMMPS NetCDF dump style
|
||||
https://github.com/pastewka/lammps-netcdf
|
||||
Lars Pastewka, lars.pastewka@kit.edu
|
||||
|
||||
Copyright (2011-2013) Fraunhofer IWM
|
||||
Copyright (2014) Karlsruhe Institute of Technology
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
====================================================================== */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
#if defined(LMP_HAS_NETCDF)
|
||||
|
||||
#ifdef DUMP_CLASS
|
||||
|
||||
DumpStyle(nc,DumpNC)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_DUMP_NC_H
|
||||
#define LMP_DUMP_NC_H
|
||||
|
||||
#include "dump_custom.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
const int NC_FIELD_NAME_MAX = 100;
|
||||
const int DUMP_NC_MAX_DIMS = 100;
|
||||
|
||||
class DumpNC : public DumpCustom {
|
||||
public:
|
||||
DumpNC(class LAMMPS *, int, char **);
|
||||
virtual ~DumpNC();
|
||||
virtual void write();
|
||||
|
||||
private:
|
||||
// per-atoms quantities (positions, velocities, etc.)
|
||||
struct nc_perat_t {
|
||||
int dims; // number of dimensions
|
||||
int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim.
|
||||
char name[NC_FIELD_NAME_MAX]; // field name
|
||||
int var; // NetCDF variable
|
||||
|
||||
bool constant; // is this property per file (not per frame)
|
||||
int ndumped; // number of enties written for this prop.
|
||||
};
|
||||
|
||||
typedef void (DumpNC::*funcptr_t)(void *);
|
||||
|
||||
// per-frame quantities (variables, fixes or computes)
|
||||
struct nc_perframe_t {
|
||||
char name[NC_FIELD_NAME_MAX]; // field name
|
||||
int var; // NetCDF variable
|
||||
int type; // variable, fix, compute or callback
|
||||
int index; // index in fix/compute list
|
||||
funcptr_t compute; // compute function
|
||||
int dim; // dimension
|
||||
char id[NC_FIELD_NAME_MAX]; // variable id
|
||||
|
||||
bigint bigint_data; // actual data
|
||||
double double_data; // actual data
|
||||
};
|
||||
|
||||
int framei; // current frame index
|
||||
int blocki; // current block index
|
||||
int ndata; // number of data blocks to expect
|
||||
|
||||
bigint ntotalgr; // # of atoms
|
||||
|
||||
int n_perat; // # of netcdf per-atom properties
|
||||
nc_perat_t *perat; // per-atom properties
|
||||
|
||||
int n_perframe; // # of global netcdf (not per-atom) fix props
|
||||
nc_perframe_t *perframe; // global properties
|
||||
|
||||
bool double_precision; // write everything as double precision
|
||||
|
||||
bigint n_buffer; // size of buffer
|
||||
int *int_buffer; // buffer for passing data to netcdf
|
||||
double *double_buffer; // buffer for passing data to netcdf
|
||||
|
||||
int ncid;
|
||||
|
||||
int frame_dim;
|
||||
int spatial_dim;
|
||||
int Voigt_dim;
|
||||
int atom_dim;
|
||||
int cell_spatial_dim;
|
||||
int cell_angular_dim;
|
||||
int label_dim;
|
||||
|
||||
int spatial_var;
|
||||
int cell_spatial_var;
|
||||
int cell_angular_var;
|
||||
|
||||
int time_var;
|
||||
int cell_origin_var;
|
||||
int cell_lengths_var;
|
||||
int cell_angles_var;
|
||||
|
||||
virtual void openfile();
|
||||
void closefile();
|
||||
virtual void write_header(bigint);
|
||||
virtual void write_data(int, double *);
|
||||
void write_prmtop();
|
||||
|
||||
virtual int modify_param(int, char **);
|
||||
|
||||
void ncerr(int, const char *, int);
|
||||
|
||||
void compute_step(void *);
|
||||
void compute_elapsed(void *);
|
||||
void compute_elapsed_long(void *);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif /* defined(LMP_HAS_NETCDF) */
|
||||
1077
src/USER-NC-DUMP/dump_nc_mpiio.cpp
Normal file
1077
src/USER-NC-DUMP/dump_nc_mpiio.cpp
Normal file
File diff suppressed because it is too large
Load Diff
140
src/USER-NC-DUMP/dump_nc_mpiio.h
Normal file
140
src/USER-NC-DUMP/dump_nc_mpiio.h
Normal file
@ -0,0 +1,140 @@
|
||||
/* ======================================================================
|
||||
LAMMPS NetCDF dump style
|
||||
https://github.com/pastewka/lammps-netcdf
|
||||
Lars Pastewka, lars.pastewka@kit.edu
|
||||
|
||||
Copyright (2011-2013) Fraunhofer IWM
|
||||
Copyright (2014) Karlsruhe Institute of Technology
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
====================================================================== */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
#if defined(LMP_HAS_PNETCDF)
|
||||
|
||||
#ifdef DUMP_CLASS
|
||||
|
||||
DumpStyle(nc/mpiio,DumpNCMPIIO)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_DUMP_NC_MPIIO_H
|
||||
#define LMP_DUMP_NC_MPIIO_H
|
||||
|
||||
#include "dump_custom.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
const int NC_MPIIO_FIELD_NAME_MAX = 100;
|
||||
const int DUMP_NC_MPIIO_MAX_DIMS = 100;
|
||||
|
||||
class DumpNCMPIIO : public DumpCustom {
|
||||
public:
|
||||
DumpNCMPIIO(class LAMMPS *, int, char **);
|
||||
virtual ~DumpNCMPIIO();
|
||||
virtual void write();
|
||||
|
||||
private:
|
||||
// per-atoms quantities (positions, velocities, etc.)
|
||||
struct nc_perat_t {
|
||||
int dims; // number of dimensions
|
||||
int field[DUMP_NC_MPIIO_MAX_DIMS]; // field indices corresponding to the dim.
|
||||
char name[NC_MPIIO_FIELD_NAME_MAX]; // field name
|
||||
int var; // NetCDF variable
|
||||
};
|
||||
|
||||
typedef void (DumpNCMPIIO::*funcptr_t)(void *);
|
||||
|
||||
// per-frame quantities (variables, fixes or computes)
|
||||
struct nc_perframe_t {
|
||||
char name[NC_MPIIO_FIELD_NAME_MAX]; // field name
|
||||
int var; // NetCDF variable
|
||||
int type; // variable, fix, compute or callback
|
||||
int index; // index in fix/compute list
|
||||
funcptr_t compute; // compute function
|
||||
int dim; // dimension
|
||||
char id[NC_MPIIO_FIELD_NAME_MAX]; // variable id
|
||||
|
||||
bigint bigint_data; // actual data
|
||||
double double_data; // actual data
|
||||
};
|
||||
|
||||
int framei; // current frame index
|
||||
int blocki; // current block index
|
||||
int ndata; // number of data blocks to expect
|
||||
|
||||
bigint ntotalgr; // # of atoms
|
||||
|
||||
int n_perat; // # of netcdf per-atom properties
|
||||
nc_perat_t *perat; // per-atom properties
|
||||
|
||||
int n_perframe; // # of global netcdf (not per-atom) fix props
|
||||
nc_perframe_t *perframe; // global properties
|
||||
|
||||
bool double_precision; // write everything as double precision
|
||||
|
||||
bigint n_buffer; // size of buffer
|
||||
int *int_buffer; // buffer for passing data to netcdf
|
||||
double *double_buffer; // buffer for passing data to netcdf
|
||||
|
||||
int ncid;
|
||||
|
||||
int frame_dim;
|
||||
int spatial_dim;
|
||||
int Voigt_dim;
|
||||
int atom_dim;
|
||||
int cell_spatial_dim;
|
||||
int cell_angular_dim;
|
||||
int label_dim;
|
||||
|
||||
int spatial_var;
|
||||
int cell_spatial_var;
|
||||
int cell_angular_var;
|
||||
|
||||
int time_var;
|
||||
int cell_origin_var;
|
||||
int cell_lengths_var;
|
||||
int cell_angles_var;
|
||||
|
||||
virtual void openfile();
|
||||
void closefile();
|
||||
void write_time_and_cell();
|
||||
virtual void write_data(int, double *);
|
||||
void write_prmtop();
|
||||
|
||||
virtual int modify_param(int, char **);
|
||||
|
||||
void ncerr(int, const char *, int);
|
||||
|
||||
void compute_step(void *);
|
||||
void compute_elapsed(void *);
|
||||
void compute_elapsed_long(void *);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif /* defined(LMP_HAS_PNETCDF) */
|
||||
@ -148,7 +148,7 @@ int ComputeBondLocal::compute_bonds(int flag)
|
||||
double vvib,vrotsq;
|
||||
double inertia,omegasq;
|
||||
double mvv2e;
|
||||
double engpot,engtrans,engvib,engrot,engtot,fbond;
|
||||
double engpot,engtrans,engvib,engrot,fbond;
|
||||
double *ptr;
|
||||
|
||||
double **x = atom->x;
|
||||
|
||||
@ -874,7 +874,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
format_float_user = NULL;
|
||||
// pass format none to child classes which may use it
|
||||
// not an error if they don't
|
||||
int n = modify_param(narg-iarg,&arg[iarg]);
|
||||
modify_param(narg-iarg,&arg[iarg]);
|
||||
iarg += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMRDS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
|
||||
@ -194,10 +194,8 @@ void FixHalt::post_run()
|
||||
double FixHalt::bondmax()
|
||||
{
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
int **bondlist = neighbor->bondlist;
|
||||
int nbondlist = neighbor->nbondlist;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
int i1,i2;
|
||||
double delx,dely,delz,rsq;
|
||||
|
||||
@ -1079,3 +1079,10 @@ bool Info::has_exceptions() const {
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
char **Info::get_variable_names(int &num) {
|
||||
num = input->variable->nvar;
|
||||
return input->variable->names;
|
||||
}
|
||||
|
||||
@ -39,6 +39,8 @@ class Info : protected Pointers {
|
||||
bool has_ffmpeg_support() const;
|
||||
bool has_exceptions() const;
|
||||
|
||||
char **get_variable_names(int &num);
|
||||
|
||||
private:
|
||||
void available_styles(FILE * out, int flags);
|
||||
|
||||
|
||||
@ -89,6 +89,7 @@ typedef int64_t bigint;
|
||||
#define MAXBIGINT INT64_MAX
|
||||
|
||||
#define MPI_LMP_TAGINT MPI_INT
|
||||
#define MPI_LMP_IMAGEINT MPI_INT
|
||||
#define MPI_LMP_BIGINT MPI_LL
|
||||
|
||||
#define TAGINT_FORMAT "%d"
|
||||
@ -120,6 +121,7 @@ typedef int64_t bigint;
|
||||
#define MAXBIGINT INT64_MAX
|
||||
|
||||
#define MPI_LMP_TAGINT MPI_LL
|
||||
#define MPI_LMP_IMAGEINT MPI_LL
|
||||
#define MPI_LMP_BIGINT MPI_LL
|
||||
|
||||
#define TAGINT_FORMAT "%" PRId64
|
||||
@ -150,6 +152,7 @@ typedef int bigint;
|
||||
#define MAXBIGINT INT_MAX
|
||||
|
||||
#define MPI_LMP_TAGINT MPI_INT
|
||||
#define MPI_LMP_IMAGEINT MPI_INT
|
||||
#define MPI_LMP_BIGINT MPI_INT
|
||||
|
||||
#define TAGINT_FORMAT "%d"
|
||||
|
||||
@ -232,8 +232,8 @@ void Neighbor::skip_from_granular(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,dnum,dnumbytes;
|
||||
tagint jtag;
|
||||
int *neighptr,*jlist,*touchptr,*touchptr_skip;
|
||||
double *shearptr,*shearptr_skip;
|
||||
int *neighptr,*jlist,*touchptr;
|
||||
double *shearptr;
|
||||
|
||||
NeighList *listgranhistory;
|
||||
int *npartner;
|
||||
@ -364,8 +364,8 @@ void Neighbor::skip_from_granular_off2on(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,dnum,dnumbytes;
|
||||
tagint itag,jtag;
|
||||
int *neighptr,*jlist,*touchptr,*touchptr_skip;
|
||||
double *shearptr,*shearptr_skip;
|
||||
int *neighptr,*jlist,*touchptr;
|
||||
double *shearptr;
|
||||
|
||||
NeighList *listgranhistory;
|
||||
int *npartner;
|
||||
@ -502,8 +502,8 @@ void Neighbor::skip_from_granular_off2on(NeighList *list)
|
||||
void Neighbor::skip_from_granular_off2on_onesided(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,flip,dnum,dnumbytes,tmp;
|
||||
tagint itag,jtag;
|
||||
int *surf,*neighptr,*jlist;
|
||||
tagint jtag;
|
||||
int *surf,*jlist;
|
||||
|
||||
NeighList *listgranhistory;
|
||||
int *npartner;
|
||||
@ -571,7 +571,6 @@ void Neighbor::skip_from_granular_off2on_onesided(NeighList *list)
|
||||
i = ilist_skip[ii];
|
||||
itype = type[i];
|
||||
if (iskip[itype]) continue;
|
||||
itag = tag[i];
|
||||
|
||||
n = 0;
|
||||
|
||||
@ -625,7 +624,6 @@ void Neighbor::skip_from_granular_off2on_onesided(NeighList *list)
|
||||
i = ilist_skip[ii];
|
||||
itype = type[i];
|
||||
if (iskip[itype]) continue;
|
||||
itag = tag[i];
|
||||
|
||||
// loop over parent non-skip granular list and optionally its history info
|
||||
|
||||
|
||||
@ -34,10 +34,11 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairGauss::PairGauss(LAMMPS *lmp) :Pair(lmp)
|
||||
PairGauss::PairGauss(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
nextra = 1;
|
||||
pvector = new double[1];
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -187,7 +188,7 @@ void PairGauss::coeff(int narg, char **arg)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo, ihi, jlo, jhi;
|
||||
int ilo,ihi,jlo,jhi;
|
||||
force->bounds(arg[0],atom->ntypes,ilo,ihi);
|
||||
force->bounds(arg[1],atom->ntypes,jlo,jhi);
|
||||
|
||||
@ -204,7 +205,7 @@ void PairGauss::coeff(int narg, char **arg)
|
||||
b[i][j] = b_one;
|
||||
cut[i][j] = cut_one;
|
||||
setflag[i][j] = 1;
|
||||
count++ ;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,12 +218,27 @@ void PairGauss::coeff(int narg, char **arg)
|
||||
|
||||
double PairGauss::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
double sign_bi = (b[i][i] >= 0.0) ? 1.0 : -1.0;
|
||||
double sign_bj = (b[j][j] >= 0.0) ? 1.0 : -1.0;
|
||||
double si = sqrt(0.5/fabs(b[i][i]));
|
||||
double sj = sqrt(0.5/fabs(b[j][j]));
|
||||
double sij = mix_distance(si, sj);
|
||||
b[i][j] = 0.5 / (sij*sij);
|
||||
b[i][j] *= MAX(sign_bi, sign_bj);
|
||||
|
||||
// This error is triggered when ti is performed on lj/cut tail
|
||||
// in presence of extra atom type for tether sites
|
||||
// "i = 2 j = 1 ERROR: All pair coeffs are not set (pair_gauss.cpp:223)"
|
||||
// if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||
// Negative "a" values are useful for simulating repulsive particles.
|
||||
// If either of the particles is repulsive (a<0), then the
|
||||
// interaction between both is repulsive.
|
||||
double sign_ai = (a[i][i] >= 0.0) ? 1.0 : -1.0;
|
||||
double sign_aj = (a[j][j] >= 0.0) ? 1.0 : -1.0;
|
||||
a[i][j] = mix_energy(fabs(a[i][i]), fabs(a[j][j]), si, sj);
|
||||
a[i][j] *= MIN(sign_ai, sign_aj);
|
||||
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
||||
// cutoff correction to energy
|
||||
if (offset_flag) offset[i][j] = a[i][j]*exp(-b[i][j]*cut[i][j]*cut[i][j]);
|
||||
else offset[i][j] = 0.0;
|
||||
|
||||
@ -260,7 +276,6 @@ void PairGauss::write_restart(FILE *fp)
|
||||
void PairGauss::read_restart(FILE *fp)
|
||||
{
|
||||
read_restart_settings(fp);
|
||||
|
||||
allocate();
|
||||
|
||||
int i,j;
|
||||
@ -309,6 +324,27 @@ void PairGauss::read_restart_settings(FILE *fp)
|
||||
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairGauss::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
fprintf(fp,"%d %g %g\n",i,a[i][i],b[i][i]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairGauss::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
fprintf(fp,"%d %d %g %g %g\n",i,j,a[i][j],b[i][j],cut[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairGauss::single(int i, int j, int itype, int jtype, double rsq,
|
||||
|
||||
@ -36,6 +36,8 @@ class PairGauss : public Pair {
|
||||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
void write_data(FILE *fp);
|
||||
void write_data_all(FILE *fp);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(const char *, int &);
|
||||
|
||||
|
||||
@ -517,7 +517,6 @@ void Region::set_velocity()
|
||||
|
||||
void Region::velocity_contact(double *vwall, double *x, int ic)
|
||||
{
|
||||
Contact c = contact[ic];
|
||||
double xc[3];
|
||||
|
||||
vwall[0] = vwall[1] = vwall[2] = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user