etomica.nbr.cell
Class Api1ACell

java.lang.Object
  extended by etomica.nbr.cell.Api1ACell
All Implemented Interfaces:
AtomLeafsetIterator, AtomsetIterator, AtomsetIteratorBoxDependent, AtomsetIteratorDirectable, AtomsetIteratorPDT, AtomsetIteratorTargetable, AtomsetIteratorCellular, Serializable

public class Api1ACell
extends Object
implements AtomsetIteratorPDT, AtomsetIteratorCellular, Serializable

Generates pairs that are cell-based neighbors of a specific Atom. Iteration is performed using cell lists, which defines the neighboring molecules. Direction is related to ordering of cells and, within a cell, ordering of molecules in cell's occupant list.

See Also:
Serialized Form

Field Summary
protected  boolean[] periodicity
           
 
Constructor Summary
Api1ACell(int D, double range, BoxAgentManager agentManager)
          Constructor makes iterator that must have box specified and then be reset() before iteration.
 
Method Summary
 CellLattice.NeighborIterator getNbrCellIterator()
           
 int nBody()
          Returns 2, indicating that this is a pair iterator.
 IAtomList next()
          Returns the next AtomSet iterate, or null if hasNext() is false.
 void reset()
          Resets the iterator to loop through its iterates again.
 void setBox(IBox box)
          Sets the Box to pull iterates from
 void setDirection(IteratorDirective.Direction direction)
          Indicates allowed direction for iteration, relative to specified target atom.
 void setTarget(IAtom newTargetAtom)
          Sets the target molecule with which all pairs are formed.
 int size()
          Returns the number of atom pairs the iterator will return if reset and iterated in its present state.
 void unset()
          Puts iterator in a state in which hasNext() returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

periodicity

protected final boolean[] periodicity
Constructor Detail

Api1ACell

public Api1ACell(int D,
                 double range,
                 BoxAgentManager agentManager)
Constructor makes iterator that must have box specified and then be reset() before iteration.

Parameters:
D - the dimension of the space of the simulation (used to construct cell iterators)
range - the distance within which pairs of atoms are considered neighbors. Used to define neighbor cells; some iterates may exceed this separation
Method Detail

setBox

public void setBox(IBox box)
Description copied from interface: AtomsetIteratorBoxDependent
Sets the Box to pull iterates from

Specified by:
setBox in interface AtomsetIteratorBoxDependent

size

public int size()
Returns the number of atom pairs the iterator will return if reset and iterated in its present state.

Specified by:
size in interface AtomsetIterator

next

public IAtomList next()
Description copied from interface: AtomLeafsetIterator
Returns the next AtomSet iterate, or null if hasNext() is false.

Specified by:
next in interface AtomLeafsetIterator

unset

public void unset()
Description copied from interface: AtomsetIterator
Puts iterator in a state in which hasNext() returns false.

Specified by:
unset in interface AtomsetIterator

nBody

public int nBody()
Returns 2, indicating that this is a pair iterator.

Specified by:
nBody in interface AtomsetIterator
Returns:

reset

public void reset()
Description copied from interface: AtomsetIterator
Resets the iterator to loop through its iterates again.

Specified by:
reset in interface AtomsetIterator

setDirection

public void setDirection(IteratorDirective.Direction direction)
Indicates allowed direction for iteration, relative to specified target atom. Specification of a null direction indicates iteration in both directions relative to the target. Direction is determined by ordering within occupant list of cell of target atom, and then by the cell ordering of neighboring cells.

Specified by:
setDirection in interface AtomsetIteratorDirectable

setTarget

public void setTarget(IAtom newTargetAtom)
Sets the target molecule with which all pairs are formed. Molecule is determined from the first atom of the array, which may be the molecule itself or an atom that is part of it. If the atom is null or is not in one of the species given at construction, no iterates will be returned.

Specified by:
setTarget in interface AtomsetIteratorTargetable

getNbrCellIterator

public CellLattice.NeighborIterator getNbrCellIterator()
Specified by:
getNbrCellIterator in interface AtomsetIteratorCellular
Returns:
Returns the cellIterator.