From Wiketomica
Jump to: navigation, search
API Home Participants API Discussion Demos Downloads Documentation Contact Us Acknowledgements


Reason for existence

It is often helpful to have a method that takes a group of [[API:IAtom|IAtom]s (this happens most frequently with IPotentials). In order for the potentials and similar objects to share a common interface, a simple interface is needed to cover both IAtoms and groups of IAtoms. Furthermore, the IAtomList interface allows IAtomsetIterators that return 1 or 2 IAtoms for each iterate to share a common interface.

IAtomList is also used to hold lists of IAtoms, such as the children IAtoms of a molecule, or all the leaf IAtoms in an IBox.

Proposed Interface

interface IAtomList {

     * the number of atoms in the set
    readonly attribute unsigned int atomCount;

     * Returns the i-th atom, with numbering beginning from 0. 
     * If i is greater than atomCount-1, throws an IllegalArgumentException.
    readonly attribute IAtom atoms[];



We expect codebases to implement at leaste one concrete classes to implement IAtomList, namely a class to hold a list of IAtoms (Etomica includes an additional class to explicitly hold 0, 1 and 2 IAtoms). A IPotentialMaster would construct IAtomLists (perhaps using IAtomSetIterators) and pass them to an IPotential.