diff --git a/doc/src/Developer/developer.tex b/doc/src/Developer/developer.tex index 3ba9018fb90ccdc29a23965e86f396c240b95529..9d9a93a53d7cd83aa6518e6d7fcce6da0c7880f5 100644 --- a/doc/src/Developer/developer.tex +++ b/doc/src/Developer/developer.tex @@ -449,15 +449,15 @@ Writing fixes is a flexible way of extending LAMMPS. Users can implement many things using fixes: \begin{itemize} -\item changing particles attributes (positions, velocities, forces, etc.). +\item changing particles attributes (positions, velocities, forces, etc.). Example: FixFreeze. \item reading/writing data. Example: FixRestart. \item implementing boundary conditions. Example: FixWall. -\item saving information about particles for future use (previous positions, +\item saving information about particles for future use (previous positions, for instance). Example: FixStoreState. \end{itemize} -All fixes are derived from class Fix and must have constructor with the +All fixes are derived from class Fix and must have constructor with the signature: FixMine(class LAMMPS *, int, char **). Every fix must be registered in LAMMPS by writing the following lines @@ -478,7 +478,7 @@ included in the file "style\_fix.h". In case if you use LAMMPS make, this file is generated automatically - all files starting with prefix fix\_ are included, so call your header the same way. Otherwise, donÕt forget to add your include into "style\_fix.h". - + Let's write a simple fix which will print average velocity at the end of each timestep. First of all, implement a constructor: @@ -487,11 +487,11 @@ of each timestep. First of all, implement a constructor: FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 4) + if (narg < 4) error->all(FLERR,"Illegal fix print command"); - + nevery = atoi(arg[3]); - if (nevery <= 0) + if (nevery <= 0) error->all(FLERR,"Illegal fix print command"); } \end{verbatim} @@ -545,7 +545,7 @@ void FixPrintVel::end_of_step() { // for add3, scale3 using namespace MathExtra; - + double** v = atom->v; int nlocal = atom->nlocal; double localAvgVel[4]; // 4th element for particles count @@ -559,7 +559,7 @@ void FixPrintVel::end_of_step() MPI_Allreduce(localAvgVel, globalAvgVel, 4, MPI_DOUBLE, MPI_SUM, world); scale3(1.0 / globalAvgVel[3], globalAvgVel); if (comm->me == 0) { - printf("\%e, \%e, \%e\n", + printf("\%e, \%e, \%e\n", globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]); } } @@ -607,14 +607,15 @@ this situation there are several methods which should be implemented: \begin{itemize} \item \verb|double memory_usage| - return how much memory fix uses -\item \verb|void grow_arrays(int)| - do reallocation of the per particle arrays +\item \verb|void grow_arrays(int)| - do reallocation of the per particle arrays in your fix -\item \verb|void copy_arrays(int i, int j)| - copy i-th per-particle information - to j-th. Used when atoms sorting is performed +\item \verb|void copy_arrays(int i, int j, int delflag)| - copy i-th per-particle + information to j-th. Used when atoms sorting is performed. if delflag is set + and atom j owns a body, move the body information to atom i. \item \verb|void set_arrays(int i)| - sets i-th particle related information to zero \end{itemize} -Note, that if your class implements these methods, it must call add calls of +Note, that if your class implements these methods, it must call add calls of add\_callback and delete\_callback to constructor and destructor: \begin{center} @@ -654,7 +655,7 @@ void FixSavePos::grow_arrays(int nmax) memory->grow(this->x, nmax, 3, "FixSavePos:x"); } -void FixSavePos::copy_arrays(int i, int j) +void FixSavePos::copy_arrays(int i, int j, int delflag) { memcpy(this->x[j], this->x[i], sizeof(double) * 3); } @@ -670,7 +671,7 @@ int FixSavePos::pack_exchange(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - + return m; } diff --git a/doc/src/compute_heat_flux.txt b/doc/src/compute_heat_flux.txt index e8adac3deb5e71a5cd3ed3c15088868b3b8768f5..39a1470201fc3f6705ee222e9719261aeae5dd4f 100644 --- a/doc/src/compute_heat_flux.txt +++ b/doc/src/compute_heat_flux.txt @@ -26,14 +26,16 @@ compute myFlux all heat/flux myKE myPE myStress :pre Define a computation that calculates the heat flux vector based on contributions from atoms in the specified group. This can be used by -itself to measure the heat flux into or out of a reservoir of atoms, -or to calculate a thermal conductivity using the Green-Kubo formalism. - -See the "fix thermal/conductivity"_fix_thermal_conductivity.html -command for details on how to compute thermal conductivity in an -alternate way, via the Muller-Plathe method. See the "fix -heat"_fix_heat.html command for a way to control the heat added or -subtracted to a group of atoms. +itself to measure the heat flux through a set of atoms (e.g. a region +between two thermostatted reservoirs held at different temperatures), +or to calculate a thermal conductivity using the equilibrium +Green-Kubo formalism. + +For other non-equilibrium ways to compute a thermal conductivity, see +"this section"_Section_howto.html#howto_20. These include use of the +"fix thermal/conductivity"_fix_thermal_conductivity.html command for +the Muller-Plathe method. Or the "fix heat"_fix_heat.html command +which can add or subtract heat from groups of atoms. The compute takes three arguments which are IDs of other "computes"_compute.html. One calculates per-atom kinetic energy