public class ConfigurationLattice extends java.lang.Object implements Configuration, java.io.Serializable
Iteration over the indexes yields integer arrays, and with each iteration the array is passed to the site method of the lattice which returns the position for placement of the next molecule. Each array index is iterated to a maximum value determined by the number of molecules to be placed, the dimensions of the box in which they are placed, and the lattice constants of the lattice. If there are not enough molecules to fill the lattice, they will be distributed as evenly as possible.
An instance of this class may be configured to place atoms such that they uniformly fill the volume of the box. It will attempt this by scaling the lattice constants of the configuration in an appropriate way. Success in getting a good spatial distribution may vary.
An instance can also be configured to remember the indices used to get lattice position for each molecule that is placed. This can be useful if it is desired to associate each molecule with a lattice site.
Modifier and Type | Class and Description |
---|---|
static class |
ConfigurationLattice.MyLattice
Used to store the state of a lattice.
|
Modifier and Type | Field and Description |
---|---|
protected MoleculeActionTranslateTo |
atomActionTranslateTo |
protected double |
boundaryPadding |
protected IndexIteratorSizable |
indexIterator |
protected SpaceLattice |
lattice |
protected ConfigurationLattice.MyLattice |
myLat |
protected IAtomPositionDefinition |
positionDefinition |
protected boolean |
rescalingToFitVolume |
protected ISpace |
space |
Constructor and Description |
---|
ConfigurationLattice(SpaceLattice lattice,
IndexIteratorSizable indexIterator,
ISpace space)
Construct class that will place atoms on sites of the given lattice,
proceeding in the order resulting from iteration through the given index
iterator.
|
ConfigurationLattice(SpaceLattice lattice,
ISpace space)
Constructs class using instance of IndexIteratorRectangular as the default
index iterator.
|
Modifier and Type | Method and Description |
---|---|
protected int[] |
calculateLatticeDimensions(int nCells,
IVector shape) |
double |
getBoundaryPadding() |
SpaceLattice |
getLatticeMemento()
Returns a lattice with positions the same as those used in the
most recent use of initializeCoordinates.
|
void |
initializeCoordinates(IBox box)
Places the molecules in the given box on the positions of the
lattice.
|
void |
initializeCoordinates(IBox box,
ISpecies species) |
boolean |
isRescalingToFitVolume()
Returns the resizeLatticeToFitVolume flag.
|
void |
setBoundaryPadding(double newBoundaryPadding) |
void |
setRescalingToFitVolume(boolean resizeLatticeToFitVolume)
Sets the resizeLatticeToFitVolume flag, which if true indicates that the
primitive vectors should be resized to fit the dimensions of the box.
|
protected final SpaceLattice lattice
protected final IndexIteratorSizable indexIterator
protected boolean rescalingToFitVolume
protected final MoleculeActionTranslateTo atomActionTranslateTo
protected ConfigurationLattice.MyLattice myLat
protected double boundaryPadding
protected final ISpace space
protected IAtomPositionDefinition positionDefinition
public ConfigurationLattice(SpaceLattice lattice, ISpace space)
public ConfigurationLattice(SpaceLattice lattice, IndexIteratorSizable indexIterator, ISpace space)
public void setBoundaryPadding(double newBoundaryPadding)
public double getBoundaryPadding()
public void initializeCoordinates(IBox box)
initializeCoordinates
in interface Configuration
protected int[] calculateLatticeDimensions(int nCells, IVector shape)
public SpaceLattice getLatticeMemento()
public boolean isRescalingToFitVolume()
public void setRescalingToFitVolume(boolean resizeLatticeToFitVolume)
resizeLatticeToFitVolume
- The resizeLatticeToFitVolume to set