Merged master into hybrid_parallelizaiton

This commit is contained in:
Richard Berger
2015-01-30 01:29:13 +01:00
parent 52ce03ced9
commit c9df55c82e
150 changed files with 1968 additions and 5631 deletions

5
README
View File

@ -1,4 +1,5 @@
This is the LIGGGHTS software package.
This is the LIGGGHTS software package, released by DCS Computing
www.dcs-computing.com
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
@ -6,7 +7,7 @@ Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Christoph Kloss, christoph.kloss@cfdem.com
Christoph Kloss, christoph.kloss@dcs-computing.com
Copyright 2009-2012 JKU Linz
Copyright 2012- DCS Computing GmbH, Linz

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
doc/Eqs/fix_sph_integrity_eq1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq2.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq3.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq4.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq5.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
doc/Eqs/fix_sph_mixidx_eq6.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
doc/Eqs/fix_sph_velgrad_eq1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
doc/Eqs/model_C2_part_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
doc/Eqs/roughnessLength.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

View File

@ -14,7 +14,7 @@ atom_style style args :pre
style = {angle} or {atomic} or {body} or {bond} or {charge} or {dipole} or \
{electron} or {ellipsoid} or {full} or {line} or {meso} or \
{molecular} or {peri} or {sphere} or {granular} or {tri} or {hybrid} or {sph} :ul
{molecular} or {peri} or {sphere} or {granular} or {bond/gran} or {tri} or {hybrid} or {sph} :ul
args = none for any style except {body} and {hybrid}
{body} args = bstyle bstyle-args
bstyle = style of body particles
@ -60,6 +60,7 @@ quantities.
{atomic} | only the default values | coarse-grain liquids, solids, metals |
{body} | mass, inertia moments, quaternion, angular momentum | arbitrary bodies |
{bond} | bonds | bead-spring polymers |
{bond/gran} | number of bonds and bond information | granular bond models |
{charge} | charge | atomic system with charges |
{dipole} | charge and dipole moment | system with dipolar particles |
{electron} | charge and spin and eradius | electronic force field |
@ -97,7 +98,23 @@ basis.
For the {sphere} style, the particles are spheres and each stores a
per-particle diameter and mass. If the diameter > 0.0, the particle
is a finite-size sphere. If the diameter = 0.0, it is a point
particle.
particle. This is typically used for granular models. Instead of
{sphere}, keyword {granular} can be used.
For the {bond/gran} style, the number of granular bonds per atom is
stored, and the information associated to it: the type of each bond,
the ID of the bonded partner atom and the so-called bond history.
The bond history is similar to the contact history for granular
interaction, it stores the internal state of the bond. What exactly
is stored in this internal state is defined by the granular
"bond style"_bond_gran.html used. There are 2 parameters: The number
of bond types, and the maximum number of bonds that each atom can
have. For each bond type, the parameters have to be specified via the
"bond_coeff"_bond_coeff.html command (see example "here"_bond_gran.html )
Note that {bond/gran} is an experimental code which is may not be
available in your release of LIGGGHTS. An example for the sytnax is given below:
atom_style bond/gran n_bondtypes 1 bonds_per_atom 6 :pre
For the {ellipsoid} style, the particles are ellipsoids and each
stores a flag which indicates whether it is a finite-size ellipsoid or

View File

@ -81,7 +81,8 @@ separately for the x-, y-, and z-axis.
This fix stores a global vector with 6 components for access by various "output commands"_Section_howto.html#4_15.
The first 3 components are equal to the total force on the mesh, the last 3 components store the total torque
on the body. Please note that as opposed to "fix mesh/surface/stress"_fix_mesh_surface_stress.html,
on the body. The last 3 components store the position of the center of mass of the body.
Please note that as opposed to "fix mesh/surface/stress"_fix_mesh_surface_stress.html,
the total force and torque contain the contributions of the particles, gravity and the suspension
model (if activated).
Furthermore, this fix writes the state of the rigid body (translational and rotational) to binary restart files so

View File

@ -29,10 +29,12 @@ values_spheres = one out of the following options :l
option 3 = {x1 y1 z1 r1 x2 y2 r2...} where x/y/z are sphere positions and r are the radii :pre
type = obligatory keyword :l
mt = multisphere type of the template :l
opt_keyword = {mass} or {inertia_tensor} :l
opt_keyword = {mass} or {inertia_tensor} or {use_volume} or {use_density} :l
{mass} value = mass assigned to this particle template
{inertia_tensor} values = Ixx Ixy Ixz Iyy Iyz Izz
Ixx Ixy Ixz Iyy Iyz Izz = 6 independant components of the inertia tensor :pre
Ixx Ixy Ixz Iyy Iyz Izz = 6 independant components of the inertia tensor
{use_volume} = particle density calculated from mass and volume (only if keyword 'mass' is used')
{use_density} = particle volume calculated from mass and density (only if keyword 'mass' is used') :pre
:ule
@ -70,7 +72,19 @@ and the inertia tensor including its eigensystem.
As an alternative, the body's mass and inertia tensor can be specified
directly via keywords {mass} and {inertia_tensor}. Note that you can
use these keywords only together, i.e. defining only {mass} but not
{inertia_tensor} will throw an error.
{inertia_tensor} will throw an error. Also note that only 2 out of the
3 variables density, mass and volume are independant. Thus, you are
offered two options when {mass} and {inertia_tensor} are used:
(a) if keyword {use_volume} is specified, LIGGGHTS will use the
specified {mass} and volume_mc (the volume of the particle template
calculated by the Monte Carlo procedure), and calculate the density from
these two variables.
(b) if keyword {use_density} is used, LIGGGHTS will use the specified
{mass} and the specified {density} (see doc of
"fix particletemplate/sphere"_fix_particletemplate_sphere.html command),
and the volume of the clump is then calculated from these two variables.
Note you have to use either {use_volume} or {use_density} in case
{mass} and {inertia_tensor} are used.
The multisphere type or shape type as defined via the {type} keyword must
be unique integer given to each fix particletemplate/multisphere

View File

@ -52,8 +52,8 @@ general_keyword = {shear} or {store_force} or {store_force_contact} :l
{store_force_contact} value = 'yes' or 'no'
yes, no = determines if the force for each particle-wall contact is stored in a "fix property/atom"_fix_property.html with id contactforces_(ID), where (ID) is the id of the fix wall/gran command. :pre
following the general_keyword/value pairs, zero or more model_keyword/model_valuezero pairs may be appended in arbitrary order :l
model_type/model_name pairs = described for each model separately "here"_Section_gran_models.html
following the general_keyword/value pairs, zero or more model_keyword/model_value pairs may be appended in arbitrary order :l
model_keyword/model_value pairs = described for each model separately "here"_Section_gran_models.html
:ule
[Examples:]

View File

@ -11,7 +11,7 @@ gran model hertz :h3
[Syntax:]
model hertz [other model_type/model_name pairs as described "here"_pair_gran.html] keyword values :pre
model hertz \[other model_type/model_name pairs as described "here"_pair_gran.html \] keyword values :pre
zero or more keyword/value pairs may be appended :l
{limitForce} values = 'on' or 'off'
on = ensures that the normal force is never attractive (an artefact that can occur at the end of a collision).

View File

@ -11,7 +11,7 @@ gran model hertz/stiffness :h3
[Syntax:]
model hertz [other model_type/model_name pairs as described "here"_pair_gran.html] keyword values :pre
model hertz \[other model_type/model_name pairs as described "here"_pair_gran.html \] keyword values :pre
zero or more keyword/value pairs may be appended :l
{limitForce} values = 'on' or 'off'
on = ensures that the normal force is never attractive (an artefact that can occur at the end of a collision).

View File

@ -11,7 +11,7 @@ gran model hooke :h3
[Syntax:]
model hertz [other model_type/model_name pairs as described "here"_pair_gran.html] keyword values :pre
model hertz \[other model_type/model_name pairs as described "here"_pair_gran.html \] keyword values :pre
zero or more keyword/value pairs may be appended :l
{tangential_damping} values = 'on' or 'off'
on = activates tangential damping

View File

@ -11,7 +11,7 @@ gran model hooke/stiffness :h3
[Syntax:]
model hooke/stiffness [other model_type/model_name pairs as described "here"_pair_gran.html] keyword values :pre
model hooke/stiffness \[other model_type/model_name pairs as described "here"_pair_gran.html \] keyword values :pre
zero or more keyword/value pairs may be appended :l
{absolute_damping} values = 'on' or 'off'
on = activates tangential damping

View File

@ -28,9 +28,8 @@ The spring part of the tangential force (k_t) is a "history" effect
that accounts for the tangential displacement ("tangential overlap")
between the particles for the duration of the time they are in contact.
If this model is chose, then this "tangential overlap" spring force is
If this model is chosen, then this "tangential overlap" spring force is
actually calculated / taken into account.
The coefficient of friction cof is the upper limit of the tangential force through
the Coulomb criterion Ft = cof*Fn, where Ft and Fn are the tangential spring and normal
force components in the formulas above.

5
lib/poems/Makefile.lammps Executable file
View File

@ -0,0 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used
poems_SYSINC =
poems_SYSLIB =
poems_SYSPATH =

View File

@ -0,0 +1,117 @@
# openmpi = Ubuntu 12.04, mpic++, OpenMPI-1.6
SHELL = /bin/sh
# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler
CC = mpic++
CCFLAGS = -O2 \
-funroll-loops -fstrict-aliasing -Wall -Wno-uninitialized -fPIC
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpic++
LINKFLAGS = -O2
LIB = -lstdc++
ARCHIVE = ar
ARFLAGS = -rcsv
SIZE = size
SHLIBFLAGS = -shared
# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use
# if you change any -D setting, do full re-compile after "make clean"
# LAMMPS ifdef settings, OPTIONAL
# see possible settings in doc/Section_start.html#2_2 (step 4)
LMP_INC = -DLAMMPS_GZIP -DLAMMPS_VTK
# MPI library, REQUIRED
# see discussion in doc/Section_start.html#2_2 (step 5)
# can point to dummy MPI library in src/STUBS as in Makefile.serial
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library
MPI_INC =
MPI_PATH =
MPI_LIB =
# FFT library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 6)
# can be left blank to use provided KISS FFT library
# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library
FFT_INC =
FFT_PATH =
FFT_LIB =
# JPEG and/or PNG library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 7)
# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
# INC = path(s) for jpeglib.h and/or png.h
# PATH = path(s) for JPEG library and/or PNG library
# LIB = name(s) of JPEG library and/or PNG library
JPG_INC =
JPG_PATH =
JPG_LIB =
# VTK library, OPTIONAL
# INC = path for VTK header files
# PATH = path for VTK library
# LIB = name of VTK library
##################################### ADD THESE ITEMS TO OPTIONS FILE OF SOLVER APP IN CFDEM
VTK_INC = -I/usr/include/vtk-5.8
VTK_PATH =
VTK_LIB = -lvtkCommon -lvtkFiltering -lvtkIO
# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section
include Makefile.package.settings
include Makefile.package
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(VTK_INC) $(PKG_SYSINC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(VTK_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(VTK_LIB) $(PKG_SYSLIB)
# Path to src files
vpath %.cpp ..
vpath %.h ..
# Link target
$(EXE): $(OBJ)
$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
$(SIZE) $(EXE)
# Library target
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
shlib: $(OBJ)
$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
$(OBJ) $(EXTRA_LIB) $(LIB)
# Compilation rules
%.o:%.cpp
$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
%.d:%.cpp
$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
# Individual dependencies
DEPENDS = $(OBJ:.o=.d)
sinclude $(DEPENDS)

66
src/PASCAL/Install.sh Normal file
View File

@ -0,0 +1,66 @@
# Install/unInstall package files in LAMMPS
# mode = 0/1/2 for uninstall/install/update
mode=$1
# 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
}
# all package files with no dependencies
for file in *.cpp *.h; do
action $file
done
# edit 2 Makefile.package files to include/exclude package info
if (test $1 = 1) then
echo "...updating Makefile.package"
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*pascal[^ \t]* //' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-I$(PASCAL_SRC_DIR) |' ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L$(PASCAL_SRC_DIR) -L$(PASCAL_INST_DIR)/lib64 -L$(PASCAL_INST_DIR)/lib -L$(PASCAL_QT5_DIR)/lib -L$(PASCAL_HDF5_DIR)/lib |' ../Makefile.package
sed -i -e 's|^PKG_LIB =[ \t]*|&-lpasc_fedora_fpic -lsundials_cvode -lsundials_nvecparallel -lsundials_nvecserial -lQt5Core -lhdf5 -lhdf5_hl -lhdf5_cpp |' ../Makefile.package
fi
# if (test -e ../Makefile.package.settings) then
# sed -i -e '/^include.*pascal.*$/d' ../Makefile.package.settings
# multiline form needed for BSD sed on Macs
# sed -i -e '4 i \include $(PASCAL_SRC_DIR) ' ../Makefile.package.settings
# fi
elif (test $1 = 0) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*PASCAL[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*pasc[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*sundial[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*Qt5[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*nvecserial[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*nvecparallel[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*PASCAL_INST_DIR[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*PASCAL_INST_DIR[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*PASCAL_QT5_DIR[^ \t]* //' ../Makefile.package
fi
# if (test -e ../Makefile.package.settings) then
# sed -i -e '/^include.*pascal.*$/d' ../Makefile.package.settings
# fi
fi

View File

@ -0,0 +1,311 @@
/* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Copyright (C): 2014 DCS Computing GmbH (www.dcs-computing.com), Linz, Austria
2014 Graz University of Technology (ippt.tugraz.at), Graz, Austria
LIGGGHTS is based on LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
This software is distributed under the GNU General Public License.
Parts of the code were developped in the frame of the NanoSim project funded
by the European Commission through FP7 Grant agreement no. 604656.
------------------------------------------------------------------------- */
#include "mpi.h"
#include "math.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "pascal.h" // these are PASCAL include files
#include "fix_pascal_couple.h"
#include "atom.h"
#include "domain.h"
#include "update.h"
#include "modify.h"
#include "force.h"
#include "output.h"
#include "group.h"
#include "comm.h"
#include "memory.h"
#include "error.h"
#include "fix_property_atom.h"
#include "cfd_datacoupling_simple.h"
using namespace LAMMPS_NS;
using namespace PASCAL_NS;
using namespace FixConst;
/* ----------------------------------------------------------------------
Constructor, calls PaScal's constructor
------------------------------------------------------------------------- */
FixPaScalCouple::FixPaScalCouple(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg),
fix_shellTemperature_(0),
fix_shellHeatFlux_(0),
dc_(0),
verbose_(false),
couple_at_least_every_(0),
couple_this_step_(false),
pascal_setup_(0),
pasc_(0),
time_(0.)
{
iarg_ = 3;
int me, nprocs;
MPI_Comm_rank(world,&me);
MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
if (narg < 5)
error->fix_error(FLERR,this,"not enough arguments");
if (strcmp(arg[iarg_++],"couple_at_least_every"))
error->fix_error(FLERR,this,"expecting keyword 'couple_at_least_every'");
couple_at_least_every_ = force->inumeric(FLERR,arg[iarg_++]);
if (couple_at_least_every_ <= 0)
error->fix_error(FLERR,this,"'couple_at_least_every' > 0 required");
nevery = 1;
//Create datacoupling
dc_ = new CfdDatacouplingSimple(lmp,iarg_+1,narg,arg,this);
// set next reneighbor
force_reneighbor = 1;
next_reneighbor = update->ntimestep + couple_at_least_every_;
// TODO: meed parsing here!
// TODO: need to parse filename with pascal input
// create PaScal instance
int pascal;
if (me < nprocs) pascal = 1;
else pascal = MPI_UNDEFINED;
MPI_Comm comm_pascal;
MPI_Comm_split(MPI_COMM_WORLD,pascal,0,&comm_pascal);
// Open PaScal input script and create PaScal Object
if(0 == me)
fprintf(screen, "\n...creating PaScal object... \n");
if(pascal == 1) pasc_ = new PASCAL_NS::PaScal(0, NULL, comm_pascal,lmp);
pascal_setup_ = true;
char *runDirectory = new char[128];
int nStrLength = 0;
if (me == 0)
{
sprintf(runDirectory,"%s", "pascal"); //TODO: add option to specify via parsing
nStrLength = strlen(runDirectory) + 1;
}
MPI_Bcast(&nStrLength,1,MPI_INT,0,MPI_COMM_WORLD);
if (nStrLength > 0)
{
MPI_Bcast(runDirectory,nStrLength,MPI_CHAR,0,MPI_COMM_WORLD);
if (pascal == 1) pasc_->set_dir(runDirectory);
}
char *pascalFile = new char[256];
nStrLength = 0;
if (me == 0)
{
sprintf(pascalFile, "./%s/%s", runDirectory, "in.pascal"); //TODO: add option to specify via parsing
nStrLength = strlen(pascalFile) + 1;
}
MPI_Bcast(&nStrLength,1,MPI_INT,0,MPI_COMM_WORLD);
if (nStrLength > 0)
{
MPI_Bcast(pascalFile,nStrLength,MPI_CHAR,0,MPI_COMM_WORLD);
if (pascal == 1) pasc_->set_input(pascalFile);
}
pasc_->input();
//Finalized initialization
delete [] pascalFile;
delete [] runDirectory;
fprintf(screen, "...PaScal object initialized! \n\n");
}
/* ----------------------------------------------------------------------
free all memory for PaScal
------------------------------------------------------------------------- */
FixPaScalCouple::~FixPaScalCouple()
{
delete pasc_;
}
/* ---------------------------------------------------------------------- */
void FixPaScalCouple::post_create()
{
if(dc_)
dc_->post_create();
else
error->all(FLERR,"internal error");
if(verbose_) fprintf(screen, "PaScal::post_create()!\n");
// register fixes for quantities to be saved to disk
// see fix_property_atom.cpp for meaning of fixargs
if(!fix_shellTemperature_)
{
const char* fixarg[9];
fixarg[0]="shellT";
fixarg[1]="all";
fixarg[2]="property/atom";
fixarg[3]="shellT";
fixarg[4]="scalar";
fixarg[5]="no";
fixarg[6]="yes";
fixarg[7]="no";
fixarg[8]="0.";
fix_shellTemperature_ =
modify->add_fix_property_atom(9,
const_cast<char**>(fixarg),
style);
}
}
/* ---------------------------------------------------------------------- */
void FixPaScalCouple::updatePtrs()
{
//TODO
}
/* ---------------------------------------------------------------------- */
int FixPaScalCouple::setmask()
{
int mask = 0;
mask |= PRE_EXCHANGE;
mask |= END_OF_STEP;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixPaScalCouple::init()
{
// TODO: warn if something is wrong
dc_->init();
if(0 == atom->map_style)
error->fix_error(FLERR,this,"requires an 'atom_modify map' command to allocate an atom map");
//TODO
// error->all(FLERR,"TODO: add more properties here to be pushed/pulled");
// error->all(FLERR,"TODO: separate framework and model; put this in derived class");
// values to be transfered to OF
dc_->add_push_property("x","vector-atom");
dc_->add_push_property("v","vector-atom");
dc_->add_push_property("radius","scalar-atom");
dc_->add_push_property("id","scalar-atom");
}
/* ----------------------------------------------------------------------
make some setup calls to PaScal if necessary
set-up is
------------------------------------------------------------------------- */
void FixPaScalCouple::setup(int vflag)
{
}
/* ----------------------------------------------------------------------
detect neigh list build / exchange and trigger coupling
schedule next coupling
------------------------------------------------------------------------- */
int* FixPaScalCouple::get_liggghts_map(int &length)
{
int size_map = atom->get_map_size();
length = size_map;
int *map_copy = NULL;
map_copy = memory->create<int>(map_copy, size_map,"map");
memcpy(map_copy,atom->get_map_array(),size_map);
return map_copy;
}
/* ----------------------------------------------------------------------
detect neigh list build / exchange and trigger coupling
schedule next coupling
------------------------------------------------------------------------- */
void FixPaScalCouple::pre_exchange()
{
couple_this_step_ = true;
if (next_reneighbor != update->ntimestep)
fprintf(screen,"'premature' LIGGGHTS-PaScal coupling because of high flow dynamics\n");
next_reneighbor = update->ntimestep + couple_at_least_every_;
}
/* ----------------------------------------------------------------------
call PaScal to catch up with LIGGGHTS
------------------------------------------------------------------------- */
void FixPaScalCouple::end_of_step()
{
time_ += update->dt;
if(!couple_this_step_)
return;
// assemble command and run in PaScal
// init upon first use of PaScal, but not afterwards
char commandstr[200];
sprintf(commandstr,"control run %f init %s",time_,pascal_setup_?"yes":"no");
fprintf(screen,"PaScal::runCommand()!\n");
pasc_->runCommand(commandstr);
// reset flags and time counter
couple_this_step_ = false;
pascal_setup_ = false;
time_ = 0.;
#if 0
int currAtom=1;
fprintf(screen, "currAtom: %d xcm %g %g %g,vcm %g %g %g ,omega %g %g %g, torque %g %g %g, fcm %g %g %g\n",
currAtom,
xcm[currAtom][0], xcm[currAtom][1], xcm[currAtom][2],
vcm[currAtom][0], vcm[currAtom][1], vcm[currAtom][2],
omega[currAtom][0], omega[currAtom][1], omega[currAtom][2],
torque[currAtom][0],torque[currAtom][1],torque[currAtom][2],
fcm[currAtom][0],fcm[currAtom][1],fcm[currAtom][2]);
#endif
}
//////////////////////////////////////////////////////////////
void* LAMMPS_NS::FixPaScalCouple::find_pull_property(const char *name, const char *type, int &len1, int &len2)
{
return dc_->find_pull_property(name,type,len1,len2);
}
void* LAMMPS_NS::FixPaScalCouple::find_push_property(const char *name, const char *type, int &len1, int &len2)
{
return dc_->find_push_property(name,type,len1,len2);
}

View File

@ -0,0 +1,81 @@
/* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Copyright (C): 2014 DCS Computing GmbH (www.dcs-computing.com), Linz, Austria
2014 Graz University of Technology (ippt.tugraz.at), Graz, Austria
LIGGGHTS is based on LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
This software is distributed under the GNU General Public License.
Parts of the code were developped in the frame of the NanoSim project funded
by the European Commission through FP7 Grant agreement no. 604656.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(couple/pascal,FixPaScalCouple)
#else
#ifndef LMP_FIX_PASCAL_COUPLE_H
#define LMP_FIX_PASCAL_COUPLE_H
#include "fix.h"
namespace PASCAL_NS { class PaScal; }
namespace LAMMPS_NS {
class FixPaScalCouple : public Fix {
public:
FixPaScalCouple(class LAMMPS *, int narg, char **arg);
~FixPaScalCouple();
virtual void post_create();
void updatePtrs();
int setmask();
void init();
void setup(int);
void pre_exchange();
void end_of_step();
int* get_liggghts_map(int &length);
void* find_pull_property(const char *name, const char *type, int &len1, int &len2);
void* find_push_property(const char *name, const char *type, int &len1, int &len2);
protected:
class FixPropertyAtom* fix_shellTemperature_;
class FixPropertyAtom* fix_shellHeatFlux_;
private:
// data transfer is handled by this class
class CfdDatacouplingSimple *dc_;
bool verbose_;
int couple_at_least_every_;
bool couple_this_step_;
bool pascal_setup_;
double time_;
int iarg_;
// PaScal Object
PASCAL_NS::PaScal *pasc_;
};
} //end namespace
#endif
#endif

View File

@ -1,36 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "STUBS", "STUBS.vcproj", "{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMMPS", "LAMMPS.vcproj", "{74AC9767-A52F-47BD-BB26-07C739DA3EA5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_STUBS|Win32 = Debug_STUBS|Win32
Debug|Win32 = Debug|Win32
Release_STUBS|Win32 = Release_STUBS|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Debug_STUBS|Win32.ActiveCfg = Debug_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Debug_STUBS|Win32.Build.0 = Debug_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Debug|Win32.ActiveCfg = Debug_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Debug|Win32.Build.0 = Debug_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Release_STUBS|Win32.ActiveCfg = Release_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Release_STUBS|Win32.Build.0 = Release_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Release|Win32.ActiveCfg = Release_STUBS|Win32
{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}.Release|Win32.Build.0 = Release_STUBS|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Debug_STUBS|Win32.ActiveCfg = Debug_STUBS|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Debug_STUBS|Win32.Build.0 = Debug_STUBS|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Debug|Win32.ActiveCfg = Debug|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Debug|Win32.Build.0 = Debug|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Release_STUBS|Win32.ActiveCfg = Release_STUBS|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Release_STUBS|Win32.Build.0 = Release_STUBS|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Release|Win32.ActiveCfg = Release|Win32
{74AC9767-A52F-47BD-BB26-07C739DA3EA5}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,349 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_STUBS|Win32">
<Configuration>Debug_STUBS</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_STUBS|x64">
<Configuration>Debug_STUBS</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_STUBS|Win32">
<Configuration>Release_STUBS</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_STUBS|x64">
<Configuration>Release_STUBS</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\lammps.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\lammps.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="README.txt" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{74AC9767-A52F-47BD-BB26-07C739DA3EA5}</ProjectGuid>
<RootNamespace>testmacro</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>LIGGGHTS</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\Program Files\Microsoft MPI\Inc;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\Program Files\Microsoft MPI\Lib\amd64;$(LibraryPath)</LibraryPath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\Program Files\Microsoft MPI\Inc;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\Program Files\Microsoft MPI\Lib\amd64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>C:\Program Files\Microsoft MPI\Inc;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files\Microsoft MPI\Lib\i386;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>C:\Program Files\Microsoft MPI\Inc;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files\Microsoft MPI\Lib\i386;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;extra;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>msmpi.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;extra;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>msmpi.lib;extra/fftw2/x64/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;extra;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>msmpi.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;extra;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>msmpi.lib;extra/fftw2/x64/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;extra;../STUBS;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)stubs.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;extra;../STUBS;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)stubs.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;extra;../STUBS;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)stubs.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..;extra;../STUBS;../../lib/awpmd/systems/interact/TCP;../MOLECULE;../KSPACE;extra/fftw2;../MANYBODY;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;FFT_FFTW;_USE_MATH_DEFINES;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4267;4244;4101;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>$(OutDir)stubs.lib;extra/fftw2/FFTW2dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "STUBS", "STUBS.vcxproj", "{FD83089F-1BF6-455F-9BEA-BB1C21FC137C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LIGGGHTS", "LIGGGHTS-PUBLIC.vcxproj", "{74AC9767-A52F-47BD-BB26-07C739DA3EA5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LIGGGHTS", "LIGGGHTS.vcxproj", "{74AC9767-A52F-47BD-BB26-07C739DA3EA5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,33 +0,0 @@
INSTRUCTIONS FOR COMPILING LIGGGHTS WITH VISUAL STUDIO 2010/2012
(Ultimate, Professional or Express Versions)
To compile LIGGGHTS open the LIGGGHTS-PUBLIC_VS2012 Solution
The LIGGGHTS project has configurations to compile either with MPI
support or with MPI stubs. *
To compile with MPI:
1. Install MPICH for Windows (http://www.mpich.org/), validate the
corresponding include and lib directories in the project properties
of LIGGGHTS: LIGGGHTS/Properties/Configuration Properties/VC++ Directories **
2. Compile LIGGGHTS using Debug or Release configurations from the
provided projects (use x64 for 64bit binary)
To compile with MPI STUBS
1. Compile STUBS.vcproj
2. Compile LIGGGHTS using Debug_STUBS or Release_STUBS configurations
from the provided project (use x64 for 64bit binary)
* For Visual Studio versions prior to 2012 the Platform Toolset setting has to
be adjusted for each project. This setting can be changed under:
Properties/Configuration Properties/General/General/Platform Toolset
** Note: Depending on your MPICH Installation (32bit, 64bit) and your Windows
Installation (32bit, 64bit) you might have to change the 32bit paths from
c:\Program Files (x86)\ to C:\Program Files\. The supplied solution was created
on a 64bit system.

View File

@ -1,78 +1,78 @@
INSTRUCTIONS FOR COMPILING LAMMPS WITH VISUAL STUDIO 2005
INSTRUCTIONS FOR COMPILING LIGGGHTS WITH VISUAL STUDIO 2010/2012/2013
(Ultimate, Professional or Express Versions)
The provided project
#######################################################################################
IMPORTANT: If you used Git on Windows to get this code, ensure that Unix-style line
endings are used throughout the project. "Git for Windows" will ask during installation
how it should handle newlines, we recommend Option 2. "Checkout as-is, commit Unix-style
line endings". The simplest way to check if everything is alright is opening
Make.sh in the source folder using a text editor such as Notepad++. Verify that lines
end with LF and not CR LF.
#######################################################################################
LAMMPS.vcproj
#######################################################################################
IMPORTANT: Prior to opening the Visual Studio project, some files must be generated and
updated. This is why the project file only contains lammps.cpp and lammps.h in the
beginning.
includes the minimal package set: KSPACE, MANYBODY, MOLECULE.
LIGGGHTS build routine uses GNU tools before compilation to generate headers.
The easiest way to generate these files is to install Cygwin, a utility which allows
many Unix utilities to run on Windows. Using these ported unix utilties one can
trigger the file generation.
The package set may be reconfiured with the help of the supplied VS
macro (see below).
1. Download the Cygwin installer (https://www.cygwin.com/)
2. Install Cygwin: Beside the core installation, also install Python
2. Open a Cygwin shell and go to source folder (parent folder of this one)
The project has configurations to compile either with MPI support or
with MPI stubs.
$ cd /cygdrive/c/your-windows-path-to-your-liggghts-folder/
To compile with MPI:
3. Run the following commands in that folder
1. Install MPICH for Windows, specify the corresponding include and
lib directories in MSVS/Tools/Options/Projects and Solutions/VC++
Directories
$ sh Make.sh style
$ sh Make.sh models
2. Compile LAMMPS using Debug or Release configurations from the
provided projects
4. Verify if files were generated:
To compile with MPI STUBS
$ ls style_*
should output a list of style file headers
$ cat style_contact_model.h
should output a long list of GRAN_MODEL(....) lines
5. Finally one must update the Visual Studio project in the WINDOWS folder. To do this,
run the following Python script inside of the WINDOWS folder
$ cd WINDOWS/
$ python update_project.py LIGGGHTS.vcxproj
This will update all headers and implementation files from the LIGGGHTS source
directory and insert them into the Visual Studio project.
#######################################################################################
To compile LIGGGHTS open the LIGGGHTS_VS2013 Solution
The LIGGGHTS project has configurations to compile either with MPI
support or with MPI stubs. *
To compile WITH MPI:
1. Install MS-MPI by downloading the HPC Pack MS-MPI Redistributable Package
from http://www.microsoft.com/en-us/download/details.aspx?id=41634
Validate corresponding include and lib directories in the project properties
of LIGGGHTS: LIGGGHTS/Properties/Configuration Properties/VC++ Directories **
Here is a tutorial on MS-MPI: http://www.cs.ucla.edu/~zhu/tutorial/Using_MS-MPI.pdf
2. Compile LIGGGHTS using Debug or Release configurations from the
provided projects (use x64 for 64bit binary)
To compile WITHOUT MPI, but instead using MPI STUBS
1. Compile STUBS.vcproj
2. Compile LAMMPS using Debug_STUBS or Release_STUBS configurations
from the provided project
To run the code you may need mpich and fftw213 dlls accessible by the
system search (they may be copied to Windows/system32 directory). The
fftw213 dlls can be found in vs9/extra/fftw213 or downloaded from the
fftw site
To customise the packages via a Visual Basic macro:
1. Load LAMMPS solution in Visual Studio IDE
2. Select in the main menu "Tools/Macros/Load Macro Project..."
and load the file src/WINDOWS/LAMMPS.vsmacros
3. In the "Macro Explorer" on the right panel open LAMMPS and LAMMPS_settings
4. Double click on "ManagePackages" to run the configuration
macro. Please note that the window for running macro sometimes
opens in the background, so use Alt-TAB to locate it.
5. Configure a custom set of packages and press Ok. Wait till the
macro completes.
6. Rebuild the LAMMPS project
Before the first build or after an update from LAMMPS src repository
it is recommended to run "ManagePackages" macro an check "Refresh file
list in src filter" to get an up to date list of source files in the
"src" project filter. This may be needed as the file composition in
src may change between LAMMPS releases.
Some of the packages were not tested to be compatible with VS compiler
or require additional libraries. They are marked with asterics in the
package list displayed when the macro is running. If you wish to try
those packages, install them using the macro and then change the
project properties (libraries, includes, etc.) manually.
Please note that "ManagePackages" macro works on the project named
LAMMPS. So if you rename the LAMMPS project and still want to use
automatic package configuration, please specify the new name in the
line "Dim LAMMPS_project_name As String =" at the beginning of the
macro code.
The default package options such as the path to include and library
files, description, etc can also be changed by editing the
"ManagePackages" macro code. To do this right click on
"ManagePackages" in the "Macro Explorer" and select Edit. Then go to
the section named
"===================== Custom Package options ========================",
find the required package and change its properties by modyfing the
corresponding PKG_OPTS(...) entry.
2. Compile LIGGGHTS using Debug_STUBS or Release_STUBS configurations
from the provided project (use x64 for 64bit binary)
* For Visual Studio versions prior to 2013 the Platform Toolset setting has to
be adjusted for each project. This setting can be changed under:
Properties/Configuration Properties/General/General/Platform Toolset

View File

@ -1,33 +0,0 @@
INSTRUCTIONS FOR COMPILING LIGGGHTS WITH VISUAL STUDIO 2010/2012
(Ultimate, Professional or Express Versions)
To compile LIGGGHTS open the LIGGGHTS_VS2012 Solution
The LIGGGHTS project has configurations to compile either with MPI
support or with MPI stubs. *
To compile with MPI:
1. Install MPICH for Windows (http://www.mpich.org/), validate the
corresponding include and lib directories in the project properties
of LIGGGHTS: LIGGGHTS/Properties/Configuration Properties/VC++ Directories **
2. Compile LIGGGHTS using Debug or Release configurations from the
provided projects (use x64 for 64bit binary)
To compile with MPI STUBS
1. Compile STUBS.vcproj
2. Compile LIGGGHTS using Debug_STUBS or Release_STUBS configurations
from the provided project (use x64 for 64bit binary)
* For Visual Studio versions prior to 2012 the Platform Toolset setting has to
be adjusted for each project. This setting can be changed under:
Properties/Configuration Properties/General/General/Platform Toolset
** Note: Depending on your MPICH Installation (32bit, 64bit) and your Windows
Installation (32bit, 64bit) you might have to change the 32bit paths from
c:\Program Files (x86)\ to C:\Program Files\. The supplied solution was created
on a 64bit system.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_STUBS|Win32">
<Configuration>Debug_STUBS</Configuration>
@ -26,19 +26,19 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_STUBS|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_STUBS|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -1,9 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\MOLECULE\angle_charmm.h"
#include "..\..\MOLECULE\angle_cosine.h"
#include "..\..\MOLECULE\angle_cosine_delta.h"
#include "..\..\MOLECULE\angle_cosine_periodic.h"
#include "..\..\MOLECULE\angle_cosine_squared.h"
#include "..\..\MOLECULE\angle_harmonic.h"
#include "..\..\MOLECULE\angle_hybrid.h"
#include "..\..\MOLECULE\angle_table.h"

View File

@ -1,12 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\atom_vec_atomic.h"
#include "..\..\atom_vec_charge.h"
#include "..\..\atom_vec_ellipsoid.h"
#include "..\..\atom_vec_hybrid.h"
#include "..\..\atom_vec_line.h"
#include "..\..\atom_vec_sphere.h"
#include "..\..\atom_vec_tri.h"
#include "..\..\MOLECULE\atom_vec_angle.h"
#include "..\..\MOLECULE\atom_vec_bond.h"
#include "..\..\MOLECULE\atom_vec_full.h"
#include "..\..\MOLECULE\atom_vec_molecular.h"

View File

@ -1,9 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\bond_hybrid.h"
#include "..\..\MOLECULE\bond_fene.h"
#include "..\..\MOLECULE\bond_fene_expand.h"
#include "..\..\MOLECULE\bond_harmonic.h"
#include "..\..\MOLECULE\bond_morse.h"
#include "..\..\MOLECULE\bond_nonlinear.h"
#include "..\..\MOLECULE\bond_quartic.h"
#include "..\..\MOLECULE\bond_table.h"

View File

@ -1,16 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\balance.h"
#include "..\..\change_box.h"
#include "..\..\create_atoms.h"
#include "..\..\create_box.h"
#include "..\..\delete_atoms.h"
#include "..\..\delete_bonds.h"
#include "..\..\displace_atoms.h"
#include "..\..\minimize.h"
#include "..\..\read_data.h"
#include "..\..\read_restart.h"
#include "..\..\replicate.h"
#include "..\..\run.h"
#include "..\..\set.h"
#include "..\..\velocity.h"
#include "..\..\write_restart.h"

View File

@ -1,44 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\compute_angle_local.h"
#include "..\..\compute_atom_molecule.h"
#include "..\..\compute_bond_local.h"
#include "..\..\compute_centro_atom.h"
#include "..\..\compute_cluster_atom.h"
#include "..\..\compute_cna_atom.h"
#include "..\..\compute_com.h"
#include "..\..\compute_com_molecule.h"
#include "..\..\compute_coord_atom.h"
#include "..\..\compute_dihedral_local.h"
#include "..\..\compute_displace_atom.h"
#include "..\..\compute_erotate_sphere.h"
#include "..\..\compute_group_group.h"
#include "..\..\compute_gyration.h"
#include "..\..\compute_gyration_molecule.h"
#include "..\..\compute_heat_flux.h"
#include "..\..\compute_improper_local.h"
#include "..\..\compute_ke.h"
#include "..\..\compute_ke_atom.h"
#include "..\..\compute_msd.h"
#include "..\..\compute_msd_molecule.h"
#include "..\..\compute_pair.h"
#include "..\..\compute_pair_local.h"
#include "..\..\compute_pe.h"
#include "..\..\compute_pe_atom.h"
#include "..\..\compute_pressure.h"
#include "..\..\compute_property_atom.h"
#include "..\..\compute_property_local.h"
#include "..\..\compute_property_molecule.h"
#include "..\..\compute_rdf.h"
#include "..\..\compute_reduce.h"
#include "..\..\compute_reduce_region.h"
#include "..\..\compute_slice.h"
#include "..\..\compute_stress_atom.h"
#include "..\..\compute_temp.h"
#include "..\..\compute_temp_com.h"
#include "..\..\compute_temp_deform.h"
#include "..\..\compute_temp_partial.h"
#include "..\..\compute_temp_profile.h"
#include "..\..\compute_temp_ramp.h"
#include "..\..\compute_temp_region.h"
#include "..\..\compute_temp_sphere.h"
#include "..\..\compute_ti.h"

View File

@ -1,7 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\MOLECULE\dihedral_charmm.h"
#include "..\..\MOLECULE\dihedral_harmonic.h"
#include "..\..\MOLECULE\dihedral_helix.h"
#include "..\..\MOLECULE\dihedral_hybrid.h"
#include "..\..\MOLECULE\dihedral_multi_harmonic.h"
#include "..\..\MOLECULE\dihedral_opls.h"

View File

@ -1,8 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\dump_atom.h"
#include "..\..\dump_cfg.h"
#include "..\..\dump_custom.h"
#include "..\..\dump_dcd.h"
#include "..\..\dump_image.h"
#include "..\..\dump_local.h"
#include "..\..\dump_xyz.h"

View File

@ -1,69 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\fix_adapt.h"
#include "..\..\fix_addforce.h"
#include "..\..\fix_aveforce.h"
#include "..\..\fix_ave_atom.h"
#include "..\..\fix_ave_correlate.h"
#include "..\..\fix_ave_histo.h"
#include "..\..\fix_ave_spatial.h"
#include "..\..\fix_ave_time.h"
#include "..\..\fix_box_relax.h"
#include "..\..\fix_deform.h"
#include "..\..\fix_deposit.h"
#include "..\..\fix_drag.h"
#include "..\..\fix_dt_reset.h"
#include "..\..\fix_efield.h"
#include "..\..\fix_enforce2d.h"
#include "..\..\fix_evaporate.h"
#include "..\..\fix_external.h"
#include "..\..\fix_gravity.h"
#include "..\..\fix_heat.h"
#include "..\..\fix_indent.h"
#include "..\..\fix_langevin.h"
#include "..\..\fix_lineforce.h"
#include "..\..\fix_minimize.h"
#include "..\..\fix_momentum.h"
#include "..\..\fix_move.h"
#include "..\..\fix_nph.h"
#include "..\..\fix_nph_sphere.h"
#include "..\..\fix_npt.h"
#include "..\..\fix_npt_sphere.h"
#include "..\..\fix_nve.h"
#include "..\..\fix_nve_limit.h"
#include "..\..\fix_nve_noforce.h"
#include "..\..\fix_nve_sphere.h"
#include "..\..\fix_nvt.h"
#include "..\..\fix_nvt_sllod.h"
#include "..\..\fix_nvt_sphere.h"
#include "..\..\fix_orient_fcc.h"
#include "..\..\fix_planeforce.h"
#include "..\..\fix_press_berendsen.h"
#include "..\..\fix_print.h"
#include "..\..\fix_read_restart.h"
#include "..\..\fix_recenter.h"
#include "..\..\fix_respa.h"
#include "..\..\fix_restrain.h"
#include "..\..\fix_rigid.h"
#include "..\..\fix_rigid_nve.h"
#include "..\..\fix_rigid_nvt.h"
#include "..\..\fix_setforce.h"
#include "..\..\fix_shake.h"
#include "..\..\fix_shear_history.h"
#include "..\..\fix_spring.h"
#include "..\..\fix_spring_rg.h"
#include "..\..\fix_spring_self.h"
#include "..\..\fix_store_force.h"
#include "..\..\fix_store_state.h"
#include "..\..\fix_temp_berendsen.h"
#include "..\..\fix_temp_rescale.h"
#include "..\..\fix_thermal_conductivity.h"
#include "..\..\fix_tmd.h"
#include "..\..\fix_ttm.h"
#include "..\..\fix_viscosity.h"
#include "..\..\fix_viscous.h"
#include "..\..\fix_wall_harmonic.h"
#include "..\..\fix_wall_lj126.h"
#include "..\..\fix_wall_lj93.h"
#include "..\..\fix_wall_reflect.h"
#include "..\..\fix_wall_region.h"
#include "..\..\MANYBODY\fix_qeq_comb.h"

View File

@ -1,5 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\MOLECULE\improper_cvff.h"
#include "..\..\MOLECULE\improper_harmonic.h"
#include "..\..\MOLECULE\improper_hybrid.h"
#include "..\..\MOLECULE\improper_umbrella.h"

View File

@ -1,3 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\respa.h"
#include "..\..\verlet.h"

View File

@ -1,5 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\KSPACE\ewald.h"
#include "..\..\KSPACE\pppm.h"
#include "..\..\KSPACE\pppm_cg.h"
#include "..\..\KSPACE\pppm_tip4p.h"

View File

@ -1,6 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\min_cg.h"
#include "..\..\min_fire.h"
#include "..\..\min_hftn.h"
#include "..\..\min_quickmin.h"
#include "..\..\min_sd.h"

View File

@ -1,49 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\pair_beck.h"
#include "..\..\pair_born.h"
#include "..\..\pair_born_coul_wolf.h"
#include "..\..\pair_buck.h"
#include "..\..\pair_buck_coul_cut.h"
#include "..\..\pair_coul_cut.h"
#include "..\..\pair_coul_debye.h"
#include "..\..\pair_coul_wolf.h"
#include "..\..\pair_dpd.h"
#include "..\..\pair_dpd_tstat.h"
#include "..\..\pair_gauss.h"
#include "..\..\pair_hybrid.h"
#include "..\..\pair_hybrid_overlay.h"
#include "..\..\pair_lj96_cut.h"
#include "..\..\pair_lj_cubic.h"
#include "..\..\pair_lj_cut.h"
#include "..\..\pair_lj_cut_coul_cut.h"
#include "..\..\pair_lj_cut_coul_debye.h"
#include "..\..\pair_lj_expand.h"
#include "..\..\pair_lj_gromacs.h"
#include "..\..\pair_lj_gromacs_coul_gromacs.h"
#include "..\..\pair_lj_smooth.h"
#include "..\..\pair_lj_smooth_linear.h"
#include "..\..\pair_morse.h"
#include "..\..\pair_soft.h"
#include "..\..\pair_table.h"
#include "..\..\pair_yukawa.h"
#include "..\..\MANYBODY\pair_adp.h"
#include "..\..\MANYBODY\pair_airebo.h"
#include "..\..\MANYBODY\pair_comb.h"
#include "..\..\MANYBODY\pair_eam.h"
#include "..\..\MANYBODY\pair_eam_alloy.h"
#include "..\..\MANYBODY\pair_eam_fs.h"
#include "..\..\MANYBODY\pair_eim.h"
#include "..\..\MANYBODY\pair_rebo.h"
#include "..\..\MANYBODY\pair_sw.h"
#include "..\..\MANYBODY\pair_tersoff.h"
#include "..\..\MANYBODY\pair_tersoff_zbl.h"
#include "..\..\KSPACE\pair_born_coul_long.h"
#include "..\..\KSPACE\pair_buck_coul_long.h"
#include "..\..\KSPACE\pair_coul_long.h"
#include "..\..\KSPACE\pair_lj_charmm_coul_long.h"
#include "..\..\KSPACE\pair_lj_cut_coul_long.h"
#include "..\..\KSPACE\pair_lj_cut_coul_long_tip4p.h"
#include "..\..\MOLECULE\pair_hbond_dreiding_lj.h"
#include "..\..\MOLECULE\pair_hbond_dreiding_morse.h"
#include "..\..\MOLECULE\pair_lj_charmm_coul_charmm.h"
#include "..\..\MOLECULE\pair_lj_charmm_coul_charmm_implicit.h"

View File

@ -1,9 +0,0 @@
// File is generaged by ListModules() macro
#include "..\..\region_block.h"
#include "..\..\region_cone.h"
#include "..\..\region_cylinder.h"
#include "..\..\region_intersect.h"
#include "..\..\region_plane.h"
#include "..\..\region_prism.h"
#include "..\..\region_sphere.h"
#include "..\..\region_union.h"

View File

@ -115,6 +115,8 @@ namespace LAMMPS_NS
virtual void setVerbose() = 0;
virtual void check_element_property_consistency() = 0;
//NP ***************************************
//NP interface to SurfaceMesh
//NP ***************************************

View File

@ -61,12 +61,15 @@ class AssociativePointerArray
int size();
bool sameLength(int _len);
inline void copyElement(int from, int to);
inline void addUninitializedElement();
inline void addZeroElement();
inline void deleteElement(int n);
inline void deleteForwardElement(int n,bool scale,bool translate,bool rotate);
inline void deleteRestartElement(int n,bool scale,bool translate,bool rotate);
inline void deleteRestartGlobal(bool scale,bool translate,bool rotate);
inline void clearReverse(bool scale,bool translate,bool rotate);

View File

@ -88,6 +88,19 @@
content_[index] = content_[numElem_];
}
/* ----------------------------------------------------------------------
check if all have the same length
------------------------------------------------------------------------- */
template<typename T>
bool AssociativePointerArray<T>::sameLength(int _len)
{
for(int i = 0; i < numElem_; i++)
if(content_[i]->size() != _len)
return false;
return true;
}
/* ----------------------------------------------------------------------
get pointer to property
------------------------------------------------------------------------- */
@ -240,6 +253,17 @@
content_[i]->delRestart(n,scale,translate,rotate);
}
/* ----------------------------------------------------------------------
delete restart properties
------------------------------------------------------------------------- */
template<typename T>
void AssociativePointerArray<T>::deleteRestartGlobal(bool scale,bool translate,bool rotate)
{
for(int i=0;i<numElem_;i++)
content_[i]->delRestart(scale,translate,rotate);
}
/* ----------------------------------------------------------------------
clear reverse properties, i.e. reset all of them to 0
------------------------------------------------------------------------- */

View File

@ -117,7 +117,7 @@ class BoundingBox
if(zLo < sublo[2])
zLo = sublo[2];
if(xHi > subhi[2])
if(zHi > subhi[2])
zHi = subhi[2];
}

View File

@ -62,8 +62,8 @@ class CfdDatacoupling : protected Pointers {
void grow_();
// used to find properties
void* find_pull_property(const char *name, const char *type, int &len1, int &len2);
void* find_push_property(const char *name, const char *type, int &len1, int &len2);
virtual void* find_pull_property(const char *name, const char *type, int &len1, int &len2);
virtual void* find_push_property(const char *name, const char *type, int &len1, int &len2);
void* find_property(int, const char*, const char*, int&, int&);
// data members

View File

@ -117,7 +117,7 @@ namespace ContactModels {
// * the calculation of the displacement (hIJ) is not required (no cdata.r)
const double ri = cdata.radi;
const double rj = cdata.radj;
const double reff = (ri*rj)/(ri+rj);
const double reff = cdata.is_wall ? cdata.radi : (ri*rj/(ri+rj));
const int itype = cdata.itype;
const int jtype = cdata.jtype;
@ -166,8 +166,8 @@ namespace ContactModels {
const int itype = atom->type[cdata.i];
const int jtype = atom->type[cdata.j];
const double reff = (ri*rj)/(ri+rj);
const double hIJ = (r-ri-rj);
const double reff = cdata.is_wall ? ri : (ri*rj/(ri+rj));
const double hIJ = cdata.is_wall ? (r-ri) : (r-ri-rj);
const double Fn_coh = calcCohesiveForce(cdata,hIJ, reff, itype, jtype);

View File

@ -41,7 +41,8 @@ using namespace LAMMPS_NS;
communicationType_(COMM_TYPE_MANUAL),
refFrame_(REF_FRAME_UNDEFINED),
restartType_(RESTART_TYPE_UNDEFINED),
scalePower_(-1)
scalePower_(-1),
useDefault_(false)
{
}
@ -50,10 +51,14 @@ using namespace LAMMPS_NS;
communicationType_(COMM_TYPE_MANUAL),
refFrame_(REF_FRAME_UNDEFINED),
restartType_(RESTART_TYPE_UNDEFINED),
scalePower_(-1)
scalePower_(-1),
useDefault_(false)
{
id_ = new char[strlen(_id)+1];
strcpy(id_,_id);
if(id_)
{
id_ = new char[strlen(_id)+1];
strcpy(id_,_id);
}
}
ContainerBase::ContainerBase(const char *_id, const char* _comm, const char* _ref, const char *_restart,int _scalePower)
@ -61,7 +66,8 @@ using namespace LAMMPS_NS;
communicationType_(COMM_TYPE_MANUAL),
refFrame_(REF_FRAME_UNDEFINED),
restartType_(RESTART_TYPE_UNDEFINED),
scalePower_(-1)
scalePower_(-1),
useDefault_(false)
{
setProperties(_id, _comm, _ref,_restart,_scalePower);
}
@ -71,7 +77,8 @@ using namespace LAMMPS_NS;
communicationType_(orig.communicationType_),
refFrame_(orig.refFrame_),
restartType_(orig.restartType_),
scalePower_(orig.scalePower_)
scalePower_(orig.scalePower_),
useDefault_(orig.useDefault_)
{
}

View File

@ -71,6 +71,7 @@ namespace LAMMPS_NS
virtual void del(int n) = 0;
virtual void delForward(int n,bool scale,bool translate,bool rotate) = 0;
virtual void delRestart(int n,bool scale,bool translate,bool rotate) = 0;
virtual void delRestart(bool scale,bool translate,bool rotate) = 0;
virtual void clearReverse(bool scale,bool translate,bool rotate) = 0;
virtual bool setFromContainer(ContainerBase *cont) = 0;
@ -80,6 +81,11 @@ namespace LAMMPS_NS
virtual void moveElement(int i,double *dx) = 0;
virtual void rotate(double *dQ) = 0;
virtual void setToDefault(int n) = 0;
inline bool useDefault()
{ return useDefault_ ; }
// buffer functions for parallelization
virtual int bufSize(int operation = OPERATION_UNDEFINED,
@ -132,6 +138,8 @@ namespace LAMMPS_NS
int restartType_;
int scalePower_;
bool useDefault_;
private:
ContainerBase();

View File

@ -60,6 +60,20 @@ using namespace LAMMPS_NS;
return capacityElement_;
}
/* ----------------------------------------------------------------------
check if all containers have same length
------------------------------------------------------------------------- */
void CustomValueTracker::check_element_property_consistency(int _len)
{
if (!elementProperties_.sameLength(_len))
{
error->one(FLERR,"all element properties must have the same length.\n"
"For meshes, all elem properties with restart must be added in post_create_pre_restart().\n"
"For meshes, all elem properties without restart must be added after the constructor()\n");
}
}
/* ----------------------------------------------------------------------
remove property
------------------------------------------------------------------------- */

View File

@ -50,6 +50,7 @@ namespace LAMMPS_NS
T* getElementProperty(const char *_id);
inline ContainerBase* getElementPropertyBase(const char *_id);
inline ContainerBase* getElementPropertyBase(int i);
inline int getElementPropertyIndex(const char *_id);
@ -58,6 +59,8 @@ namespace LAMMPS_NS
void removeElementProperty(const char *_id);
void check_element_property_consistency(int _len);
// global (e.g. mesh) properties
template<typename T>
@ -80,6 +83,7 @@ namespace LAMMPS_NS
inline void deleteElement(int i);
inline void deleteForwardElement(int i,bool scale,bool translate,bool rotate);
inline void deleteRestartElement(int i,bool scale,bool translate,bool rotate);
inline void deleteRestartGlobal(bool scale,bool translate,bool rotate);
void clearReverse(bool scale,bool translate,bool rotate);
void storeOrig();

View File

@ -58,9 +58,12 @@
}
// allocate memory and initialize
//NP have to do this in case of mesh, since elements are generated before properties
//NP have to do this in case of mesh, since elements are generated before properties at times
//NP (restart vs non-restart)
if(ownerMesh_)
{
elementProperties_.getPointerById<T>(_id)->addUninitialized(ownerMesh_->sizeLocal()+ownerMesh_->sizeGhost());
}
if(_init_len > 0)
elementProperties_.getPointerById<T>(_id)->addUninitialized(_init_len);
@ -128,6 +131,11 @@
return elementProperties_.getBasePointerById(_id);
}
inline ContainerBase* CustomValueTracker::getElementPropertyBase(int i)
{
return elementProperties_.getBasePointerByIndex(i);
}
inline int CustomValueTracker::getElementPropertyIndex(const char *_id)
{
return elementProperties_.idToIndex(_id);
@ -237,6 +245,16 @@
elementProperties_.deleteRestartElement(i,scale,translate,rotate);
}
/* ----------------------------------------------------------------------
delete global restart properties
------------------------------------------------------------------------- */
void CustomValueTracker::deleteRestartGlobal(bool scale,bool translate,bool rotate)
{
globalProperties_.deleteRestartGlobal(scale,translate,rotate);
globalProperties_orig_.deleteRestartGlobal(scale,translate,rotate);
}
/* ----------------------------------------------------------------------
move element i
------------------------------------------------------------------------- */

View File

@ -169,6 +169,7 @@ class Domain : protected Pointers {
int is_in_subdomain(double* pos); //NP modified C.K.
int is_in_extended_subdomain(double* pos); //NP modified C.K.
double dist_subbox_borders(double* pos); //NP modified C.K.
void min_subbox_extent(double &min_extent,int &dim); //NP modified C.K.
int is_periodic_ghost(int i); //NP modified C.K.
bool is_owned_or_first_ghost(int i); //NP modified C.K.

View File

@ -134,6 +134,21 @@ inline double Domain::dist_subbox_borders(double* pos) //NP modified C.K.
return dhi;
}
/* ----------------------------------------------------------------------
return smallest extent ob subbox
------------------------------------------------------------------------- */
inline void Domain::min_subbox_extent(double &min_extent,int &dim) //NP modified C.K.
{
if(is_wedge)
error->one(FLERR,"missing implementation");
double delta[3];
vectorSubtract3D(subhi,sublo,delta);
/*NL*/ //printVec3D(screen,"delta",delta);
min_extent = vectorMin3D(delta,dim);
}
/* ----------------------------------------------------------------------
domain check - not used very often, so not inlined
------------------------------------------------------------------------- */

View File

@ -24,7 +24,7 @@
Anton Gladky(TU Bergakademie Freiberg), gladky.anton@gmail.com
------------------------------------------------------------------------- */
#ifdef LAMMPS_VTK
#if defined(LAMMPS_VTK) // NP do not use #ifdef here (VS C++ bug)
#ifdef DUMP_CLASS
DumpStyle(atom/vtk,DumpATOMVTK)

View File

@ -22,9 +22,10 @@
/* ----------------------------------------------------------------------
Contributing author:
Daniel Queteschiner, daniel.queteschiner@dcs-computing.com
Richard Berger, richard.berger@jku.at
------------------------------------------------------------------------- */
#ifdef LAMMPS_VTK
#if defined(LAMMPS_VTK) //NP do not use #ifdef here (VS C++ bug)
#ifdef DUMP_CLASS
DumpStyle(custom/vtk,DumpCustomVTK)

View File

@ -90,24 +90,24 @@ FixBondCreateGran::FixBondCreateGran(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) {
if (strcmp(arg[iarg],"iparam") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
imaxbond = atoi(arg[iarg+1]);
inewtype = atoi(arg[iarg+2]);
imaxbond = force->inumeric(FLERR,arg[iarg+1]);
inewtype = force->inumeric(FLERR,arg[iarg+2]);
if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
if (inewtype < 1 || inewtype > atom->ntypes)
error->all(FLERR,"Invalid atom type in fix bond/create command");
iarg += 3;
} else if (strcmp(arg[iarg],"jparam") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
jmaxbond = atoi(arg[iarg+1]);
jnewtype = atoi(arg[iarg+2]);
jmaxbond = force->inumeric(FLERR,arg[iarg+1]);
jnewtype = force->inumeric(FLERR,arg[iarg+2]);
if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
if (jnewtype < 1 || jnewtype > atom->ntypes)
error->all(FLERR,"Invalid atom type in fix bond/create command");
iarg += 3;
} else if (strcmp(arg[iarg],"prob") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
fraction = atof(arg[iarg+1]);
seed = atoi(arg[iarg+2]);
fraction = force->numeric(FLERR,arg[iarg+1]);
seed = force->inumeric(FLERR,arg[iarg+2]);
if (fraction < 0.0 || fraction > 1.0)
error->all(FLERR,"Illegal fix bond/create command");
if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command");

View File

@ -222,6 +222,9 @@ void FixCheckTimestepGran::calc_rayleigh_hertz_estims()
mesh = (mesh_list[imesh])->triMesh();
if(mesh->isMoving())
{
// check if perElementProperty 'v' exists
if (mesh->prop().getElementPropertyIndex("v") == -1)
error->one(FLERR,"Internal error - mesh has no perElementProperty 'v' \n");
// loop local elements only
for(int itri=0;itri<mesh->sizeLocal();itri++)
for(int inode=0;inode<3;inode++)

View File

@ -312,6 +312,8 @@ void FixContactHistoryMesh::pre_force(int dummy)
//NP get new storage for partner at next
//NP get new storage for contact history at next
partner_[i] = ipage_next->get(nneighs_next);
if (!partner_[i])
error->one(FLERR,"mesh neighbor list overflow, boost neigh_modify one and/or page");
vectorInitializeN(partner_[i],nneighs_next,-1);
/*NL*/ //fprintf(screen,"nneighs_next %d\n",nneighs_next);
contacthistory_[i] = dpage_next->get(nneighs_next*dnum_);

View File

@ -2,6 +2,7 @@
#define LMP_FIX_DUMMY_H
#include "fix_rigid.h"
#include "custom_value_tracker.h"
namespace LAMMPS_NS {
@ -23,6 +24,12 @@ class MultisphereParallel {
return 0.;
}
inline class CustomValueTracker& prop()
{
LAMMPS *dptr = 0;
return *(new CustomValueTracker(dptr));
}
inline double mass(int i)
{
return 0.;
@ -48,6 +55,8 @@ class FixMultisphere : public Fix {
void* extract(const char*& a, int& b, int& c) {return NULL;}
void release(int,double*,double*) {}
int calc_n_steps(int iatom,double *p_ref,double *normalvec,double *v_normal)
{ return 0; }

View File

@ -605,7 +605,20 @@ void FixInsert::pre_exchange()
else if(ninsert_this < 0)
{
/*NL*/ //fprintf(screen,"ninsert_this %d\n",ninsert_this);
error->one(FLERR,"Particle insertion: Internal error");
error->fix_error(FLERR,this,"Particle insertion: Internal error");
}
double min_subbox_extent;
int min_dim;
domain->min_subbox_extent(min_subbox_extent,min_dim);
if(min_subbox_extent < 2.2 *max_r_bound())
{
char msg[200];
sprintf(msg,"Particle insertion on proc %d: sub-domain too small to insert particles: \nMax. bounding "
"sphere diameter is %f sub-domain extent in %s direction is only %f ",
comm->me,2.*max_r_bound(),0==min_dim?"x":(1==min_dim?"y":"z"),min_subbox_extent);
error->warning(FLERR,msg);
}
/*NL*/ if(LMP_DEBUGMODE_FIXINSERT) {MPI_Barrier(world); fprintf(LMP_DEBUG_OUT_FIXINSERT,"FixInsert::pre_exchange 4a\n");}

View File

@ -285,7 +285,7 @@ void FixInsertStream::calc_insertion_properties()
{
// no duration allowed here (checked before)
if(extrude_length < 3.*max_r_bound())
if(extrude_length < 3.*max_r_bound() && (all_in_flag || check_ol_flag))
error->fix_error(FLERR,this,"'extrude_length' is too small");
// add TINY for resolving round-off
insert_every = static_cast<int>((extrude_length+FIX_INSERT_STREAM_TINY)/(dt*vectorMag3D(v_normal)));

View File

@ -32,6 +32,7 @@
#include "error.h"
#include "fix_mesh_surface.h"
#include "fix_neighlist_mesh.h"
#include "fix_multisphere.h"
#include "fix_property_atom.h"
#include "mpi_liggghts.h"
#include "math_extra_liggghts.h"
@ -55,7 +56,8 @@ FixMassflowMesh::FixMassflowMesh(LAMMPS *lmp, int narg, char **arg) :
once_(false),
mass_(0.),
nparticles_(0),
ignore_ms_(false),
fix_property_(0),
property_sum_(0.),
screenflag_(false),
fp_(0),
mass_last_(0.),
@ -65,7 +67,10 @@ FixMassflowMesh::FixMassflowMesh(LAMMPS *lmp, int narg, char **arg) :
reset_t_count_(true),
delete_atoms_(false),
mass_deleted_(0.),
nparticles_deleted_(0)
nparticles_deleted_(0),
fix_ms_(0),
ms_(0),
ms_counter_(0)
{
vectorZeroize3D(nvec_);
vectorZeroize3D(pref_);
@ -99,6 +104,12 @@ FixMassflowMesh::FixMassflowMesh(LAMMPS *lmp, int narg, char **arg) :
if(!fix_mesh_)
error->fix_error(FLERR,this,"fix mesh ID does not exist");
hasargs = true;
} else if(strcmp(arg[iarg],"sum_property") == 0) {
if(narg < iarg+2)
error->fix_error(FLERR,this,"not enough arguments for 'sum_property'");
iarg++;
fix_property_ = static_cast<FixPropertyAtom*>(modify->find_fix_property(arg[iarg++],"property/atom","scalar",0,0,style));
hasargs = true;
} else if(strcmp(arg[iarg],"count") == 0) {
if(narg < iarg+2)
error->fix_error(FLERR,this,"not enough arguments for 'insert_stream'");
@ -164,14 +175,6 @@ FixMassflowMesh::FixMassflowMesh(LAMMPS *lmp, int narg, char **arg) :
else error->all(FLERR,"Illegal delete command");
iarg += 2;
hasargs = true;
} else if (strcmp(arg[iarg],"ignore_ms") == 0) {
if(narg < iarg+2)
error->fix_error(FLERR,this,"Illegal keyword entry");
if (strcmp(arg[iarg+1],"yes") == 0) ignore_ms_ = true;
else if (strcmp(arg[iarg+1],"no") == 0) ignore_ms_ = false;
else error->fix_error(FLERR,this,"unknown keyword");
iarg += 2;
hasargs = true;
} else
error->fix_error(FLERR,this,"unknown keyword");
}
@ -210,6 +213,8 @@ FixMassflowMesh::FixMassflowMesh(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 6;
if(fix_property_)
size_vector = 7;
global_freq = 1; //NP available always
}
@ -245,6 +250,21 @@ void FixMassflowMesh::post_create()
// add neighbor list
fix_neighlist_ = fix_mesh_->createOtherNeighList(igroup,id);
// need to find multisphere here to be able to add property
fix_ms_ = static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0));
if(fix_ms_)
{
ms_ = &fix_ms_->data();
ms_counter_ = ms_->prop().addElementProperty< ScalarContainer<int> >("counter_ms","comm_exchange_borders","frame_invariant", "restart_yes");
ms_counter_->setDefaultValue(-1);
if(delete_atoms_)
error->fix_error(FLERR,this,"can not use 'delete_atoms' with fix multisphere");
if(!once_)
error->fix_error(FLERR,this,"must use 'count once' with fix multisphere");
}
}
/* ---------------------------------------------------------------------- */
@ -263,11 +283,11 @@ void FixMassflowMesh::init()
if (atom->rmass_flag == 0)
error->fix_error(FLERR,this,"requires atoms have mass");
if(modify->n_fixes_style("multisphere") && !ignore_ms_)
error->fix_error(FLERR,this,"does not support multi-sphere");
if(delete_atoms_ && 1 != atom->map_style)
error->fix_error(FLERR,this,"requires an atom map of type 'array', via an 'atom_modify map array' command");
if(!fix_ms_ && static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0)))
error->fix_error(FLERR,this,"fix multisphere must come before fix massflow/mesh in input script");
}
/* ---------------------------------------------------------------------- */
@ -311,13 +331,14 @@ void FixMassflowMesh::post_integrate()
double dot,delta[3];
double mass_this = 0.;
int nparticles_this = 0.;
double property_this = 0.;
double deltan;
int *tag = atom->tag;
class FixPropertyAtom* fix_color=static_cast<FixPropertyAtom*>(modify->find_fix_property("color","property/atom","scalar",0,0,style,false));
bool fixColFound = false;
bool fixColFound = false;
if (fix_color) fixColFound=true;
TriMesh *mesh = fix_mesh_->triMesh();
int nTriAll = mesh->sizeLocal() + mesh->sizeGhost();
@ -331,6 +352,9 @@ void FixMassflowMesh::post_integrate()
reset_t_count_ = true;
}
/*NL*///if(fix_property_)
/*NL*/// fprintf(screen,"FOUNDE PROP, id %s style %s\n",fix_property_->id,fix_property_->style);
// loop owned and ghost triangles
// count only if owned particle
@ -350,9 +374,10 @@ void FixMassflowMesh::post_integrate()
// skip ghost particles
if(iPart >= nlocal) continue;
// in case of once_ == true, ignore
// everything which has been already counted
if(compDouble(counter[iPart],2.)) continue;
const int ibody = fix_ms_ ? ( (fix_ms_->belongs_to(iPart) > -1) ? (ms_->map(fix_ms_->belongs_to(iPart))) : -1 ) : -1;
// in case of once_ == true, ignore everything which has been already counted
if((ibody > -1) ? ((*ms_counter_)(ibody) == 2) : (compDouble(counter[iPart],2.)) ) continue;
if(havePointAtOutlet_)
{
@ -376,9 +401,12 @@ void FixMassflowMesh::post_integrate()
}
// first-time, just set 0 or 1 depending on what side of the mesh
if(compDouble(counter[iPart],-1.))
if((ibody > -1) ? ((*ms_counter_)(ibody) == -1) : (compDouble(counter[iPart],-1.)) )
{
counter[iPart] = (dot <= 0.) ? 0. : 1.;
if(ibody > -1)
(*ms_counter_)(ibody) = (dot <= 0.) ? 0. : 1.;
else
counter[iPart] = (dot <= 0.) ? 0. : 1.;
/*NL*/ //if(523 == atom->tag[iPart]) fprintf(screen," 1 counter set to %f\n",counter[iPart]);
continue;
}
@ -386,10 +414,18 @@ void FixMassflowMesh::post_integrate()
// particle is now on nvec_ side
if(dot > 0.)
{
if(compDouble(counter[iPart],0.)) //particle was not on nvec_ side before
//particle was not on nvec_ side before
if((ibody > -1) ? ((*ms_counter_)(ibody) == 0) : (compDouble(counter[iPart],0.)) ) // compDouble(counter[iPart],0.))
{
//NP each particle holds whole MS mass
mass_this += rmass[iPart];
nparticles_this ++;
if(fix_property_)
{
/*NL*/ //fprintf(screen,"adding %e\n",fix_property_->vector_atom[iPart]);
property_this += fix_property_->vector_atom[iPart];
}
if(delete_atoms_)
{
atom_tags_delete_.push_back(atom->tag[iPart]);
@ -400,19 +436,19 @@ void FixMassflowMesh::post_integrate()
tag[iPart],2.*radius[iPart]/force->cg(),
x[iPart][0],x[iPart][1],x[iPart][2],
v[iPart][0],v[iPart][1],v[iPart][2]);
if (fp_)
if(fp_)
{
if (fixColFound)
{
fprintf(fp_," %d %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.0g \n ",
fprintf(fp_," %d %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.0g \n ",
tag[iPart],2.*radius[iPart]/force->cg(),
x[iPart][0],x[iPart][1],x[iPart][2],
v[iPart][0],v[iPart][1],v[iPart][2],
fix_color->vector_atom[iPart]);
}
else
{
fprintf(fp_," %d %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g \n ",
{
fprintf(fp_," %d %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g %4.4g \n ",
tag[iPart],2.*radius[iPart]/force->cg(),
x[iPart][0],x[iPart][1],x[iPart][2],
v[iPart][0],v[iPart][1],v[iPart][2]);
@ -421,23 +457,32 @@ void FixMassflowMesh::post_integrate()
}
}
counter[iPart] = once_ ? 2. : 1.;
if(ibody > -1)
(*ms_counter_)(ibody) = once_ ? 2. : 1.;
else
counter[iPart] = once_ ? 2. : 1.;
/*NL*/ //if(523 == atom->tag[iPart]) fprintf(screen," 2 counter set to %f\n",counter[iPart]);
}
else // dot <= 0
{
counter[iPart] = 0.;
if(ibody > -1)
(*ms_counter_)(ibody) = 0;
else
counter[iPart] = 0.;
/*NL*/ //if(523 == atom->tag[iPart]) fprintf(screen," 3 counter set to %f\n",counter[iPart]);
}
}
}
MPI_Sum_Scalar(mass_this,world);
MPI_Sum_Scalar(nparticles_this,world);
if(fix_property_) MPI_Sum_Scalar(property_this,world);
/*NL*/ //fprintf(screen,"property_this %e\n",property_this);
mass_ += mass_this;
nparticles_ += nparticles_this;
property_sum_ += property_this;
}
@ -561,6 +606,8 @@ double FixMassflowMesh::compute_vector(int index)
return mass_deleted_;
if(index == 5)
return static_cast<double>(nparticles_deleted_);
if(index == 6 && fix_property_)
return property_sum_;
return 0.;
}

View File

@ -75,10 +75,13 @@ class FixMassflowMesh : public Fix {
// counted only once
bool once_;
// mass and particles which was counted
double mass_;
int nparticles_;
bool ignore_ms_;
// additional property to sum
class FixPropertyAtom *fix_property_;
double property_sum_;
// data write
bool screenflag_;
@ -96,6 +99,10 @@ class FixMassflowMesh : public Fix {
double mass_deleted_;
double nparticles_deleted_;
class FixMultisphere* fix_ms_;
class MultisphereParallel *ms_;
class ScalarContainer<int> *ms_counter_;
}; //end class
}

View File

@ -183,7 +183,10 @@ FixMesh::~FixMesh()
void FixMesh::post_create()
{
// check if all element property container have same length
// could potentially be whacked by adding element properties
// at the wrong place in code
mesh_->check_element_property_consistency();
}
/* ---------------------------------------------------------------------- */

View File

@ -120,26 +120,85 @@ FixMeshSurfaceStress::~FixMeshSurfaceStress()
{
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::post_create_pre_restart()
{
//NP called after constructor and before restart
//NP i.e. no restart: mesh elements present at this point
//NP restart: no mesh elements present because created in restart()
//Np -->register properties and set values for non-restart properties here
if(stress_flag_)
initStress();
regStress();
if(wear_flag_)
initWear();
regWear();
}
/* ---------------------------------------------------------------------- */
//NP in case of no restart, mem for properties is allocated directly
//NP by addElementProperty because mesh elements are already present
//NP restart allocates mem for all element properties (unititialized)
//NP (callback via addElement), but are unitilized, so have to init
//NP them in post_create
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::post_create()
{
//NP called after constructor and restart
//NP i.e. no restart: mesh elements present at this point
//NP restart: no mesh elements present because created in restart()
//Np --> set values for no-restart properties here
if(stress_flag_)
zeroizeStress();
if(wear_flag_)
zeroizeWear();
FixMeshSurface::post_create();
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::regStress()
{
mesh()->prop().addElementProperty<VectorContainer<double,3> >("f","comm_reverse","frame_invariant","restart_no");
mesh()->prop().addElementProperty<ScalarContainer<double> >("sigma_n","comm_none","frame_invariant","restart_no");
mesh()->prop().addElementProperty<ScalarContainer<double> >("sigma_t","comm_none","frame_invariant","restart_no");
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::zeroizeStress()
{
mesh()->prop().getElementProperty<VectorContainer<double,3> >("f")->setAll(0.);
mesh()->prop().getElementProperty<ScalarContainer<double> >("sigma_n")->setAll(0.);
mesh()->prop().getElementProperty<ScalarContainer<double> >("sigma_t")->setAll(0.);
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::regWear()
{
mesh()->prop().addElementProperty<ScalarContainer<double> >("wear","comm_exchange_borders","frame_invariant","restart_yes");
mesh()->prop().getElementProperty<ScalarContainer<double> >("wear")->setAll(0.);
mesh()->prop().addElementProperty<ScalarContainer<double> >("wear_step","comm_reverse","frame_invariant","restart_no");
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::zeroizeWear()
{
mesh()->prop().getElementProperty<ScalarContainer<double> >("wear_step")->setAll(0.);
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::init()
{
if(stress_flag_)
@ -178,28 +237,6 @@ void FixMeshSurfaceStress::setup_pre_force(int vflag)
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::initStress()
{
mesh()->prop().addElementProperty<VectorContainer<double,3> >("f","comm_reverse","frame_invariant","restart_no");
mesh()->prop().getElementProperty<VectorContainer<double,3> >("f")->setAll(0.);
mesh()->prop().addElementProperty<ScalarContainer<double> >("sigma_n","comm_none","frame_invariant","restart_no");
mesh()->prop().getElementProperty<ScalarContainer<double> >("sigma_n")->setAll(0.);
mesh()->prop().addElementProperty<ScalarContainer<double> >("sigma_t","comm_none","frame_invariant","restart_no");
mesh()->prop().getElementProperty<ScalarContainer<double> >("sigma_t")->setAll(0.);
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::initWear()
{
mesh()->prop().addElementProperty<ScalarContainer<double> >("wear","comm_exchange_borders","frame_invariant","restart_yes");
mesh()->prop().getElementProperty<ScalarContainer<double> >("wear")->setAll(0.);
mesh()->prop().addElementProperty<ScalarContainer<double> >("wear_step","comm_reverse","frame_invariant","restart_no");
mesh()->prop().getElementProperty<ScalarContainer<double> >("wear_step")->setAll(0.);
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress::pre_force(int vflag)
{
FixMeshSurface::pre_force(vflag);
@ -241,6 +278,8 @@ void FixMeshSurfaceStress::add_particle_contribution(int ip,double *frc,
vectorNegate3D(frc);
vectorAdd3D(x,delta,contactPoint);
if(trackStress())
{
/*NL*/ //if(strcmp(id,"servo")==0) printVec3D(screen,"added force",frc);
@ -250,7 +289,6 @@ void FixMeshSurfaceStress::add_particle_contribution(int ip,double *frc,
vectorAdd3D(f(iTri),frc,f(iTri));
// add contribution to total body force and torque
vectorAdd3D(x,delta,contactPoint);
vectorAdd3D(f_total_,frc,f_total_);
vectorSubtract3D(contactPoint,p_ref_(0),tmp);
/*NL*/ //fprintf(screen,"p_ref_ %f %f %f\n",p_ref_(0)[0],p_ref_(0)[1],p_ref_(0)[2]);

View File

@ -57,7 +57,7 @@ namespace LAMMPS_NS
virtual void pre_force(int vflag);
virtual void final_integrate();
double compute_vector(int n);
virtual double compute_vector(int n);
virtual void add_particle_contribution(int ip, double *frc,
double *delta, int iTri, double *v_wall);
@ -120,8 +120,10 @@ namespace LAMMPS_NS
private:
// inititalization fcts
void initStress();
void initWear();
void regStress();
void regWear();
void zeroizeStress();
void zeroizeWear();
void calc_total_force();
void add_gravity();

View File

@ -93,6 +93,8 @@ FixMeshSurfaceStress6DOF::FixMeshSurfaceStress6DOF(LAMMPS *lmp, int narg, char *
init_defaults();
size_vector = 9;
// parse further args
//NP may NOT change quat since MultiNodeMesh::setRotation() assumes is called with
//NP unit quat the first time
@ -228,9 +230,6 @@ FixMeshSurfaceStress6DOF::FixMeshSurfaceStress6DOF(LAMMPS *lmp, int narg, char *
// store original position and rotation state
xcm_orig_.add(xcm_(0));
quat_orig_.add(quat_(0));
//NP inform mesh of upcoming movement
mesh()->registerMove(false,true,true);
}
/* ---------------------------------------------------------------------- */
@ -241,13 +240,31 @@ FixMeshSurfaceStress6DOF::~FixMeshSurfaceStress6DOF()
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress6DOF::post_create_pre_restart()
{
FixMeshSurfaceStress::post_create_pre_restart();
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress6DOF::post_create()
{
/*NL*/ //fprintf(screen,"after re pref %f %f %f\n",p_ref(0),p_ref(1),p_ref(2));
/*NL*/ //fprintf(screen,"after re torque_total %f %f %f\n",torque_total(0),torque_total(1),torque_total(2));
/*NL*/ //printVec3D(screen,"after re xcm",xcm_(0));
/*NL*/ //printVec4D(screen,"after re quat",quat_(0));
/*NL*/ //fprintf(screen,"sizes xcm %d mass %d moi %d\n",xcm_.size(),mass_.size(),moi_.size());
FixMeshSurfaceStress::post_create();
init_rotation_props();
calc_displace();
//NP inform mesh of upcoming movement
//NP has to be done here so that all elements are read in case of restart
mesh()->registerMove(false,true,true);
}
/* ---------------------------------------------------------------------- */
@ -388,6 +405,14 @@ void FixMeshSurfaceStress6DOF::init()
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress6DOF::setup_pre_force(int vflag)
{
FixMeshSurfaceStress::setup_pre_force(vflag);
set_p_ref(xcm_(0));
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStress6DOF::setup(int vflag)
{
vectorCopy3D(xcm_(0),xcm_orig_(0));
@ -426,6 +451,10 @@ void FixMeshSurfaceStress6DOF::initial_integrate(int vflag)
// update angular momentum by 1/2 step
/*NL*/ //fprintf(screen,"pref %f %f %f\n",p_ref(0),p_ref(1),p_ref(2));
/*NL*/ //fprintf(screen,"torque_total %f %f %f\n",torque_total(0),torque_total(1),torque_total(2));
/*NL*/// printVec3D(screen,"xcm",xcm_(0));
if(tflag_(0)[0]) angmom_(0)[0] += dtf_ * torque_total(0);
if(tflag_(0)[1]) angmom_(0)[1] += dtf_ * torque_total(1);
if(tflag_(0)[2]) angmom_(0)[2] += dtf_ * torque_total(2);
@ -606,3 +635,14 @@ void FixMeshSurfaceStress6DOF::set_vel()
memory->destroy<double>(vNodes);
}
/* ----------------------------------------------------------------------
return total force or torque component on body or xcm
------------------------------------------------------------------------- */
double FixMeshSurfaceStress6DOF::compute_vector(int n)
{
if(n < 6) return FixMeshSurfaceStress::compute_vector(n);
else return xcm_(0)[n-6];
}

View File

@ -42,15 +42,19 @@ class FixMeshSurfaceStress6DOF : public FixMeshSurfaceStress {
FixMeshSurfaceStress6DOF(class LAMMPS *, int, char **);
virtual ~FixMeshSurfaceStress6DOF();
virtual void post_create_pre_restart();
virtual void post_create();
void init();
virtual void setup(int vflag);
virtual void setup_pre_force(int vflag);
int setmask();
void initial_integrate(int vflag);
void final_integrate();
double compute_vector(int n);
private:
void init_defaults();

View File

@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "fix_mesh_surface_stress_servo.h"
#include "atom.h"
#include "force.h"
@ -38,7 +39,6 @@
#include "vector_liggghts.h"
#include "fix_property_global.h"
#include "modified_andrew.h"
#include <vector>
using namespace LAMMPS_NS;
using namespace FixConst;
@ -58,51 +58,51 @@ enum{NONE,CONSTANT,EQUAL,FORCE,TORQUE};
/* ---------------------------------------------------------------------- */
FixMeshSurfaceStressServo::FixMeshSurfaceStressServo(LAMMPS *lmp, int narg, char **arg) :
FixMeshSurfaceStress(lmp, narg, arg),
xcm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("xcm","comm_none","frame_invariant","restart_yes",3)),
vcm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("vcm","comm_none","frame_invariant","restart_yes",1)),
omegacm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("torquecm","comm_none","frame_invariant","restart_yes",1)),
xcm_orig_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("xcm_orig","comm_none","frame_invariant","restart_yes",3)),
FixMeshSurfaceStress(lmp, narg, arg),
xcm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("xcm","comm_none","frame_invariant","restart_yes")),
vcm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("vcm","comm_none","frame_invariant","restart_yes")),
omegacm_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("torquecm","comm_none","frame_invariant","restart_yes")),
xcm_orig_( *mesh()->prop().addGlobalProperty< VectorContainer<double,3> > ("xcm_orig","comm_none","frame_invariant","restart_yes")),
nodes_( mesh()->nodePtr()),
v_( *mesh()->prop().addElementProperty< MultiVectorContainer<double,3,3> > ("v","comm_exchange_borders","frame_invariant","restart_no",1)),
nodes_( mesh()->nodePtr()),
v_(0),
totalPhi_( 0.),
ctrl_op_( 0),
pv_vec_( 0),
totalPhi_( 0.),
ctrl_op_( 0),
pv_vec_( 0),
vel_max_( 0.),
vel_min_( 0.),
ctrl_op_max_(0.),
ctrl_op_min_(0.),
ratio_(0.),
vel_max_( 0.),
vel_min_( 0.),
ctrl_op_max_(0.),
ctrl_op_min_(0.),
ratio_(0.),
sp_mag_(0.),
sp_mag_inv_(0.),
pv_mag_(0.),
old_pv_mag_(0.),
sp_mag_(0.),
sp_mag_inv_(0.),
pv_mag_(0.),
old_pv_mag_(0.),
err_( 0.),
sum_err_( 0.),
kp_( 0.01),
ki_( 0.),
kd_( 0.),
err_( 0.),
sum_err_( 0.),
kp_( 0.01),
ki_( 0.),
kd_( 0.),
sp_var_( -1),
sp_style_( NONE),
sp_str_( NULL),
sp_var_( -1),
sp_style_( NONE),
sp_str_( NULL),
int_flag_( true),
mode_flag_(false),
ctrl_style_(NONE),
mod_andrew_(new ModifiedAndrew(lmp))
int_flag_( true),
mode_flag_(false),
ctrl_style_(NONE),
mod_andrew_(new ModifiedAndrew(lmp))
{
if(!trackStress())
error->fix_error(FLERR,this,"stress = 'on' required");
if(verbose() && manipulated())
error->warning(FLERR,"Mesh has been scaled, moved, or rotated.\n"
"Please note that values for 'com', 'vel' refer to the scaled, moved, or rotated configuration");
"Please note that values for 'com', 'vel' refer to the scaled, moved, or rotated configuration");
// override default from base
size_vector = 9;
@ -120,7 +120,7 @@ mod_andrew_(new ModifiedAndrew(lmp))
hasargs = false;
if(strcmp(arg[iarg_],"com") == 0) {
if (narg < iarg_+4) error->fix_error(FLERR,this,"not enough arguments for 'com'");
iarg_++;
++iarg_;
double _com[3];
_com[0] = force->numeric(FLERR,arg[iarg_++]);
_com[1] = force->numeric(FLERR,arg[iarg_++]);
@ -137,16 +137,16 @@ mod_andrew_(new ModifiedAndrew(lmp))
hasargs = true;
} else if(strcmp(arg[iarg_],"vel_max") == 0) {
if (narg < iarg_+2) error->fix_error(FLERR,this,"not enough arguments for 'vel'");
iarg_++;
++iarg_;
vel_max_ = force->numeric(FLERR,arg[iarg_++]);
if(vel_max_ <= 0.)
error->fix_error(FLERR,this,"vel_max > 0 required");
hasargs = true;
} else if(strcmp(arg[iarg_],"target_val") == 0) {
if (narg < iarg_+2) error->fix_error(FLERR,this,"not enough arguments for 'target_val'");
iarg_++;
++iarg_;
if (strstr(arg[iarg_],"v_") == arg[iarg_]) {
int n = strlen(&arg[iarg_][2]) + 1;
const int n = strlen(&arg[iarg_][2]) + 1;
sp_str_ = new char[n];
strcpy(sp_str_,&arg[iarg_][2]);
sp_style_ = EQUAL;
@ -156,13 +156,15 @@ mod_andrew_(new ModifiedAndrew(lmp))
sp_mag_inv_ = 1./fabs(sp_mag_);
sp_style_ = CONSTANT;
}
iarg_++;
++iarg_;
hasargs = true;
} else if(strcmp(arg[iarg_],"axis") == 0) {
if (narg < iarg_+4) error->fix_error(FLERR,this,"not enough arguments for 'axis'");
axis_[0] = force->numeric(FLERR,arg[iarg_+1]);
axis_[1] = force->numeric(FLERR,arg[iarg_+2]);
axis_[2] = force->numeric(FLERR,arg[iarg_+3]);
// normalize axis
vectorNormalize3D(axis_);
iarg_ = iarg_+4;
hasargs = true;
} else if(strcmp(arg[iarg_],"kp") == 0) {
@ -180,15 +182,15 @@ mod_andrew_(new ModifiedAndrew(lmp))
kd_ = force->numeric(FLERR,arg[iarg_+1]);
iarg_ = iarg_+2;
hasargs = true;
} else if(strcmp(arg[iarg_],"mode") == 0) { //NP Test Aigner
} else if(strcmp(arg[iarg_],"mode") == 0) {
if (narg < iarg_+2) error->fix_error(FLERR,this,"not enough arguments");
iarg_++;
++iarg_;
if (strcmp("auto",arg[iarg_]) == 0) {
mode_flag_ = true;
} else error->fix_error(FLERR,this,"mode supports only auto");
iarg_++;
++iarg_;
hasargs = true;
} else if(strcmp(arg[iarg_],"ratio") == 0) { //NP Test Aigner
} else if(strcmp(arg[iarg_],"ratio") == 0) {
if (narg < iarg_+2) error->fix_error(FLERR,this,"not enough arguments");
ratio_ = force->numeric(FLERR,arg[iarg_+1]);
iarg_ = iarg_+2;
@ -203,15 +205,6 @@ mod_andrew_(new ModifiedAndrew(lmp))
// store original position
xcm_orig_.add(xcm_(0));
//NP inform mesh of upcoming movement
if (ctrl_style_ == FORCE)
mesh()->registerMove(false,true,false);
else if(ctrl_style_ == TORQUE)
mesh()->registerMove(false,false,true);
else
error->fix_error(FLERR,this,"Bad registration of upcoming move.");
}
/* ---------------------------------------------------------------------- */
@ -224,9 +217,39 @@ FixMeshSurfaceStressServo::~FixMeshSurfaceStressServo()
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStressServo::post_create_pre_restart()
{
FixMeshSurfaceStress::post_create_pre_restart();
//NP called after constructor and before restart
//NP i.e. no restart: mesh elements present at this point
//NP restart: no mesh elements present because created in restart()
//Np -->register properties and set values for non-restart properties here
mesh()->prop().addElementProperty< MultiVectorContainer<double,3,3> > ("v","comm_exchange_borders","frame_invariant","restart_no");
}
/* ---------------------------------------------------------------------- */
void FixMeshSurfaceStressServo::post_create()
{
FixMeshSurfaceStress::post_create();
//NP inform mesh of upcoming movement
//NP do here so all mesh elements created already
if (ctrl_style_ == FORCE)
mesh()->registerMove(false,true,false);
else if(ctrl_style_ == TORQUE)
mesh()->registerMove(false,false,true);
else
error->fix_error(FLERR,this,"Bad registration of upcoming move.");
//NP called after constructor and restart
//NP i.e. no restart: mesh elements present at this point
//NP restart: no mesh elements present because created in restart()
//Np --> set values for no-restart properties here
mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->setAll(0.);
}
/* ---------------------------------------------------------------------- */
@ -269,6 +292,14 @@ void FixMeshSurfaceStressServo::error_checks()
if(mesh()->nMove() > 1)
error->fix_error(FLERR,this,"this fix does not allow superposition with moving mesh fixes");
// check if servo-wall is also a granular wall
if (!fix_mesh_neighlist_)
error->fix_error(FLERR,this,"The servo-wall requires a contact model. Therefore, it has to be used for a fix wall/gran too.");
// no respa integrator
if (strcmp(update->integrate_style,"respa") == 0)
error->fix_error(FLERR,this,"not respa-compatible");
/*NL*/ //fprintf(screen,"nmove %d\n",mesh()->nMove() );
}
@ -276,14 +307,26 @@ void FixMeshSurfaceStressServo::error_checks()
void FixMeshSurfaceStressServo::init()
{
/*NL*/ //int size1 = (mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v"))->size();
/*NL*/ //int size2 = (mesh()->prop().getElementProperty<ScalarContainer<int> >("id"))->size();
/*NL*/ //fprintf(screen,"proc %d, size of v container %d\n",comm->me,size1);
/*NL*/ //fprintf(screen,"proc %d, size of ID container %d\n",comm->me,size2);
FixMeshSurfaceStress::init();
set_p_ref(xcm_(0));
// do some error checks
error_checks();
// get timestep
reset_dt();
// update ptrs
nodes_ = mesh()->nodePtr();
v_ = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v");
// check variables
if (sp_str_) {
sp_var_ = input->variable->find(sp_str_);
@ -293,14 +336,14 @@ void FixMeshSurfaceStressServo::init()
error->fix_error(FLERR,this,"Variable is invalid style");
}
// set pointers for controller
// controller parameters
double r_min,r;
const int nlocal = atom->nlocal;
const double rPaMax = getMaxRad();
r = r_min = BIG;
for (int ii = 0; ii < nlocal; ii++) {
r = atom->radius[ii];
for (int i = 0; i < nlocal; ++i) {
r = atom->radius[i];
r_min = MIN(r_min,r);
}
MPI_Min_Scalar(r_min,world);
@ -309,44 +352,34 @@ void FixMeshSurfaceStressServo::init()
// set pointers for controller
switch (ctrl_style_) {
case FORCE:
pv_vec_ = f_total_;
ctrl_op_ = vcm_(0);
ctrl_op_max_ = vel_max_;
ctrl_op_min_ = vel_min_;
break;
case TORQUE:
pv_vec_ = torque_total_;
ctrl_op_ = omegacm_(0);
case FORCE:
pv_vec_ = f_total_;
ctrl_op_ = vcm_(0);
ctrl_op_max_ = vel_max_;
ctrl_op_min_ = vel_min_;
break;
case TORQUE:
pv_vec_ = torque_total_;
ctrl_op_ = omegacm_(0);
// find maximum distance axis-node
if (rPaMax == 0)
error->fix_error(FLERR,this,"All mesh nodes are located at the rotation axis.");
// find maximum distance axis-node
if (rPaMax == 0)
error->fix_error(FLERR,this,"All mesh nodes are located at the rotation axis.");
// maximum angular velocity
ctrl_op_max_ = vel_max_/rPaMax;
ctrl_op_min_ = vel_min_/rPaMax;
break;
default:
error->fix_error(FLERR,this,"This may not happen!");
break;
// maximum angular velocity
ctrl_op_max_ = vel_max_/rPaMax;
ctrl_op_min_ = vel_min_/rPaMax;
break;
default:
error->fix_error(FLERR,this,"This may not happen!");
break;
}
// check maximal velocity
double skin = neighbor->skin;
const double skin = neighbor->skin;
if(vel_max_ >= skin/(2.*dtv_))
error->fix_error(FLERR,this,"vel_max < skin/(2.*dt) required");
// check if servo-wall is also a granular wall
if (!fix_mesh_neighlist_)
error->fix_error(FLERR,this,"The servo-wall requires a contact model. Therefore, it has to be used for a fix wall/gran too.");
if (strcmp(update->integrate_style,"respa") == 0)
error->fix_error(FLERR,this,"not respa-compatible");
// normalize axis
vectorNormalize3D(axis_);
// compute global number of contacts
fix_mesh_neighlist_->enableTotalNumContacts(true);
}
@ -379,43 +412,42 @@ void FixMeshSurfaceStressServo::initial_integrate(int vflag)
UNUSED(vflag);
double dX[3],dx[3];
double incrementalPhi;
// only if the wall should move
if (int_flag_) {
switch (ctrl_style_) {
case FORCE:
case FORCE:
// update xcm by full step
// update xcm by full step
dx[0] = dtv_ * vcm_(0)[0];
dx[1] = dtv_ * vcm_(0)[1];
dx[2] = dtv_ * vcm_(0)[2];
vectorAdd3D(xcm_(0),dx,xcm_(0));
vectorSubtract3D(xcm_(0),xcm_orig_(0),dX);
dx[0] = dtv_ * vcm_(0)[0];
dx[1] = dtv_ * vcm_(0)[1];
dx[2] = dtv_ * vcm_(0)[2];
vectorAdd3D(xcm_(0),dx,xcm_(0));
vectorSubtract3D(xcm_(0),xcm_orig_(0),dX);
mesh()->move(dX,dx);
mesh()->move(dX,dx);
// update reference point to COM
//NP would not be necessary b/c p_ref_ is moved, rotated automatically
//NP do it anyway to avoid long-term divergence
//NP which could happen b/c move, rotate is done incrementally
// update reference point to COM
//NP would not be necessary b/c p_ref_ is moved, rotated automatically
//NP do it anyway to avoid long-term divergence
//NP which could happen b/c move, rotate is done incrementally
set_p_ref(xcm_(0));
/*NL*/ //fprintf(screen,"p_ref %g %g %g\n",p_ref(0),p_ref(1),p_ref(2));
/*NL*/ //printVec3D(screen,"xcm",xcm_(0));
set_p_ref(xcm_(0));
/*NL*/ //fprintf(screen,"p_ref %g %g %g\n",p_ref(0),p_ref(1),p_ref(2));
/*NL*/ //printVec3D(screen,"xcm",xcm_(0));
break;
break;
case TORQUE:
incrementalPhi = dtv_ * vectorDot3D(omegacm_(0),axis_);
totalPhi_ += incrementalPhi;
case TORQUE:
const double incrementalPhi = dtv_ * vectorDot3D(omegacm_(0),axis_);
totalPhi_ += incrementalPhi;
//rotate the mesh
mesh()->rotate(totalPhi_,incrementalPhi,axis_,xcm_(0));
//rotate the mesh
mesh()->rotate(totalPhi_,incrementalPhi,axis_,xcm_(0));
break;
break;
}
}
@ -457,16 +489,13 @@ void FixMeshSurfaceStressServo::final_integrate()
}
// auto mode
//NP TEST AIGNER
// auto mode - p-controller with variable proportional gain
if (mode_flag_) {
pv_mag_ = vectorDot3D(pv_vec_,axis_);
err_ = (sp_mag_ - pv_mag_) * sp_mag_inv_;
// TODO: Valid or trash?
// Hard coded test for piecewise controller
// This setting works, but doesn't speed up most cases
// Hard coded piecewise controller
double ctrl_kp;
const double err_low = 0.9;
const double err_high = 1.0;
@ -520,12 +549,12 @@ void FixMeshSurfaceStressServo::final_integrate()
limit_vel();
switch (ctrl_style_) {
case FORCE:
set_v_node();
break;
case TORQUE:
set_v_node_rotate();
break;
case FORCE:
set_v_node();
break;
case TORQUE:
set_v_node_rotate();
break;
}
}
@ -571,12 +600,12 @@ void FixMeshSurfaceStressServo::limit_vel()
void FixMeshSurfaceStressServo::set_v_node()
{
int nall = mesh()->size();
int nnodes = mesh()->numNodes();
const int nall = mesh()->size();
const int nnodes = mesh()->numNodes();
for(int i = 0; i < nall; i++)
for(int j = 0; j < nnodes; j++)
v_.set(i,j,vcm_(0));
for(int i = 0; i < nall; ++i)
for(int j = 0; j < nnodes; ++j)
v_->set(i,j,vcm_(0));
}
@ -586,17 +615,17 @@ void FixMeshSurfaceStressServo::set_v_node_rotate()
{
double node[3],rPA[3],vRot[3];
int nall = mesh()->size();
int nnodes = mesh()->numNodes();
const int nall = mesh()->size();
const int nnodes = mesh()->numNodes();
for(int i = 0; i < nall; i++)
for(int i = 0; i < nall; ++i)
{
for(int j = 0; j < nnodes; j++)
for(int j = 0; j < nnodes; ++j)
{
vectorCopy3D(nodes_[i][j],node);
vectorSubtract3D(node,xcm_(0),rPA);
vectorCross3D(omegacm_(0),rPA,vRot);
v_.set(i,j,vRot);
v_->set(i,j,vRot);
}
}
}
@ -616,7 +645,7 @@ void FixMeshSurfaceStressServo::reset_dt()
------------------------------------------------------------------------- */
void FixMeshSurfaceStressServo::add_particle_contribution(int ip, double *frc,
double *delta, int iTri, double *v_wall)
double *delta, int iTri, double *v_wall)
{
FixMeshSurfaceStress::add_particle_contribution(ip,frc,delta,iTri,v_wall);
@ -637,12 +666,12 @@ double FixMeshSurfaceStressServo::getMaxRad()
double node[3],rPA[3],vRot[3];
double rPaMax = 0;
int nall = mesh()->size();
int nnodes = mesh()->numNodes();
const int nall = mesh()->size();
const int nnodes = mesh()->numNodes();
for(int i = 0; i < nall; i++)
for(int i = 0; i < nall; ++i)
{
for(int j = 0; j < nnodes; j++)
for(int j = 0; j < nnodes; ++j)
{
vectorCopy3D(nodes_[i][j],node);
vectorSubtract3D(node,xcm_(0),rPA);
@ -650,11 +679,15 @@ double FixMeshSurfaceStressServo::getMaxRad()
rPaMax = MAX(rPaMax,vectorMag3D(vRot));
}
}
// get max for all processors
MPI_Max_Scalar(rPaMax,world);
/*NL*/// fprintf(screen,"rPaMax = %f \n",rPaMax);
return rPaMax;
}
/* ----------------------------------------------------------------------
return total force or torque component on body
return total force or torque component on body or xcm
------------------------------------------------------------------------- */
double FixMeshSurfaceStressServo::compute_vector(int n)
@ -678,11 +711,10 @@ int FixMeshSurfaceStressServo::modify_param(int narg, char **arg)
error->fix_error(FLERR,this,"wrong argument for fix_modify 'integrate'");
return 2;
} else if (strcmp(arg[0],"target_val") == 0) {
if (narg < 2) error->fix_error(FLERR,this,"not enough arguments for fix_modify 'target_val'");
if (strstr(arg[1],"v_") == arg[1]) {
int n = strlen(&arg[1][2]) + 1;
const int n = strlen(&arg[1][2]) + 1;
sp_str_ = new char[n];
strcpy(sp_str_,&arg[1][2]);

View File

@ -42,84 +42,85 @@ FixStyle(mesh/surface/stress/servo,FixMeshSurfaceStressServo)
namespace LAMMPS_NS {
class FixMeshSurfaceStressServo : public FixMeshSurfaceStress {
class FixMeshSurfaceStressServo : public FixMeshSurfaceStress {
public:
public:
FixMeshSurfaceStressServo(class LAMMPS *, int, char **);
virtual ~FixMeshSurfaceStressServo();
FixMeshSurfaceStressServo(class LAMMPS *, int, char **);
virtual ~FixMeshSurfaceStressServo();
virtual void post_create();
virtual void post_create_pre_restart();
virtual void post_create();
void init();
int setmask();
void init();
int setmask();
virtual void setup_pre_force(int vflag);
void initial_integrate(int vflag);
void add_particle_contribution(int ip, double *frc,
double *delta, int iTri, double *v_wall);
void final_integrate();
virtual void setup_pre_force(int vflag);
void initial_integrate(int vflag);
void add_particle_contribution(int ip, double *frc,
double *delta, int iTri, double *v_wall);
void final_integrate();
void reset_dt();
double compute_vector(int n);
void reset_dt();
double compute_vector(int n);
private:
private:
void init_defaults();
void error_checks();
void init_defaults();
void error_checks();
void limit_vel();
void update_mass();
void set_v_node();
void set_v_node_rotate();
double getMaxRad();
int modify_param(int, char **);
void resetIntegrator() {sum_err_ = 0;}
void limit_vel();
void update_mass();
void set_v_node();
void set_v_node_rotate();
double getMaxRad();
int modify_param(int, char **);
void resetIntegrator() {sum_err_ = 0;}
// properties of mesh
// properties of mesh
VectorContainer<double,3> &xcm_;
VectorContainer<double,3> &vcm_;
VectorContainer<double,3> &omegacm_;
VectorContainer<double,3> &xcm_orig_;
VectorContainer<double,3> &xcm_;
VectorContainer<double,3> &vcm_;
VectorContainer<double,3> &omegacm_;
VectorContainer<double,3> &xcm_orig_;
// position and velocity for each node
// position and velocity for each node
double*** nodes_;
MultiVectorContainer<double,3,3> &v_;
double*** nodes_;
MultiVectorContainer<double,3,3> *v_;
// servo settings and controller
// servo settings and controller
double axis_[3],totalPhi_;
double *ctrl_op_,*pv_vec_;
double vel_max_,vel_min_,ctrl_op_max_,ctrl_op_min_,ratio_;
double sp_mag_,sp_mag_inv_;
double pv_mag_,old_pv_mag_;
double err_, sum_err_;
double kp_,ki_,kd_;
double axis_[3],totalPhi_;
double *ctrl_op_,*pv_vec_;
double vel_max_,vel_min_,ctrl_op_max_,ctrl_op_min_,ratio_;
double sp_mag_,sp_mag_inv_;
double pv_mag_,old_pv_mag_;
double err_, sum_err_;
double kp_,ki_,kd_;
// variable set point
int sp_var_, sp_style_;
char *sp_str_;
// variable set point
int sp_var_, sp_style_;
char *sp_str_;
// flags
bool int_flag_;
bool mode_flag_;
int ctrl_style_;
// flags
bool int_flag_;
bool mode_flag_;
int ctrl_style_;
// timesteps
double dtf_,dtv_;
// timesteps
double dtf_,dtv_;
// for area calculation
class ModifiedAndrew *mod_andrew_;
// for area calculation
class ModifiedAndrew *mod_andrew_;
//NP TODO: Is somewhere a better place for this function?!
// signum function
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
//NP TODO: Is somewhere a better place for this function?!
// signum function
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
}; //end class
}; //end class
}

View File

@ -80,6 +80,15 @@ FixMoveMesh::FixMoveMesh(LAMMPS *lmp, int narg, char **arg)
/* ---------------------------------------------------------------------- */
void FixMoveMesh:: post_create()
{
//NP must register move here in case of restart so that all
//NP elements are created already
move_->post_create();
}
/* ---------------------------------------------------------------------- */
void FixMoveMesh::pre_delete(bool unfixflag)
{
// check if another fix move operates on the same mesh
@ -157,7 +166,7 @@ void FixMoveMesh::setup(int vflag)
if(!mesh_->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v"))
{
//NP need to have borders comm in order not to loose vel information
//NP need to have borders comm in order not to loose vel information
//NP for ghost elements on reneighboring steps
mesh_->prop().addElementProperty<MultiVectorContainer<double,3,3> >("v","comm_exchange_borders","frame_invariant","restart_no");
/*NL*/// int size = mesh_->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->size();
@ -165,6 +174,14 @@ void FixMoveMesh::setup(int vflag)
}
move_->setup();
// do set-up in case velocity is dumped (called via set-up)
if(move_->isFirst())
{
MultiVectorContainer<double,3,3> *v;
v = mesh_->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v");
v->setAll(0.);
}
}
/* ---------------------------------------------------------------------- */

View File

@ -48,6 +48,8 @@ namespace LAMMPS_NS
FixMoveMesh(LAMMPS *lmp, int narg, char **arg);
virtual ~FixMoveMesh();
void post_create();
void setup(int vflag);
void pre_delete(bool unfixflag);
int setmask();

View File

@ -41,6 +41,7 @@ enum
class FixPropertyAtom : public Fix {
friend class Set;
friend class FixPropertyAtomUpdateFix;
public:
FixPropertyAtom(class LAMMPS *, int, char **,bool parse = true);
~FixPropertyAtom();

View File

@ -90,6 +90,9 @@ FixScalarTransportEquation::FixScalarTransportEquation(LAMMPS *lmp, int narg, ch
int_flag = true;
nevery_ = 1;
performedIntegrationLastStep_ = true; //ensure flux is reset at the very first time step
peratom_flag = 1; //NP 0/1 if per-atom data is stored
size_peratom_cols = 0; //NP 0 = scalar, N = columns in peratom array
peratom_freq = 1;
@ -252,6 +255,14 @@ int FixScalarTransportEquation::modify_param(int narg, char **arg)
return 2;
}
if (strcmp(arg[0],"every") == 0) {
if (narg < 2) error->fix_error(FLERR,this,"not enough arguments for fix_modify 'every'");
nevery_ = force->inumeric(FLERR,arg[1]);
// printf("FixScalarTransportEquation: will perform update every %d time steps. \n", nevery_);
return 1;
}
return 0;
}
@ -262,6 +273,10 @@ void FixScalarTransportEquation::initial_integrate(int vflag)
//NP update because re-allocation might have taken place
updatePtrs();
//Skip in case there was NO Integration the last time step (to keep flux in mem)
if(!performedIntegrationLastStep_)
return;
//reset heat flux
//sources are not reset
int *mask = atom->mask;
@ -305,6 +320,13 @@ void FixScalarTransportEquation::final_integrate()
if(!int_flag)
return;
// skip if integration not wanted at this timestep
if (update->ntimestep % nevery_)
{
performedIntegrationLastStep_ = false;
return;
}
//NP update because re-allocation might have taken place
updatePtrs();
@ -317,7 +339,11 @@ void FixScalarTransportEquation::final_integrate()
{
if (mask[i] & groupbit){
capacity = fix_capacity->compute_vector(type[i]-1);
if(fabs(capacity) > SMALL) quantity[i] += (flux[i] + source[i]) * dt / (rmass[i]*capacity);
if(fabs(capacity) > SMALL) quantity[i] += (
flux[i]
+ source[i]*double(nevery_) //multiply source to account for missing steps
) * dt
/ (rmass[i]*capacity);
}
}
}
@ -326,10 +352,14 @@ void FixScalarTransportEquation::final_integrate()
for (int i = 0; i < nlocal; i++)
{
if (mask[i] & groupbit){
quantity[i] += (flux[i] + source[i]) * dt;
quantity[i] += (
flux[i]
+ source[i]*double(nevery_) //multiply source to account for missing steps
) * dt ;
}
}
}
performedIntegrationLastStep_ = true;
}
/* ---------------------------------------------------------------------- */

View File

@ -68,14 +68,16 @@ class FixScalarTransportEquation : public Fix {
double *capacity;
char *capacity_name;
double quantity_0; //NP default value for potential
double *quantity; //NP particle Temperature
double quantity_0; //NP default value for potential
double *quantity; //NP particle Temperature
double *flux; //NP heat flux from/to the particle
double *source; //NP heat source
// flag if integrate quantity or not
bool int_flag;
int nevery_; //integrate only this many time steps (to avoid round-off issues)
bool performedIntegrationLastStep_;
};
}

View File

@ -216,6 +216,7 @@ void FixSphDensityContinuity::pre_force_eval(int vflag)
r = sqrt(rsq);
if (r == 0.) {
fprintf(screen,"Particle %i and %i are at same position (%f, %f, %f)\n",i,j,xtmp,ytmp,ztmp);
error->one(FLERR,"Zero distance between SPH particles!");
}
rinv = 1./r;

View File

@ -331,7 +331,8 @@ void FixTemplateMultiplespheres::calc_center_of_mass()
r_equiv = pow(6.*mass_expect/(8.*expectancy(pdf_density)*M_PI),1./3.);
/*NL*/ if(LMP_DEBUGMODE_MULTIPLESPHERES)
/*NL*/ fprintf(screen,"MC integration done: mass=%f, volume=%f, xcm=%f|%f|%f, r_equiv=%f\n",mass_expect,volume_expect,xcm[0],xcm[1],xcm[2],r_equiv);
/*NL*/ fprintf(screen,"MC integration done: mass=%e, volume=%e, xcm=%e|%e|%e, r_equiv=%e, nsuccess %d, ntry %d vol_box %f\n",
/*NL*/ mass_expect,volume_expect,xcm[0],xcm[1],xcm[2],r_equiv,nsuccess,ntry,(x_max[0]-x_min[0])*(x_max[1]-x_min[1])*(x_max[2]-x_min[2]));
// transform into a system with center of mass=0/0/0

View File

@ -67,7 +67,8 @@ using namespace FixConst;
FixTemplateMultisphere::FixTemplateMultisphere(LAMMPS *lmp, int narg, char **arg) :
FixTemplateMultiplespheres(lmp, narg, arg),
mass_set_(false),
moi_set_(false)
moi_set_(false),
use_density_(-1)
{
delete pti;
pti = new ParticleToInsertMultisphere(lmp,nspheres);
@ -109,6 +110,12 @@ FixTemplateMultisphere::FixTemplateMultisphere(LAMMPS *lmp, int narg, char **arg
mass_expect = atof(arg[iarg++]);
mass_set_ = true;
hasargs = true;
} else if(strcmp(arg[iarg],"use_volume") == 0) {
iarg++;
use_density_ = 0;
} else if(strcmp(arg[iarg],"use_density") == 0) {
iarg++;
use_density_ = 1;
} else if(strcmp(arg[iarg],"inertia_tensor") == 0) {
if (iarg+7 > narg)
error->fix_error(FLERR,this,"not enough arguments for 'inertia_tensor'");
@ -135,6 +142,9 @@ FixTemplateMultisphere::FixTemplateMultisphere(LAMMPS *lmp, int narg, char **arg
if((mass_set_ && !moi_set_) || (!mass_set_ && moi_set_))
error->fix_error(FLERR,this,"have to define either both 'mass' and 'inertia_tensor' or none of the two");
if(mass_set_ && -1 == use_density_)
error->fix_error(FLERR,this,"have to use either 'use_volume' or 'use_density' in case 'mass' and 'moi' are specified");
}
/* ---------------------------------------------------------------------- */
@ -144,14 +154,38 @@ void FixTemplateMultisphere::post_create()
// bounding sphere, center of mass calculations in mother class
// calculate inertia_ tensor and its eigensystem
// use density and volume from MC; mass calculated
if(!mass_set_)
{
// bounding sphere and center of mass
FixTemplateMultiplespheres::post_create();
calc_inertia();
calc_eigensystem();
calc_displace_xcm_x_body();
}
// use mass specified and volume_mc; density calculated
else if(0 == use_density_)
{
// store mass read in from input script
double mass = mass_expect;
// bounding sphere and center of mass
// calculates mass_expect, volume_expect, r_equiv
FixTemplateMultiplespheres::post_create();
// re-apply mass read in from input script
// re-calc r_equiv without using density
mass_expect = mass;
r_equiv = pow(3.*volume_expect/(4.*M_PI),1./3.);
pdf_density->set_params<RANDOM_CONSTANT>(mass_expect/volume_expect);
/*NL*/ if(LMP_DEBUGMODE_MULTISPHERE) fprintf(screen,"overwrote MC values; now: mass_expect %e, r_equiv %f\n",mass_expect,r_equiv);
// calc rest of stuff
calc_eigensystem();
calc_displace_xcm_x_body();
}
// use density specified and mass specified; volume calculated
else
{
calc_bounding_sphere();
@ -162,8 +196,10 @@ void FixTemplateMultisphere::post_create()
// calc expectancy values
volume_expect = mass_expect / expectancy(pdf_density);
r_equiv = pow(6.*mass_expect/(8.*expectancy(pdf_density)*M_PI),1./3.);
/*NL*/ if(LMP_DEBUGMODE_MULTISPHERE) fprintf(screen,"overwrote MC values; now: volume_expect %e, r_equiv %f\n",volume_expect,r_equiv);
}
print_info();
}

View File

@ -68,6 +68,7 @@ class FixTemplateMultisphere : public FixTemplateMultiplespheres {
// flags
bool mass_set_, moi_set_;
int use_density_;
// inertia of clump
double moi_[3][3]; // 3x3 inertia tensor

View File

@ -390,8 +390,11 @@ double FixTemplateSphere::max_r_bound()
double FixTemplateSphere::volexpect()
{
if(volume_expect < vol_limit)
{
/*NL*/ fprintf(screen,"volume_expect %f\n",volume_expect);
error->fix_error(FLERR,this,"Volume expectancy too small. Change 'volume_limit' "
"if you are sure you know what you're doing");
}
return volume_expect;
}

View File

@ -55,10 +55,12 @@ namespace LAMMPS_NS
void del(int n);
void delForward(int n,bool scale,bool translate,bool rotate);
void delRestart(int n,bool scale,bool translate,bool rotate);
void delRestart(bool scale,bool translate,bool rotate);
void clearReverse(bool scale,bool translate,bool rotate);
void get(int n, T** elem);
void setToDefault(int n);
void setAll(T def);
void setAll(int to, T def);
void set(int i, T** elem);
@ -138,6 +140,8 @@ namespace LAMMPS_NS
void copy(GeneralContainer<T,NUM_VEC,LEN_VEC> const & other);
void copy_n(GeneralContainer<T,NUM_VEC,LEN_VEC> const & other, const size_t n);
inline void setDefaultValue(T val)
{ defaultValue_ = val; useDefault_ = true; }
protected:
@ -160,6 +164,7 @@ namespace LAMMPS_NS
T* _end() const {
return &arr_[0][0][0] + numElem_*(NUM_VEC*LEN_VEC);
}
T defaultValue_;
};
// *************************************

View File

@ -36,7 +36,8 @@
GeneralContainer<T,NUM_VEC,LEN_VEC>::GeneralContainer(const char *_id)
: ContainerBase(_id),
numElem_(0),
maxElem_(GROW)
maxElem_(GROW),
defaultValue_(0)
{
create<T>(arr_,GROW,NUM_VEC,LEN_VEC);
}
@ -45,7 +46,8 @@
GeneralContainer<T,NUM_VEC,LEN_VEC>::GeneralContainer(const char *_id, const char *_comm, const char *_ref, const char *_restart, int _scalePower)
: ContainerBase(_id, _comm, _ref, _restart, _scalePower),
numElem_(0),
maxElem_(GROW)
maxElem_(GROW),
defaultValue_(0)
{
create<T>(arr_,GROW,NUM_VEC,LEN_VEC);
}
@ -54,7 +56,8 @@
GeneralContainer<T,NUM_VEC,LEN_VEC>::GeneralContainer(GeneralContainer<T,NUM_VEC,LEN_VEC> const &orig)
: ContainerBase(orig),
numElem_(orig.numElem_),
maxElem_(orig.numElem_)
maxElem_(orig.numElem_),
defaultValue_(orig.defaultValue_)
{
create<T>(arr_,maxElem_,NUM_VEC,LEN_VEC);
for(int i=0;i<maxElem_;i++)
@ -161,6 +164,9 @@
{
numElem_--;
if(numElem_ == n) return;
/*NL*/ //printf("numelem = %d id= %s\n",numElem_,id_);
/*NL*/ //printf("isDoubleData = %s isIntData = %s \n",isDoubleData()?"t":"f",isIntData()?"t":"f");
/*NL*/ //printf("size = %d nVec = %d lenVec = %d restartType_ %d \n",size(),nVec(),lenVec(),restartType_);
for(int i=0;i<NUM_VEC;i++)
for(int j=0;j<LEN_VEC;j++)
arr_[n][i][j] = arr_[numElem_][i][j];
@ -216,7 +222,7 @@
}
/* ----------------------------------------------------------------------
delete an element
delete an element if restart
------------------------------------------------------------------------- */
template<typename T, int NUM_VEC, int LEN_VEC>
@ -235,6 +241,21 @@
arr_[n][i][j] = arr_[numElem_][i][j];
}
/* ----------------------------------------------------------------------
delete all elements if restart
------------------------------------------------------------------------- */
template<typename T, int NUM_VEC, int LEN_VEC>
void GeneralContainer<T,NUM_VEC,LEN_VEC>::delRestart(bool scale,bool translate,bool rotate)
{
// do only delete property if it is a restart property
if(!decidePackUnpackOperation(OPERATION_RESTART, scale, translate, rotate))
return;
/*NL*/ //printf("del restart for %s, numElem_ %d, n %d\n",this->id_,numElem_,n);
numElem_ = 0;
}
/* ----------------------------------------------------------------------
get an element
------------------------------------------------------------------------- */
@ -297,6 +318,15 @@
/* ---------------------------------------------------------------------- */
template<typename T, int NUM_VEC, int LEN_VEC>
void GeneralContainer<T,NUM_VEC,LEN_VEC>::setToDefault(int n)
{
/*NL*/ //printf("setting for body # %d\n",n);
for(int i = 0; i < NUM_VEC; i++)
for(int j = 0; j < LEN_VEC; j++)
arr_[n][i][j] = defaultValue_;
}
template<typename T, int NUM_VEC, int LEN_VEC>
void GeneralContainer<T,NUM_VEC,LEN_VEC>::set(int n, T** elem)
{

Some files were not shown because too many files have changed in this diff Show More