Merge branch 'master' into resetids
This commit is contained in:
@ -15,8 +15,9 @@ compute ID group-ID displace/atom :pre
|
||||
ID, group-ID are documented in "compute"_compute.html command :ulb,l
|
||||
displace/atom = style name of this compute command :l
|
||||
zero or more keyword/arg pairs may be appended :l
|
||||
keyword = {refresh} :l
|
||||
{replace} arg = per-atom variable ID :pre
|
||||
keyword = {refresh} :
|
||||
{replace} arg = name of per-atom variable :pre
|
||||
|
||||
:ule
|
||||
|
||||
[Examples:]
|
||||
|
||||
@ -121,7 +121,7 @@ See the "dump_modify every"_dump_modify.html command.
|
||||
|
||||
Only information for atoms in the specified group is dumped. The
|
||||
"dump_modify thresh and region and refresh"_dump_modify.html commands
|
||||
can also alter what atoms are included. Not all styles support all
|
||||
can also alter what atoms are included. Not all styles support
|
||||
these options; see details on the "dump_modify"_dump_modify.html doc
|
||||
page.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
# Solvated 5-mer peptide
|
||||
# Demonstrating temper_npt
|
||||
units real
|
||||
atom_style full
|
||||
|
||||
pair_style lj/charmm/coul/long 8.0 10.0 10.0
|
||||
bond_style harmonic
|
||||
angle_style charmm
|
||||
dihedral_style charmm
|
||||
improper_style harmonic
|
||||
kspace_style pppm 0.0001
|
||||
|
||||
read_data data.peptide
|
||||
|
||||
neighbor 2.0 bin
|
||||
neigh_modify delay 5
|
||||
|
||||
timestep 2.0
|
||||
|
||||
thermo_style custom step temp epair emol etotal press density
|
||||
thermo 50
|
||||
|
||||
variable temper_T world 275 280 285 290 295 300 305 310
|
||||
variable rep world 0 1 2 3 4 5 6 7
|
||||
fix myfix all npt temp ${temper_T} ${temper_T} 100.0 iso 1 1 1000
|
||||
run 500
|
||||
temper_npt 2000 100 ${temper_T} myfix 0 58728 1
|
||||
fix 2 all shake 0.0001 10 100 b 4 6 8 10 12 14 18 a 31
|
||||
group peptide type <= 12
|
||||
|
||||
|
||||
|
||||
@ -264,12 +264,21 @@ void FixSRP::setup_pre_force(int zz)
|
||||
rmax = sqrt(rsqmax);
|
||||
double cutneighmax_srp = neighbor->cutneighmax + 0.51*rmax;
|
||||
|
||||
// find smallest cutghost
|
||||
double cutghostmin = comm->cutghost[0];
|
||||
if (cutghostmin > comm->cutghost[1])
|
||||
cutghostmin = comm->cutghost[1];
|
||||
if (cutghostmin > comm->cutghost[2])
|
||||
cutghostmin = comm->cutghost[2];
|
||||
double length0,length1,length2;
|
||||
if (domain->triclinic) {
|
||||
double *h_inv = domain->h_inv;
|
||||
length0 = sqrt(h_inv[0]*h_inv[0] + h_inv[5]*h_inv[5] + h_inv[4]*h_inv[4]);
|
||||
length1 = sqrt(h_inv[1]*h_inv[1] + h_inv[3]*h_inv[3]);
|
||||
length2 = h_inv[2];
|
||||
} else length0 = length1 = length2 = 1.0;
|
||||
|
||||
// find smallest cutghost.
|
||||
// comm->cutghost is stored in fractional coordinates for triclinic
|
||||
double cutghostmin = comm->cutghost[0]/length0;
|
||||
if (cutghostmin > comm->cutghost[1]/length1)
|
||||
cutghostmin = comm->cutghost[1]/length1;
|
||||
if (cutghostmin > comm->cutghost[2]/length2)
|
||||
cutghostmin = comm->cutghost[2]/length2;
|
||||
|
||||
// stop if cutghost is insufficient
|
||||
if (cutneighmax_srp > cutghostmin){
|
||||
|
||||
@ -129,6 +129,8 @@ class Compute : protected Pointers {
|
||||
virtual void lock(class Fix *, bigint, bigint) {}
|
||||
virtual void unlock(class Fix *) {}
|
||||
|
||||
virtual void refresh() {}
|
||||
|
||||
void addstep(bigint);
|
||||
int matchstep(bigint);
|
||||
void clearstep();
|
||||
|
||||
@ -21,6 +21,8 @@
|
||||
#include "modify.h"
|
||||
#include "fix.h"
|
||||
#include "fix_store.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
@ -32,12 +34,42 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg),
|
||||
displace(NULL), id_fix(NULL)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute displace/atom command");
|
||||
if (narg < 3) error->all(FLERR,"Illegal compute displace/atom command");
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 4;
|
||||
create_attribute = 1;
|
||||
|
||||
// optional args
|
||||
|
||||
refreshflag = 0;
|
||||
rvar = NULL;
|
||||
|
||||
int iarg = 3;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"refresh") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute displace/atom command");
|
||||
refreshflag = 1;
|
||||
delete [] rvar;
|
||||
int n = strlen(arg[iarg+1]) + 1;
|
||||
rvar = new char[n];
|
||||
strcpy(rvar,arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute displace/atom command");
|
||||
}
|
||||
|
||||
// error check
|
||||
|
||||
if (refreshflag) {
|
||||
ivar = input->variable->find(rvar);
|
||||
if (ivar < 0)
|
||||
error->all(FLERR,"Variable name for compute displace/atom does not exist");
|
||||
if (input->variable->atomstyle(ivar) == 0)
|
||||
error->all(FLERR,"Compute displace/atom variable "
|
||||
"is not atom-style variable");
|
||||
}
|
||||
|
||||
// create a new fix STORE style
|
||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||
|
||||
@ -76,7 +108,8 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// per-atom displacement array
|
||||
|
||||
nmax = 0;
|
||||
nmax = nvmax = 0;
|
||||
varatom = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -89,6 +122,8 @@ ComputeDisplaceAtom::~ComputeDisplaceAtom()
|
||||
|
||||
delete [] id_fix;
|
||||
memory->destroy(displace);
|
||||
delete [] rvar;
|
||||
memory->destroy(varatom);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -100,6 +135,12 @@ void ComputeDisplaceAtom::init()
|
||||
int ifix = modify->find_fix(id_fix);
|
||||
if (ifix < 0) error->all(FLERR,"Could not find compute displace/atom fix ID");
|
||||
fix = (FixStore *) modify->fix[ifix];
|
||||
|
||||
if (refreshflag) {
|
||||
ivar = input->variable->find(rvar);
|
||||
if (ivar < 0)
|
||||
error->all(FLERR,"Variable name for compute displace/atom does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -183,6 +224,30 @@ void ComputeDisplaceAtom::set_arrays(int i)
|
||||
xoriginal[i][2] = x[i][2];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
reset per-atom storage values, based on atom-style variable evaluation
|
||||
called by dump when dump_modify refresh is set
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ComputeDisplaceAtom::refresh()
|
||||
{
|
||||
if (atom->nmax > nvmax) {
|
||||
nvmax = atom->nmax;
|
||||
memory->destroy(varatom);
|
||||
memory->create(varatom,nvmax,"displace/atom:varatom");
|
||||
}
|
||||
|
||||
input->variable->compute_atom(ivar,igroup,varatom,1,0);
|
||||
|
||||
double **xoriginal = fix->astore;
|
||||
double **x = atom->x;
|
||||
imageint *image = atom->image;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (varatom[i]) domain->unmap(x[i],image[i],xoriginal[i]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based array
|
||||
------------------------------------------------------------------------- */
|
||||
@ -190,5 +255,6 @@ void ComputeDisplaceAtom::set_arrays(int i)
|
||||
double ComputeDisplaceAtom::memory_usage()
|
||||
{
|
||||
double bytes = nmax*4 * sizeof(double);
|
||||
bytes += nvmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ class ComputeDisplaceAtom : public Compute {
|
||||
void init();
|
||||
void compute_peratom();
|
||||
void set_arrays(int);
|
||||
void refresh();
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
@ -38,6 +39,10 @@ class ComputeDisplaceAtom : public Compute {
|
||||
double **displace;
|
||||
char *id_fix;
|
||||
class FixStore *fix;
|
||||
|
||||
int refreshflag,ivar,nvmax; // refresh option is enabled
|
||||
char *rvar; // for incremental dumps
|
||||
double *varatom;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
25
src/dump.cpp
25
src/dump.cpp
@ -22,11 +22,12 @@
|
||||
#include "domain.h"
|
||||
#include "group.h"
|
||||
#include "output.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "modify.h"
|
||||
#include "fix.h"
|
||||
#include "compute.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -78,6 +79,9 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
format_bigint_user = NULL;
|
||||
format_column_user = NULL;
|
||||
|
||||
refreshflag = 0;
|
||||
refresh = NULL;
|
||||
|
||||
clearstep = 0;
|
||||
sort_flag = 0;
|
||||
append_flag = 0;
|
||||
@ -161,6 +165,8 @@ Dump::~Dump()
|
||||
delete [] format_int_user;
|
||||
delete [] format_bigint_user;
|
||||
|
||||
delete [] refresh;
|
||||
|
||||
// format_column_user is deallocated by child classes that use it
|
||||
|
||||
memory->destroy(buf);
|
||||
@ -278,6 +284,16 @@ void Dump::init()
|
||||
}
|
||||
}
|
||||
|
||||
// search for refresh compute specified by dump_modify refresh
|
||||
|
||||
if (refreshflag) {
|
||||
int icompute;
|
||||
for (icompute = 0; icompute < modify->ncompute; icompute++)
|
||||
if (strcmp(refresh,modify->compute[icompute]->id) == 0) break;
|
||||
if (icompute < modify->ncompute) irefresh = icompute;
|
||||
else error->all(FLERR,"Dump could not find refresh compute ID");
|
||||
}
|
||||
|
||||
// preallocation for PBC copies if requested
|
||||
|
||||
if (pbcflag && atom->nlocal > maxpbc) pbc_allocate();
|
||||
@ -483,6 +499,11 @@ void Dump::write()
|
||||
atom->image = imagehold;
|
||||
}
|
||||
|
||||
// trigger post-dump refresh by specified compute
|
||||
// currently used for incremental dump files
|
||||
|
||||
if (refreshflag) modify->compute[irefresh]->refresh();
|
||||
|
||||
// if file per timestep, close file if I am filewriter
|
||||
|
||||
if (multifile) {
|
||||
|
||||
@ -80,6 +80,10 @@ class Dump : protected Pointers {
|
||||
int delay_flag; // 1 if delay output until delaystep
|
||||
bigint delaystep;
|
||||
|
||||
int refreshflag; // 1 if dump_modify refresh specified
|
||||
char *refresh; // compute ID to invoke refresh() on
|
||||
int irefresh; // index of compute
|
||||
|
||||
char boundstr[9]; // encoding of boundary flags
|
||||
|
||||
char *format; // format string for the file write
|
||||
|
||||
@ -60,7 +60,8 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
||||
earg(NULL), vtype(NULL), vformat(NULL), columns(NULL), choose(NULL),
|
||||
dchoose(NULL), clist(NULL), field2index(NULL), argindex(NULL), id_compute(NULL),
|
||||
compute(NULL), id_fix(NULL), fix(NULL), id_variable(NULL), variable(NULL),
|
||||
vbuf(NULL), id_custom(NULL), flag_custom(NULL), typenames(NULL), pack_choice(NULL)
|
||||
vbuf(NULL), id_custom(NULL), flag_custom(NULL), typenames(NULL),
|
||||
pack_choice(NULL)
|
||||
{
|
||||
if (narg == 5) error->all(FLERR,"No dump custom arguments specified");
|
||||
|
||||
@ -1673,6 +1674,19 @@ int DumpCustom::modify_param(int narg, char **arg)
|
||||
return ntypes+1;
|
||||
}
|
||||
|
||||
if (strcmp(arg[0],"refresh") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strncmp(arg[1],"c_",2) != 0)
|
||||
error->all(FLERR,"Illegal dump_modify command");
|
||||
if (refreshflag) error->all(FLERR,"Dump modify can only have one refresh");
|
||||
|
||||
refreshflag = 1;
|
||||
int n = strlen(arg[1]);
|
||||
refresh = new char[n];
|
||||
strcpy(refresh,&arg[1][2]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (strcmp(arg[0],"thresh") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[1],"none") == 0) {
|
||||
|
||||
@ -537,10 +537,8 @@ double MathSpecial::exp2_x86(double x)
|
||||
|
||||
double MathSpecial::fm_exp(double x)
|
||||
{
|
||||
#if defined(__BYTE_ORDER__)
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
return exp2_x86(FM_DOUBLE_LOG2OFE * x);
|
||||
#endif
|
||||
#else
|
||||
return ::exp(x);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user