// Makes a repeating slab out of a single unit cell by creating copies and shifting Mol_ptr_vec UnitCellToSlab (GridParams& params) { std::vector<Molecule *> mols; Molecule * uc = params.unitCell; VecR yshift, xshift, zshift; yshift.Zero(); for (int i = 0; i < params.y; i++) { zshift.Zero(); for (int j = 0; j < params.x; j++) { xshift.Zero(); if (!(j % 2)) xshift += params.x_shift * 0.5; for (int k = 0; k < params.z; k++) { // make a copy of the unitcell Molecule * copy = new Molecule(); copy->Name(params.name); // make copies of all the atoms in the unitcell for (Atom_it atom_i = uc->begin(); atom_i != uc->end(); atom_i++) { //for (int atom = 0; atom < uc->size(); atom++) { Atom * pa = new Atom (*(*atom_i)); copy->AddAtom(pa); } // shift the new copy to the next lattice point copy->Shift(yshift + xshift + zshift); mols.push_back(copy); xshift += params.x_shift; } zshift += params.z_shift; } yshift += params.y_shift; } return mols; }
// Makes a repeating slab out of a single unit cell by creating copies and shifting Mol_ptr_vec UnitCellToSlab (Molecule * uc, VecR& x_shift,VecR& y_shift, VecR& z_shift) { std::vector<Molecule *> mols; VecR yshift, xshift, zshift; for (int i = 0; i < 1; i++) { zshift.Zero(); yshift.Zero(); for (int j = 0; j < 6; j++) { xshift.Zero(); for (int k = 0; k < 6; k++) { // make a copy of the unitcell Molecule * copy = new Molecule(); copy->Name("qtz"); // make copies of all the atoms in the unitcell for (int atom = 0; atom < uc->size(); atom++) { Atom * pa = new Atom (*uc->Atoms(atom)); copy->AddAtom(pa); } // shift the new copy to the next lattice point copy->Shift(yshift + xshift + zshift); mols.push_back(copy); xshift += x_shift; } yshift += y_shift; } zshift += z_shift; } return mols; }