etomica.nbr.list
Class PotentialMasterList

java.lang.Object
  extended by etomica.potential.PotentialMaster
      extended by etomica.nbr.PotentialMasterNbr
          extended by etomica.nbr.list.PotentialMasterList
All Implemented Interfaces:
IPotentialMaster, AtomTypeAgentManager.AgentSource, SpeciesAgentManager.AgentSource, Serializable

public class PotentialMasterList
extends PotentialMasterNbr

PotentialMaster used to implement neighbor listing. Instance of this class is given as an argument to the Simulation constructor.

See Also:
Serialized Form

Nested Class Summary
protected static class PotentialMasterList.NeighborListAgentSource
           
 
Nested classes/interfaces inherited from class etomica.potential.PotentialMaster
PotentialMaster.AtomIterator0, PotentialMaster.PotentialLinker
 
Field Summary
protected  NeighborCriterion[] allCriteria
           
protected  AtomPair atomPair
           
protected  AtomSetSinglet atomSetSinglet
           
protected  BoxAgentManager neighborListAgentManager
           
protected  PotentialMasterList.NeighborListAgentSource neighborListAgentSource
           
protected  double range
           
protected  ISpace space
           
 
Fields inherited from class etomica.nbr.PotentialMasterNbr
allPotentials, boxAgentManager, boxAgentSource, intraAgentManager, intraPotentialIterator, rangedAgentManager, rangedPotentialIterator, simulation
 
Fields inherited from class etomica.potential.PotentialMaster
enabled, first, iteratorFactory, last, lrcMaster
 
Constructor Summary
PotentialMasterList(ISimulation sim, double range, BoxAgentSourceCellManagerList boxAgentSource, BoxAgentManager agentManager, ISpace _space)
           
PotentialMasterList(ISimulation sim, double range, BoxAgentSourceCellManagerList boxAgentSource, BoxAgentManager agentManager, PotentialMasterList.NeighborListAgentSource neighborListAgentSource, ISpace _space)
           
PotentialMasterList(ISimulation sim, double range, BoxAgentSourceCellManagerList boxAgentSource, ISpace _space)
           
PotentialMasterList(ISimulation sim, double range, IAtomPositionDefinition positionDefinition, ISpace _space)
          Constructs class using given position definition for all atom cell assignments.
PotentialMasterList(ISimulation sim, double range, ISpace _space)
          Constructor specifying space and range for neighbor listing; uses null AtomPositionDefinition.
PotentialMasterList(ISimulation sim, ISpace _space)
          Default constructor uses range of 1.0.
 
Method Summary
protected  void addRangedPotentialForTypes(IPotentialAtomic potential, IAtomType[] atomType)
          Adds the potential as a ranged potential that applies to the given AtomTypes.
protected  void calculate(IAtom atom, IteratorDirective.Direction direction, PotentialCalculation pc, NeighborListManager neighborManager)
           
 void calculate(IBox box, IteratorDirective id, PotentialCalculation pc)
          Overrides superclass method to enable direct neighbor-list iteration instead of iteration via species/potential hierarchy.
protected  void calculate(IMolecule molecule, IteratorDirective.Direction direction, PotentialCalculation pc, NeighborListManager neighborManager)
          Performs given PotentialCalculation using potentials/neighbors associated with the given atom (if any).
protected  void doNBodyStuff(IAtom atom, PotentialCalculation pc, int potentialIndex, IPotentialAtomic potential, NeighborListManager neighborManager)
          Invokes the PotentialCalculation for the given Atom with its up and down neighbors as a single AtomSet.
 int getCellRange()
           
 NeighborCriterion getCriterion(IPotentialAtomic potential)
          Returns the criterion used by to determine what atoms interact with the given potential.
 double getMaxPotentialRange()
          Returns the maximum range of any potential held by this potential master
 NeighborCellManager getNbrCellManager(IBox box)
           
 NeighborCriterion[] getNeighborCriteria()
           
 NeighborListManager getNeighborManager(IBox box)
           
 double getRange()
          Returns the range that determines how far to look for neighbors.
 double getSafetyFactor()
          Returns the safety factor.
 void recomputeCriteriaRanges()
          Recomputes the range for all criterion based on our own range.
 void removePotential(IPotentialAtomic potential)
          Removes given potential from the group.
 void reset()
          Recomputes the maximum potential range (which might change without this class receiving notification) and readjust cell lists
 void setCellRange(int newCellRange)
           
 void setCriterion(IPotentialAtomic potential, NeighborCriterion criterion)
          Sets the criterion associated with the given potential, overriding the default provided by the PotentialMasterList.
 void setRange(double newRange)
          Sets the range that determines how far to look for neighbors.
 void setSafetyFactor(double newSafetyFactor)
          Sets the safety factor.
 
Methods inherited from class etomica.nbr.PotentialMasterNbr
addPotential, addRangedPotential, getCellAgentManager, getIntraPotentials, getRangedPotentials, getSimulation, getSpeciesAgentClass, makeAgent, makeAgent, makePotentialGroup, potentialAddedNotify, releaseAgent, releaseAgent
 
Methods inherited from class etomica.potential.PotentialMaster
addModel, addPotential, addPotential, getPotential, getPotentials, getSpecies, isEnabled, isEnabled, isEnabled, lrcMaster, removePotential, setEnabled, setEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

space

protected final ISpace space

atomSetSinglet

protected final AtomSetSinglet atomSetSinglet

atomPair

protected final AtomPair atomPair

neighborListAgentSource

protected final PotentialMasterList.NeighborListAgentSource neighborListAgentSource

neighborListAgentManager

protected final BoxAgentManager neighborListAgentManager

range

protected double range

allCriteria

protected NeighborCriterion[] allCriteria
Constructor Detail

PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           ISpace _space)
Default constructor uses range of 1.0.


PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           double range,
                           ISpace _space)
Constructor specifying space and range for neighbor listing; uses null AtomPositionDefinition.


PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           double range,
                           IAtomPositionDefinition positionDefinition,
                           ISpace _space)
Constructs class using given position definition for all atom cell assignments.

Parameters:
positionDefinition - if null, specifies use of atom type's position definition

PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           double range,
                           BoxAgentSourceCellManagerList boxAgentSource,
                           ISpace _space)

PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           double range,
                           BoxAgentSourceCellManagerList boxAgentSource,
                           BoxAgentManager agentManager,
                           ISpace _space)

PotentialMasterList

public PotentialMasterList(ISimulation sim,
                           double range,
                           BoxAgentSourceCellManagerList boxAgentSource,
                           BoxAgentManager agentManager,
                           PotentialMasterList.NeighborListAgentSource neighborListAgentSource,
                           ISpace _space)
Method Detail

setRange

public void setRange(double newRange)
Sets the range that determines how far to look for neighbors. This range must be greater than the range of the longest-range potential.


getRange

public double getRange()
Returns the range that determines how far to look for neighbors.


getMaxPotentialRange

public double getMaxPotentialRange()
Returns the maximum range of any potential held by this potential master


setSafetyFactor

public void setSafetyFactor(double newSafetyFactor)
Sets the safety factor. The default value, 0.4, is appropriate for most simulations. Valid values range from 0 to 0.5 (non-inclusive). The safety factor determines how far an atom can travel from its original position before the neighbor lists are reconstructed. 0.5 means the atom can travel half of its neighbor range. If another atom also travels half-way then the Atoms could interact without the PotentialMaster recognizing they are neighbors. High values of the safetyFactor make it more probable that an Atom will move too far between checks and interact without the PotentialMaster knowing. Smaller values make it less probable, but slow down the simulation due to more frequent neighbor list constructing.


getSafetyFactor

public double getSafetyFactor()
Returns the safety factor.


addRangedPotentialForTypes

protected void addRangedPotentialForTypes(IPotentialAtomic potential,
                                          IAtomType[] atomType)
Adds the potential as a ranged potential that applies to the given AtomTypes. This method creates a criterion for the potential and notifies the NeighborListManager of its existence.

Specified by:
addRangedPotentialForTypes in class PotentialMasterNbr

reset

public void reset()
Recomputes the maximum potential range (which might change without this class receiving notification) and readjust cell lists


recomputeCriteriaRanges

public void recomputeCriteriaRanges()
Recomputes the range for all criterion based on our own range. The range for each criterion is set so that they all have an equal max displacement. Our nominal neighbor range is used for the criterion with the longest potential range.


getCriterion

public NeighborCriterion getCriterion(IPotentialAtomic potential)
Returns the criterion used by to determine what atoms interact with the given potential.


setCriterion

public void setCriterion(IPotentialAtomic potential,
                         NeighborCriterion criterion)
Sets the criterion associated with the given potential, overriding the default provided by the PotentialMasterList. The criterion can be configured by calling getCriterion(Potential) and changing the criterion. The potential passed to this method must be a potential handled by this instance.


removePotential

public void removePotential(IPotentialAtomic potential)
Description copied from interface: IPotentialMaster
Removes given potential from the group. No error is generated if potential is not in group.

Specified by:
removePotential in interface IPotentialMaster
Overrides:
removePotential in class PotentialMasterNbr

getNeighborCriteria

public NeighborCriterion[] getNeighborCriteria()

calculate

public void calculate(IBox box,
                      IteratorDirective id,
                      PotentialCalculation pc)
Overrides superclass method to enable direct neighbor-list iteration instead of iteration via species/potential hierarchy. If no target atoms are specified in directive, neighborlist iteration is begun with speciesMaster of box, and repeated recursively down species hierarchy; if one atom is specified, neighborlist iteration is performed on it and down species hierarchy from it; if two or more atoms are specified, superclass method is invoked.

Specified by:
calculate in interface IPotentialMaster
Overrides:
calculate in class PotentialMaster

calculate

protected void calculate(IMolecule molecule,
                         IteratorDirective.Direction direction,
                         PotentialCalculation pc,
                         NeighborListManager neighborManager)
Performs given PotentialCalculation using potentials/neighbors associated with the given atom (if any). Then, if atom is not a leaf atom, iteration over child atoms is performed and process is repeated (recursively) with each on down the hierarchy until leaf atoms are reached.


calculate

protected void calculate(IAtom atom,
                         IteratorDirective.Direction direction,
                         PotentialCalculation pc,
                         NeighborListManager neighborManager)

doNBodyStuff

protected void doNBodyStuff(IAtom atom,
                            PotentialCalculation pc,
                            int potentialIndex,
                            IPotentialAtomic potential,
                            NeighborListManager neighborManager)
Invokes the PotentialCalculation for the given Atom with its up and down neighbors as a single AtomSet.


getNeighborManager

public NeighborListManager getNeighborManager(IBox box)

getNbrCellManager

public NeighborCellManager getNbrCellManager(IBox box)

setCellRange

public void setCellRange(int newCellRange)

getCellRange

public int getCellRange()