SPPARKS WWW Site - SPPARKS Documentation - SPPARKS Commands

set command


set label style args keyword values ... 


set i1 value 2 fraction 0.5
set d1 range 1.0 2.0 loop local
set xyz displace 0.2
set i1 range 1 50 if x < 20 if i2 = 3 


Reset a per-site value for one or more sites. Each on-lattice or off-lattice application defines what per-site values are stored with each site in its model. When sites are created by the create_sites or read_sites commands, their per-site values may be set to zero or to values specified by those commands. This command enables the values to be changed, either before the first run, or between runs.

The label determines which per-site quantity is set. iN and dN mean the Nth integer or floating-point quantity, with 1 <= N <= Nmax. Nmax is defined by the application. If label is specified as site it is the same as i1. For off-lattice applications, the x or y or z or xyz coordinates of each site can be adjusted.

For label iN or dN or site, the styles value or range can be used.

For style value, the per-site quantity is set to the specified nvalue, which should be either an integer or floating-point numeric value, depending on what kind of per-site quantity is being set.

For style range, the per-site quantity is set to a random value between lo and hi (inclusive). Both lo and hi should be either integer or floating-point numeric values, depending on what kind of per-site quantity is being set.

For style unique, the per-site quantity is set to the site ID, which is effectively a value unique to each site. This can be useful, for example, for setting the initial spin of each site to a unique value.

NOTE: The displace style is not yet implemented but will be soon. The following text explains how it will work for off-lattice applications.

For label x or y or z or xyz, the style displace must be used. For x or y or z, the corresponding coordinate of each site is displaced by a random distance between -delta and delta. For xyz the site is displaced to a new random point within a sphere of radius delta surrounding the site (or a circle for 2d models, or a line segement for 1d models).

The optional keywords enables selection of sites whose label quantity will be reset to a new value. Note that these optional keywords can be used in various combinations, and the if keyword can be used multiple times, to select desired sites.

The keyword fraction means that only a fraction of the sites will be reset, where 0 < frac <= 1.0. For each site a random number R is generated and the reset only occurs if R < frac.

The keyword region means that only sites in the specified region will be reset. Note that a defined region can be a union or intersection of several regions and can be either inside or outside a geometric boundary; see the region command for details.

The keyword loop determines how sites in the simulation box are looped over when their per-site quantity is reset. In general, each processor will own some subset Nlocal of the total number of sites Nglobal in the simulation box. The entire set of sites are assumed to have IDs from 1 to Nglobal. For loop all, each processor performs a loop from 1 to Nglobal and generates the new value for that site. If it owns the site, then it resets its value. This means that the changes to per-site values will be the same, independent of which processor owns which site. For loop local, each processor loops over only its sites from 1 to Nlocal. This may be faster, but if random numbers are used to determine new per-site values, it will give different answers depending on the the number of processors used.

The keyword if sets a condition that must be met in order for the per-site quantity to be reset. The per-site quantity specified by label2 is compared to the numeric nvalue2 and if the condition is not met, then the site is skipped.

Restrictions: none

Related commands:

create_sites, read_sites


The default values for the optional keywords is fraction 1.0 and loop all. No region is defined by default nor are any if-tests.