def __init__(self, bond=aCC, a=3 * aCC, b=np.sqrt(3) * aCC, c=2 * r_CC_vdw, basis=4 * ['C'], coords=[[0, 0, 0], [aCC, 0, 0], [3 / 2 * aCC, np.sqrt(3) / 2 * aCC, 0], [5 / 2 * aCC, np.sqrt(3) / 2 * aCC, 0]], cartesian=True): lattice = Crystal3DLattice.orthorhombic(a, b, c) super().__init__(lattice, basis, coords, cartesian)
def generate_unit_cell(self): """Generate the nanotube unit cell.""" eps = 0.01 e1 = self.element1 e2 = self.element2 N = self.N T = self.T rt = self.rt psi, tau, dpsi, dtau = self.unit_cell_symmetry_params a = compute_Ch(self.n, self.m, bond=self.bond) b = self.layer_spacing c = compute_T(self.n, self.m, bond=self.bond, length=True) lattice = Crystal3DLattice.orthorhombic(a, b, c) basis = Atoms() if self.verbose: print('dpsi: {}'.format(dpsi)) print('dtau: {}\n'.format(dtau)) for i in range(N): for j, element in enumerate((e1, e2), start=1): theta = i * psi h = i * tau if j == 2: theta += dpsi h -= dtau x = rt * theta z = h while z > T - eps: z -= T if z < 0: z += T xs, ys, zs = \ lattice.cartesian_to_fractional([x, 0, z]) if self.wrap_coords: xs, ys, zs = \ lattice.wrap_fractional_coordinate([xs, ys, zs]) if self.debug: print('i={}: x, z = ({:.6f}, {:.6f})'.format(i, x, z)) atom = Atom(element, lattice=lattice, xs=xs, ys=ys, zs=zs) atom.rezero() if self.verbose: print('Basis Atom:\n{}'.format(atom)) basis.append(atom) self.unit_cell = UnitCell(lattice=lattice, basis=basis)
def __init__(self, bond=aCC, a=3 * aCC, b=np.sqrt(3) * aCC, c=2 * r_CC_vdw, basis=4 * ['C'], coords=[[0, 0, 0], [aCC, 0, 0], [3 / 2 * aCC, np.sqrt(3) / 2 * aCC, 0], [5 / 2 * aCC, np.sqrt(3) / 2 * aCC, 0]], cartesian=True): lattice = Crystal3DLattice.orthorhombic(a, b, c) super().__init__(lattice, basis, coords, cartesian)