/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package etomica.atom;

import etomica.chem.elements.IElement;
import etomica.meta.annotations.IgnoreProperty;
import etomica.species.ISpecies;
import etomica.units.dimensions.Dimension;
import etomica.units.dimensions.Mass;

/**
 * Identifies a set of atoms and defines properties of those atoms.
 * Properties include indices used for tracking, mass and element.
 */
public class AtomType {

    protected final IElement element;
    protected int index;
    protected ISpecies species;

    public AtomType(IElement element) {
        super();
        this.element = element;
        index = -1;
    }

    /**
     * @return the index for this IAtomType, within the context of an
     * Simulation.  The index is the IAtomType's position in the list of
     * atom types in the simulation.
     */
    public int getIndex() {
        return index;
    }

    /**
     * Informs the IAtomType what its index should be.  This should only be
     * called by the species.
     *
     * @param newIndex the atom type's new index
     */
    public void setIndex(int newIndex) {
        index = newIndex;
    }

    /**
     * @return the species that contains the atom type
     */
    @IgnoreProperty
    public ISpecies getSpecies() {
        return species;
    }

    /**
     * Informs the atom type what species contains the atom types.  This should
     * only be called by the species.
     *
     * @param newSpecies the atom type's new species
     */
    public void setSpecies(ISpecies newSpecies) {
        species = newSpecies;
    }

    /**
     * @return the value of the mass.
     */
    public final double getMass() {
        return element.getMass();
    }

    /**
     * @return the reciprocal of the mass, 1.0/mass
     */
    public final double rm() {
        return element.rm();
    }

    public final Dimension getMassDimension() {
        return Mass.DIMENSION;
    }

    /**
     * @return the element for this atom type
     */
    public final IElement getElement() {
        return element;
    }
}

@@ -222,16 +222,60 @@
 .atom;%0A%0A
+import etomica.chem.elements.ElementSimple;%0A
 import e
@@ -539,19 +539,16 @@
 e atoms.
-%0A *
  Propert
@@ -590,16 +590,19 @@
 ng, mass
+%0A *
  and ele
@@ -840,32 +840,446 @@
 ex = -1;%0A    %7D%0A%0A
+    /**%0A     * Convenience factory method for creating an AtomType with a one-off ElementSimple.%0A     *%0A     * @param symbol symbol for the element of this AtomType%0A     * @param mass   mass for the element of this AtomType%0A     * @return an AtomType with an ElementSimple%0A     */%0A    public static AtomType simple(String symbol, double mass) %7B%0A        return new AtomType(new ElementSimple(symbol, mass));%0A    %7D%0A%0A
     /**%0A     * @
@@ -1339,23 +1339,16 @@
 xt of an
-%0A     *
  Simulat
@@ -1390,16 +1390,23 @@
 position
+%0A     *
  in the 
@@ -1412,23 +1412,16 @@
  list of
-%0A     *
  atom ty
@@ -1591,23 +1591,16 @@
  only be
-%0A     *
  called 
@@ -1997,23 +1997,16 @@
 s should
-%0A     *
  only be

Add convenience factory method for creating AtomTypes with ElementSimple