etomica.nbr.cell
Class NeighborCellManager

java.lang.Object
  extended by etomica.nbr.cell.NeighborCellManager
All Implemented Interfaces:
IBoundaryListener, AtomLeafAgentManager.AgentSource, BoxCellManager, Serializable
Direct Known Subclasses:
NeighborCellManagerList

public class NeighborCellManager
extends Object
implements BoxCellManager, IBoundaryListener, AtomLeafAgentManager.AgentSource, Serializable

Class that defines and manages construction and use of lattice of cells for cell-based neighbor listing.

See Also:
Serialized Form

Field Summary
protected  AtomLeafAgentManager agentManager
           
protected  IBox box
           
protected  int cellRange
           
protected  boolean doApplyPBC
           
protected  CellLattice lattice
           
protected  int[] numCells
           
protected  IAtomPositionDefinition positionDefinition
           
protected  double range
           
protected  ISimulation sim
           
protected  IVectorMutable v
           
 
Constructor Summary
NeighborCellManager(ISimulation sim, IBox box, double potentialRange, IAtomPositionDefinition positionDefinition, ISpace space)
          Construct manager for neighbor cells in the given box.
NeighborCellManager(ISimulation sim, IBox box, double potentialRange, ISpace _space)
          Constructs manager for neighbor cells in the given box.
 
Method Summary
 void assignCell(IAtom atom)
          Assigns the cell for the given atom.
 void assignCellAll()
          Assigns cells to all interacting atoms in the box.
 void boundaryInflate(IBoundaryEvent e)
           
protected  boolean checkDimensions()
          Checks the box's dimensions to make sure the number of cells is appropriate.
 Class getAgentClass()
          Returns the Class of the agent.
 Cell getCell(IAtom atom)
           
 int getCellRange()
          Returns the cellRange.
 boolean getDoApplyPBC()
           
 CellLattice getLattice()
          Returns the lattice that defines the cell arrangement.
 double getPotentialRange()
          Returns the potential range.
 Object makeAgent(IAtom atom)
          Returns the cell containing the given atom.
 IListener makeMCMoveListener()
           
 void releaseAgent(Object cell, IAtom atom)
          Removes the given atom from the cell.
 void setCellRange(int newCellRange)
          Sets the cell range to the given value.
 void setDoApplyPBC(boolean newDoApplyPBC)
           
 void setPotentialRange(double newRange)
          Sets the potential range to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sim

protected final ISimulation sim

lattice

protected final CellLattice lattice

positionDefinition

protected final IAtomPositionDefinition positionDefinition

box

protected final IBox box

cellRange

protected int cellRange

range

protected double range

agentManager

protected final AtomLeafAgentManager agentManager

doApplyPBC

protected boolean doApplyPBC

v

protected final IVectorMutable v

numCells

protected final int[] numCells
Constructor Detail

NeighborCellManager

public NeighborCellManager(ISimulation sim,
                           IBox box,
                           double potentialRange,
                           ISpace _space)
Constructs manager for neighbor cells in the given box. The number of cells in each dimension is given by nCells. Position definition for each atom is that given by its type (it is set to null in this class).


NeighborCellManager

public NeighborCellManager(ISimulation sim,
                           IBox box,
                           double potentialRange,
                           IAtomPositionDefinition positionDefinition,
                           ISpace space)
Construct manager for neighbor cells in the given box. The number of cells in each dimension is given by nCells. Position definition is used to determine the cell a given atom is in; if null, the position definition given by the atom's type is used. Position definition is declared final.

Method Detail

setDoApplyPBC

public void setDoApplyPBC(boolean newDoApplyPBC)

getDoApplyPBC

public boolean getDoApplyPBC()

getLattice

public CellLattice getLattice()
Description copied from interface: BoxCellManager
Returns the lattice that defines the cell arrangement.

Specified by:
getLattice in interface BoxCellManager

setPotentialRange

public void setPotentialRange(double newRange)
Sets the potential range to the given value. Cells are made large enough so that cellRange*cellSize > potentialRange.


getPotentialRange

public double getPotentialRange()
Returns the potential range.


getCellRange

public int getCellRange()
Returns the cellRange.


setCellRange

public void setCellRange(int newCellRange)
Sets the cell range to the given value. Cells are made large enough so that cellRange*cellSize > potentialRange


boundaryInflate

public void boundaryInflate(IBoundaryEvent e)
Specified by:
boundaryInflate in interface IBoundaryListener

checkDimensions

protected boolean checkDimensions()
Checks the box's dimensions to make sure the number of cells is appropriate.


assignCellAll

public void assignCellAll()
Assigns cells to all interacting atoms in the box. Interacting atoms are those that have one or more potentials that act on them.

Specified by:
assignCellAll in interface BoxCellManager

getCell

public Cell getCell(IAtom atom)

assignCell

public void assignCell(IAtom atom)
Assigns the cell for the given atom. The atom will be listed in the cell's atom list and the cell with be associated with the atom via agentManager.


makeMCMoveListener

public IListener makeMCMoveListener()

getAgentClass

public Class getAgentClass()
Description copied from interface: AtomLeafAgentManager.AgentSource
Returns the Class of the agent. This is used to create an array of the appropriate Class.

Specified by:
getAgentClass in interface AtomLeafAgentManager.AgentSource

makeAgent

public Object makeAgent(IAtom atom)
Returns the cell containing the given atom. The atom is added to the cell's atom list.

Specified by:
makeAgent in interface AtomLeafAgentManager.AgentSource

releaseAgent

public void releaseAgent(Object cell,
                         IAtom atom)
Removes the given atom from the cell.

Specified by:
releaseAgent in interface AtomLeafAgentManager.AgentSource