<commit_before>/* 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;
    }
<commit_msg>Add convenience factory method for creating AtomTypes with ElementSimple<commit_after>/* 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.ElementSimple;
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;
    }

    /**
     * Convenience factory method for creating an AtomType with a one-off ElementSimple.
     *
     * @param symbol symbol for the element of this AtomType
     * @param mass   mass for the element of this AtomType
     * @return an AtomType with an ElementSimple
     */
    public static AtomType simple(String symbol, double mass) {
        return new AtomType(new ElementSimple(symbol, mass));
    }

    /**
     * @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;
    }

{'fraction_non_alphanumeric': 0.08130252100840336, 'fraction_numerical': 0.0029411764705882353, 'mean_word_length': 2.4227174694464413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2137155', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1333, 'n_words': 507}