<commit_before>package etomica.normalmode;

import etomica.api.IAtomList;
import etomica.api.IBoundary;
import etomica.api.IBox;
import etomica.api.ISpecies;
import etomica.api.IVector;
import etomica.api.IVectorMutable;
import etomica.box.Box;
import etomica.config.ConfigurationLatticeSimple;
import etomica.lattice.BravaisLatticeCrystal;
import etomica.lattice.crystal.Basis;
import etomica.lattice.crystal.PrimitiveCubic;
import etomica.simulation.Simulation;
import etomica.space.BoundaryRectangularPeriodic;
import etomica.space.ISpace;
import etomica.species.SpeciesSpheresMono;

/**
 * Basis for a cell constructed using multiple cells.
 * 
 * @author <NAME>
 */
public class BasisBigCell extends Basis {

    private static final long serialVersionUID = 1L;

    public BasisBigCell(ISpace space, Basis subBasis, int[] nSubCells) {
        super(makeScaledCoordinates(space, subBasis, nSubCells));
    }

    protected static IVector[] makeScaledCoordinates(ISpace space, Basis subBasis, int[] nSubCells) {
        // make pretend sim, species and box so we can find the appropriate coordinates
        Simulation sim = new Simulation(space);
        ISpecies species = new SpeciesSpheresMono(sim, space);
        sim.addSpecies(species);
        // we might be used in the context of a deformable boundary (non-rectangular primitive)
        // but because we only care about scaled coordinates, the deformation doesn't
        // change what our result should be.  so just pretend that it's rectangular.
        IBoundary boundary = new BoundaryRectangularPeriodic(space);
        IBox box = new Box(boundary, space);
        sim.addBox(box);
        int numMolecules = subBasis.getScaledCoordinates().length;
        for (int i=0; i<nSubCells.length; i++) {
            numMolecules *= nSubCells[i];
        }
        box.setNMolecules(species, numMolecules);
        ConfigurationLatticeSimple configLattice = new ConfigurationLatticeSimple(new BravaisLatticeCrystal(new PrimitiveCubic(space), subBasis), space);
        configLattice.initializeCoordinates(box);

        IVector boxSize = boundary.getBoxSize();

        // retrieve real coordinates and scale them
        IAtomList atomList = box.getLeafList();
        IVectorMutable[] pos = new IVectorMutable[atomList.getAtomCount()];
        for (int i=0; i<atomList.getAtomCount(); i++) {
            pos[i] = space.makeVector();
            pos[i].E(atomList.getAtom(i).getPosition());
            pos[i].DE(boxSize);
            // coordinates now range from -0.5 to +0.5, we want 0.0 to 1.0
            pos[i].PE(0.5);
        }
        return pos;<commit_msg>*** empty log message ***<commit_after>package etomica.normalmode;

import etomica.api.IAtomList;
import etomica.api.IBoundary;
import etomica.api.IBox;
import etomica.api.ISpecies;
import etomica.api.IVector;
import etomica.api.IVectorMutable;
import etomica.box.Box;
import etomica.config.ConfigurationLatticeSimple;
import etomica.lattice.BravaisLatticeCrystal;
import etomica.lattice.crystal.Basis;
import etomica.lattice.crystal.Primitive;
import etomica.lattice.crystal.PrimitiveCubic;
import etomica.simulation.Simulation;
import etomica.space.BoundaryRectangularPeriodic;
import etomica.space.ISpace;
import etomica.species.SpeciesSpheresMono;

public class BasisBigCell extends Basis {

    private static final long serialVersionUID = 1L;

    public BasisBigCell(ISpace space, Basis subBasis, int[] nSubCells) {
        super(makeScaledCoordinates(space, subBasis, nSubCells));
    }

    protected static IVector[] makeScaledCoordinates(ISpace space, Basis subBasis, int[] nSubCells) {
        // make pretend sim, species and box so we can find the appropriate coordinates
        Simulation sim = new Simulation(space);
        ISpecies species = new SpeciesSpheresMono(sim, space);
        sim.addSpecies(species);
        // we might be used in the context of a deformable boundary (non-rectangular primitive)
        // but because we only care about scaled coordinates, the deformation doesn't
        // change what our result should be.  so just pretend that it's rectangular.
        
        
        IBoundary boundary = new BoundaryRectangularPeriodic(space);
        Primitive primitive = new PrimitiveCubic(space);
        
        IBox box = new Box(boundary, space);
        sim.addBox(box);
        IVector vector = space.makeVector(nSubCells);
        box.getBoundary().setBoxSize(vector);
        int numMolecules = subBasis.getScaledCoordinates().length;
        for (int i=0; i<nSubCells.length; i++) {
            numMolecules *= nSubCells[i];
        }
        box.setNMolecules(species, numMolecules);
        ConfigurationLatticeSimple configLattice = new ConfigurationLatticeSimple(new BravaisLatticeCrystal(primitive, subBasis), space);
        configLattice.initializeCoordinates(box);

        IVector boxSize = boundary.getBoxSize();
        
        // retrieve real coordinates and scale them
        IAtomList atomList = box.getLeafList();
        IVectorMutable[] pos = new IVectorMutable[atomList.getAtomCount()];
        for (int i=0; i<atomList.getAtomCount(); i++) {
            pos[i] = space.makeVector();
            pos[i].E(atomList.getAtom(i).getPosition());
            pos[i].DE(boxSize);
            // coordinates now range from -0.5 to +0.5, we want 0.0 to 1.0
            pos[i].PE(0.5);
            
        }
        return pos;
{'fraction_non_alphanumeric': 0.09474654377880184, 'fraction_numerical': 0.004792626728110599, 'mean_word_length': 3.2758077226162334, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, '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': '7313983', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1613, 'n_words': 406}