diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index 45ae785f89..29b4381441 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -57,6 +57,8 @@ Syntax fix-ID = ID of :doc:`fix rigid/small ` command *shake* value = fix-ID fix-ID = ID of :doc:`fix shake ` command + *orient* values = rx ry rz + rx,ry,rz = vector to randomly rotate an inserted molecule around *units* value = *lattice* or *box* lattice = the geometry is defined in lattice units box = the geometry is defined in simulation box units @@ -236,6 +238,13 @@ sputtering process. E.g. the target point can be far away, so that all incident particles strike the surface as if they are in an incident beam of particles at a prescribed angle. +The *orient* keyword is only used when molecules are deposited. By +default, each molecule is inserted at a random orientation. If this +keyword is specified, then (rx,ry,rz) is used as an orientation +vector, and each inserted molecule is rotated around that vector with +a random value from zero to 2*PI. For a 2d simulation, rx = ry = 0.0 +is required, since rotations can only be performed around the z axis. + The *id* keyword determines how atom IDs and molecule IDs are assigned to newly deposited particles. Molecule IDs are only assigned if molecules are being inserted. For the *max* setting, the atom and diff --git a/doc/txt/fix_deposit.txt b/doc/txt/fix_deposit.txt deleted file mode 100644 index 45ef7d655e..0000000000 --- a/doc/txt/fix_deposit.txt +++ /dev/null @@ -1,299 +0,0 @@ -"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c - -:link(lws,http://lammps.sandia.gov) -:link(ld,Manual.html) -:link(lc,Commands_all.html) - -:line - -fix deposit command :h3 - -[Syntax:] - -fix ID group-ID deposit N type M seed keyword values ... :pre - -ID, group-ID are documented in "fix"_fix.html command :ulb,l -deposit = style name of this fix command :l -N = # of atoms or molecules to insert :l -type = atom type to assign to inserted atoms (offset for molecule insertion) :l -M = insert a single atom or molecule every M steps :l -seed = random # seed (positive integer) :l -one or more keyword/value pairs may be appended to args :l -keyword = {region} or {id} or {global} or {local} or {near} or {gaussian} or {attempt} or {rate} or {vx} or {vy} or {vz} or {mol} or {rigid} or {shake} or {units} or {orientation} :l - {region} value = region-ID - region-ID = ID of region to use as insertion volume - {id} value = {max} or {next} - max = atom ID for new atom(s) is max ID of all current atoms plus one - next = atom ID for new atom(s) increments by one for every deposition - {global} values = lo hi - lo,hi = put new atom/molecule a distance lo-hi above all other atoms (distance units) - {local} values = lo hi delta - lo,hi = put new atom/molecule a distance lo-hi above any nearby atom beneath it (distance units) - delta = lateral distance within which a neighbor is considered "nearby" (distance units) - {near} value = R - R = only insert atom/molecule if further than R from existing particles (distance units) - {gaussian} values = xmid ymid zmid sigma - xmid,ymid,zmid = center of the gaussian distribution (distance units) - sigma = width of gaussian distribution (distance units) - {attempt} value = Q - Q = attempt a single insertion up to Q times - {rate} value = V - V = z velocity (y in 2d) at which insertion volume moves (velocity units) - {vx} values = vxlo vxhi - vxlo,vxhi = range of x velocities for inserted atom/molecule (velocity units) - {vy} values = vylo vyhi - vylo,vyhi = range of y velocities for inserted atom/molecule (velocity units) - {vz} values = vzlo vzhi - vzlo,vzhi = range of z velocities for inserted atom/molecule (velocity units) - {target} values = tx ty tz - tx,ty,tz = location of target point (distance units) - {mol} value = template-ID - template-ID = ID of molecule template specified in a separate "molecule"_molecule.html command - {molfrac} values = f1 f2 ... fN - f1 to fN = relative probability of creating each of N molecules in template-ID - {rigid} value = fix-ID - fix-ID = ID of "fix rigid/small"_fix_rigid.html command - {shake} value = fix-ID - fix-ID = ID of "fix shake"_fix_shake.html command - {units} value = {lattice} or {box} - lattice = the geometry is defined in lattice units - box = the geometry is defined in simulation box units - {orientation} value = rx ry rz - rx,ry,rz = axis of orientation vector :pre -:ule - -[Examples:] - -fix 3 all deposit 1000 2 100 29494 region myblock local 1.0 1.0 1.0 units box -fix 2 newatoms deposit 10000 1 500 12345 region disk near 2.0 vz -1.0 -0.8 -fix 4 sputter deposit 1000 2 500 12235 region sphere vz -1.0 -1.0 target 5.0 5.0 0.0 units lattice -fix 5 insert deposit 200 2 100 777 region disk gaussian 5.0 5.0 9.0 1.0 units box :pre - -[Description:] - -Insert a single atom or molecule into the simulation domain every M -timesteps until N atoms or molecules have been inserted. This is -useful for simulating deposition onto a surface. For the remainder of -this doc page, a single inserted atom or molecule is referred to as a -"particle". - -If inserted particles are individual atoms, they are assigned the -specified atom type. If they are molecules, the type of each atom in -the inserted molecule is specified in the file read by the -"molecule"_molecule.html command, and those values are added to the -specified atom type. E.g. if the file specifies atom types 1,2,3, and -those are the atom types you want for inserted molecules, then specify -{type} = 0. If you specify {type} = 2, the in the inserted molecule -will have atom types 3,4,5. - -All atoms in the inserted particle are assigned to two groups: the -default group "all" and the group specified in the fix deposit command -(which can also be "all"). - -If you are computing temperature values which include inserted -particles, you will want to use the -"compute_modify"_compute_modify.html dynamic option, which insures the -current number of atoms is used as a normalizing factor each time the -temperature is computed. - -Care must be taken that inserted particles are not too near existing -atoms, using the options described below. When inserting particles -above a surface in a non-periodic box (see the -"boundary"_boundary.html command), the possibility of a particle -escaping the surface and flying upward should be considered, since the -particle may be lost or the box size may grow infinitely large. A -"fix wall/reflect"_fix_wall_reflect.html command can be used to -prevent this behavior. Note that if a shrink-wrap boundary is used, -it is OK to insert the new particle outside the box, however the box -will immediately be expanded to include the new particle. When -simulating a sputtering experiment it is probably more realistic to -ignore those atoms using the "thermo_modify"_thermo_modify.html -command with the {lost ignore} option and a fixed -"boundary"_boundary.html. - -The fix deposit command must use the {region} keyword to define an -insertion volume. The specified region must have been previously -defined with a "region"_region.html command. It must be defined with -side = {in}. - -NOTE: LAMMPS checks that the specified region is wholly inside the -simulation box. It can do this correctly for orthonormal simulation -boxes. However for "triclinic boxes"_Howto_triclinic.html, it only -tests against the larger orthonormal box that bounds the tilted -simulation box. If the specified region includes volume outside the -tilted box, then an insertion will likely fail, leading to a "lost -atoms" error. Thus for triclinic boxes you should insure the -specified region is wholly inside the simulation box. - -The locations of inserted particles are taken from uniform distributed -random numbers, unless the {gaussian} keyword is used. Then the -individual coordinates are taken from a gaussian distribution of -width {sigma} centered on {xmid,ymid,zmid}. - -Individual atoms are inserted, unless the {mol} keyword is used. It -specifies a {template-ID} previously defined using the -"molecule"_molecule.html command, which reads files that define one or -more molecules. The coordinates, atom types, charges, etc, as well as -any bond/angle/etc and special neighbor information for the molecule -can be specified in the molecule file. See the -"molecule"_molecule.html command for details. The only settings -required to be in each file are the coordinates and types of atoms in -the molecule. - -If the molecule template contains more than one molecule, the relative -probability of depositing each molecule can be specified by the -{molfrac} keyword. N relative probabilities, each from 0.0 to 1.0, are -specified, where N is the number of molecules in the template. Each -time a molecule is deposited, a random number is used to sample from -the list of relative probabilities. The N values must sum to 1.0. - -If you wish to insert molecules via the {mol} keyword, that will be -treated as rigid bodies, use the {rigid} keyword, specifying as its -value the ID of a separate "fix rigid/small"_fix_rigid.html -command which also appears in your input script. - -NOTE: If you wish the new rigid molecules (and other rigid molecules) -to be thermostatted correctly via "fix rigid/small/nvt"_fix_rigid.html -or "fix rigid/small/npt"_fix_rigid.html, then you need to use the -"fix_modify dynamic/dof yes" command for the rigid fix. This is to -inform that fix that the molecule count will vary dynamically. - -If you wish to insert molecules via the {mol} keyword, that will have -their bonds or angles constrained via SHAKE, use the {shake} keyword, -specifying as its value the ID of a separate "fix -shake"_fix_shake.html command which also appears in your input script. - -Each timestep a particle is inserted, the coordinates for its atoms -are chosen as follows. For insertion of individual atoms, the -"position" referred to in the following description is the coordinate -of the atom. For insertion of molecule, the "position" is the -geometric center of the molecule; see the "molecule"_molecule.html doc -page for details. A random rotation of the molecule around its center -point is performed, which determines the coordinates all the -individual atoms. - -A random position within the region insertion volume is generated. If -neither the {global} or {local} keyword is used, the random position -is the trial position. If the {global} keyword is used, the random -x,y values are used, but the z position of the new particle is set -above the highest current atom in the simulation by a distance -randomly chosen between lo/hi. (For a 2d simulation, this is done for -the y position.) If the {local} keyword is used, the z position is -set a distance between lo/hi above the highest current atom in the -simulation that is "nearby" the chosen x,y position. In this context, -"nearby" means the lateral distance (in x,y) between the new and old -particles is less than the {delta} setting. - -Once a trial x,y,z position has been selected, the insertion is only -performed if no current atom in the simulation is within a distance R -of any atom in the new particle, including the effect of periodic -boundary conditions if applicable. R is defined by the {near} -keyword. Note that the default value for R is 0.0, which will allow -atoms to strongly overlap if you are inserting where other atoms are -present. This distance test is performed independently for each atom -in an inserted molecule, based on the randomly rotated configuration -of the molecule. If this test fails, a new random position within the -insertion volume is chosen and another trial is made. Up to Q -attempts are made. If the particle is not successfully inserted, -LAMMPS prints a warning message. - -NOTE: If you are inserting finite size particles or a molecule or -rigid body consisting of finite-size particles, then you should -typically set R larger than the distance at which any inserted -particle may overlap with either a previously inserted particle or an -existing particle. LAMMPS will issue a warning if R is smaller than -this value, based on the radii of existing and inserted particles. - -The {rate} option moves the insertion volume in the z direction (3d) -or y direction (2d). This enables particles to be inserted from a -successively higher height over time. Note that this parameter is -ignored if the {global} or {local} keywords are used, since those -options choose a z-coordinate for insertion independently. - -The vx, vy, and vz components of velocity for the inserted particle -are set using the values specified for the {vx}, {vy}, and {vz} -keywords. Note that normally, new particles should be a assigned a -negative vertical velocity so that they move towards the surface. For -molecules, the same velocity is given to every particle (no rotation -or bond vibration). - -If the {target} option is used, the velocity vector of the inserted -particle is changed so that it points from the insertion position -towards the specified target point. The magnitude of the velocity is -unchanged. This can be useful, for example, for simulating a -sputtering process. E.g. the target point can be far away, so that -all incident particles strike the surface as if they are in an -incident beam of particles at a prescribed angle. - -The {id} keyword determines how atom IDs and molecule IDs are assigned -to newly deposited particles. Molecule IDs are only assigned if -molecules are being inserted. For the {max} setting, the atom and -molecule IDs of all current atoms are checked. Atoms in the new -particle are assigned IDs starting with the current maximum plus one. -If a molecule is inserted it is assigned an ID = current maximum plus -one. This means that if particles leave the system, the new IDs may -replace the lost ones. For the {next} setting, the maximum ID of any -atom and molecule is stored at the time the fix is defined. Each time -a new particle is added, this value is incremented to assign IDs to -the new atom(s) or molecule. Thus atom and molecule IDs for deposited -particles will be consecutive even if particles leave the system over -time. - -The {units} keyword determines the meaning of the distance units used -for the other deposition parameters. A {box} value selects standard -distance units as defined by the "units"_units.html command, -e.g. Angstroms for units = real or metal. A {lattice} value means the -distance units are in lattice spacings. The "lattice"_lattice.html -command must have been previously used to define the lattice spacing. -Note that the units choice affects all the keyword values that have -units of distance or velocity. - -The {orientation} keyword determines the fixed rotation axis r = (rx,ry,rz) for randomly rotated of any inserted molecules. Note that the for a 2d simulation, (rx,ry,rz) should equal to (0,0,1). - -NOTE: If you are monitoring the temperature of a system where the atom -count is changing due to adding particles, you typically should use -the "compute_modify dynamic yes"_compute_modify.html command for the -temperature compute you are using. - -[Restart, fix_modify, output, run start/stop, minimize info:] - -This fix writes the state of the deposition to "binary restart -files"_restart.html. This includes information about how many -particles have been deposited, the random number generator seed, the -next timestep for deposition, etc. See the -"read_restart"_read_restart.html command for info on how to re-specify -a fix in an input script that reads a restart file, so that the -operation of the fix continues in an uninterrupted fashion. - -NOTE: For this to work correctly, the timestep must [not] be changed -after reading the restart with "reset_timestep"_reset_timestep.html. -The fix will try to detect it and stop with an error. - -None of the "fix_modify"_fix_modify.html options are relevant to this -fix. No global or per-atom quantities are stored by this fix for -access by various "output commands"_Howto_output.html. No parameter -of this fix can be used with the {start/stop} keywords of the -"run"_run.html command. This fix is not invoked during "energy -minimization"_minimize.html. - -[Restrictions:] - -This fix is part of the MISC package. It is only enabled if LAMMPS -was built with that package. See the "Build -package"_Build_package.html doc page for more info. - -The specified insertion region cannot be a "dynamic" region, as -defined by the "region"_region.html command. - -[Related commands:] - -"fix pour"_fix_pour.html, "region"_region.html - -[Default:] - -Insertions are performed for individual atoms, i.e. no {mol} setting -is defined. If the {mol} keyword is used, the default for {molfrac} -is an equal probabilities for all molecules in the template. -Additional option defaults are id = max, delta = 0.0, near = 0.0, -attempt = 10, rate = 0.0, vx = 0.0 0.0, vy = 0.0 0.0, vz = 0.0 0.0, -and units = lattice. diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index c8736840e4..5279b2df36 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -421,7 +421,7 @@ void FixDeposit::pre_exchange() while (rng > molfrac[imol]) imol++; natom = onemols[imol]->natoms; if (dimension == 3) { - if (orientflag == 1) { + if (orientflag) { r[0] = rx; r[1] = ry; r[2] = rz; @@ -779,12 +779,16 @@ void FixDeposit::options(int narg, char **arg) vzlo = force->numeric(FLERR,arg[iarg+1]); vzhi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; - } else if (strcmp(arg[iarg],"orientation") == 0) { + } else if (strcmp(arg[iarg],"orient") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); orientflag = 1; rx = force->numeric(FLERR,arg[iarg+1]); ry = force->numeric(FLERR,arg[iarg+2]); rz = force->numeric(FLERR,arg[iarg+3]); + if (domain->dimension == 2 && (rx != 0.0 || ry != 0.0)) + error->all(FLERR,"Illegal fix deposit orient settings"); + if (rx == 0.0 && ry == 0.0 && rz == 0.0) + error->all(FLERR,"Illegal fix deposit orient settings"); iarg += 4; } else if (strcmp(arg[iarg],"units") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); diff --git a/src/MISC/fix_deposit.h b/src/MISC/fix_deposit.h index 92598862d2..92ecdd9efd 100644 --- a/src/MISC/fix_deposit.h +++ b/src/MISC/fix_deposit.h @@ -40,9 +40,9 @@ class FixDeposit : public Fix { int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag,targetflag; int mode,rigidflag,shakeflag,idnext,distflag,orientflag; double lo,hi,deltasq,nearsq,rate,sigma; - double vxlo,vxhi,vylo,vyhi,vzlo,vzhi,rx,ry,rz; + double vxlo,vxhi,vylo,vyhi,vzlo,vzhi; double xlo,xhi,ylo,yhi,zlo,zhi,xmid,ymid,zmid; - double tx,ty,tz; + double rx,ry,rz,tx,ty,tz; char *idregion; char *idrigid,*idshake;