etomica.nbr.list
Class NeighborListManager

java.lang.Object
  extended by etomica.nbr.list.NeighborListManager
All Implemented Interfaces:
IIntegratorListener, AtomLeafAgentManager.AgentSource, Serializable

public class NeighborListManager
extends Object
implements IIntegratorListener, AtomLeafAgentManager.AgentSource, Serializable

Initiates the process of updating the neighbor lists. Instance is constructed by PotentialMasterNbr constructor. Acts as a listener of the integrator(s), and performs the update at regular intervals upon receiving interval events. Each event causes the manager to loop through all boxs acted upon by the integrator (as given by the integrator's getBox method), and check each atom against any neighbor criteria that apply to it, seeing if it has changed (e.g., moved) in a way that requires its neighbor lists to be updated. When this is found for any atom, all atom neighbor lists are updated via a call to the calculate method of PotentialMasterNbr, passing a PotentialCalculationCellAssign instance as the PotentialCalculation.

See Also:
Serialized Form

Nested Class Summary
static class NeighborListManager.AtomPotential1ListSource
           
 
Field Summary
protected  AtomSetSinglet atomSetSinglet
           
protected  IBox box
           
protected  boolean doApplyPBC
           
protected  boolean initialized
           
protected  PotentialMasterList potentialMaster
           
 
Constructor Summary
NeighborListManager(PotentialMasterList potentialMasterList, double range, IBox box, ISpace space)
          Configures instance for use by the given PotentialMaster.
 
Method Summary
 void addAtomNotify(IAtom atom)
          Constructs neighbor lists for the given atom
 void dispose()
           
 Class getAgentClass()
          Returns the Class of the agent.
 NeighborCriterion[] getCriterion(IAtomType atomType)
           
 boolean getDoApplyPBC()
           
 IAtomList[] getDownList(IAtom atom)
           
 NeighborListEventManager getEventManager()
           
 BoxImposePbc getPbcEnforcer()
           
 AtomPotentialList getPotential1BodyList(IAtom atom)
           
 double getRange()
           
 int getUpdateInterval()
          Returns the interval for which neighbor update checks are performed.
 IAtomList[] getUpList(IAtom atom)
           
 void integratorInitialized(IIntegratorEvent e)
          Invoked when integration begins.
 void integratorStepFinished(IIntegratorEvent e)
          Invoked at the end of each integrator step.
 void integratorStepStarted(IIntegratorEvent e)
          Invoked at the beginning of each integrator step.
 boolean isQuiet()
           
 Object makeAgent(IAtom atom)
          Returns an agent for the given Atom.
protected  void neighborSetup()
          Reassigns all interacting atoms to cells, then loops over all cell-list neighbor pairs, determines for each pair whether a potential applies to it, and if so, puts each in the other's neighbor list.
 void releaseAgent(Object agent, IAtom atom)
          This informs the agent source that the agent is going away and that the agent source should disconnect the agent from other elements
 void reset()
          For each box in the array, applies central image, resets neighbors of all atoms, and sets up all neighbor lists.
 void setDoApplyPBC(boolean newDoApplyPBC)
           
 void setPbcEnforcer(BoxImposePbc pbcEnforcer)
           
 void setQuiet(boolean quiet)
          Sets the quiet flag, indicating if unsafe-neighbor conditions should generate an error message (would not want this if atoms were inserted in a MC move, for example).
 void setRange(double d)
          Sets the interaction range, which affects the cell-list neighbor iteration used to generate candidate neighbors for neighbor listing.
 void setUpdateInterval(int updateInterval)
          Sets the interval for which neighbor update checks are performed.
 void updateLists()
           
 void updateNbrsIfNeeded()
          Checks whether any atom needs neighbor list updating, and if one is found, performs neighbor list updates of all atom neighbor lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atomSetSinglet

protected final AtomSetSinglet atomSetSinglet

potentialMaster

protected final PotentialMasterList potentialMaster

box

protected IBox box

initialized

protected boolean initialized

doApplyPBC

protected boolean doApplyPBC
Constructor Detail

NeighborListManager

public NeighborListManager(PotentialMasterList potentialMasterList,
                           double range,
                           IBox box,
                           ISpace space)
Configures instance for use by the given PotentialMaster.

Method Detail

setDoApplyPBC

public void setDoApplyPBC(boolean newDoApplyPBC)

getDoApplyPBC

public boolean getDoApplyPBC()

updateLists

public void updateLists()

integratorInitialized

public void integratorInitialized(IIntegratorEvent e)
Description copied from interface: IIntegratorListener
Invoked when integration begins.

Specified by:
integratorInitialized in interface IIntegratorListener

integratorStepFinished

public void integratorStepFinished(IIntegratorEvent e)
Description copied from interface: IIntegratorListener
Invoked at the end of each integrator step.

Specified by:
integratorStepFinished in interface IIntegratorListener

integratorStepStarted

public void integratorStepStarted(IIntegratorEvent e)
Description copied from interface: IIntegratorListener
Invoked at the beginning of each integrator step.

Specified by:
integratorStepStarted in interface IIntegratorListener

reset

public void reset()
For each box in the array, applies central image, resets neighbors of all atoms, and sets up all neighbor lists.


updateNbrsIfNeeded

public void updateNbrsIfNeeded()
Checks whether any atom needs neighbor list updating, and if one is found, performs neighbor list updates of all atom neighbor lists. Performs this action on all boxs acted on by given integrator.


getUpdateInterval

public int getUpdateInterval()
Returns the interval for which neighbor update checks are performed. After receiving this number of interval events, updateNbrsIfNeeded is invoked.


setUpdateInterval

public void setUpdateInterval(int updateInterval)
Sets the interval for which neighbor update checks are performed. After receiving this number of interval events, updateNbrsIfNeeded is invoked.


getCriterion

public NeighborCriterion[] getCriterion(IAtomType atomType)

getPbcEnforcer

public BoxImposePbc getPbcEnforcer()
Returns:
Returns the pbcEnforcer.

setPbcEnforcer

public void setPbcEnforcer(BoxImposePbc pbcEnforcer)
Parameters:
pbcEnforcer - The pbcEnforcer to set.

neighborSetup

protected void neighborSetup()
Reassigns all interacting atoms to cells, then loops over all cell-list neighbor pairs, determines for each pair whether a potential applies to it, and if so, puts each in the other's neighbor list. Called by updateNbrsIfNeeded, and by reset.

Parameters:
box - box in which neighbor setup is performed.

addAtomNotify

public void addAtomNotify(IAtom atom)
Constructs neighbor lists for the given atom


setRange

public void setRange(double d)
Sets the interaction range, which affects the cell-list neighbor iteration used to generate candidate neighbors for neighbor listing.


getRange

public double getRange()

isQuiet

public boolean isQuiet()
Returns:
quiet flag, indicating if unsafe-neighbor conditions should generate an error message (would not want this if atoms were inserted in a MC move, for example).

setQuiet

public void setQuiet(boolean quiet)
Sets the quiet flag, indicating if unsafe-neighbor conditions should generate an error message (would not want this if atoms were inserted in a MC move, for example).

Parameters:
quiet - if true, no error will be generated; default is false

getUpList

public IAtomList[] getUpList(IAtom atom)

getDownList

public IAtomList[] getDownList(IAtom atom)

getPotential1BodyList

public AtomPotentialList getPotential1BodyList(IAtom atom)

dispose

public void dispose()

getEventManager

public NeighborListEventManager getEventManager()

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)
Description copied from interface: AtomLeafAgentManager.AgentSource
Returns an agent for the given Atom.

Specified by:
makeAgent in interface AtomLeafAgentManager.AgentSource

releaseAgent

public void releaseAgent(Object agent,
                         IAtom atom)
Description copied from interface: AtomLeafAgentManager.AgentSource
This informs the agent source that the agent is going away and that the agent source should disconnect the agent from other elements

Specified by:
releaseAgent in interface AtomLeafAgentManager.AgentSource