def make_random_hbn_model(extent): hbn = Graphene(symbol='N', latticeconstant={'a': 2.502, 'c': 12}) hbn[0].symbol = 'B' rotation = np.random.rand() * 360 hbn.rotate(rotation, 'z', rotate_cell=True) hbn = cut_rectangle(hbn, (0, 0), extent, margin=5) return hbn
def get_ase_graphene(vacuum=5.0): """Get the ASE atoms for primitive (2-atom) graphene unit cell.""" from ase.lattice.hexagonal import Graphene ase_atom = Graphene('C', latticeconstant={ 'a': 2.46 * A2B, 'c': vacuum * A2B }) return ase_atom
def generate_database(dbfile, rc): np.random.seed(123) db = connect(dbfile) rcov = covalent_radii[atomic_numbers['C']] lc = 2 * np.sqrt(3) * rcov slab = Graphene(symbol='C', latticeconstant=[lc, 12.]).repeat((3, 3, 1)) slab.center() kwargs = { 'maximum_angular_momenta': mam, 'use_spline': False, 'Hamiltonian_SlaterKosterFiles_Suffix': '"_no_repulsion.skf"' } calc = DftbPlusCalc(slab, **kwargs) slab.set_calculator(calc) e_ref_slab = slab.get_potential_energy() f_ref_slab = slab.get_forces() m = molecule('N2') m.positions += np.array([2.5, 3., 7.5]) for i in range(10): print('Generating structure %d' % i) n2 = m.copy() for i, axis in enumerate('xyz'): angle = np.random.random() * 180. n2.rotate(angle, axis, center='COP') calc = DftbPlusCalc(n2, **kwargs) n2.set_calculator(calc) e_ref_n2 = n2.get_potential_energy() f_ref_n2 = n2.get_forces() atoms = slab + n2 calc = DftbPlusCalc(atoms, **kwargs) atoms.set_calculator(calc) e = atoms.get_potential_energy() f = atoms.get_forces() e_rep, f_rep = calculate_target_repulsion(atoms, rc) finalize(atoms, energy=e + e_rep, forces=f + f_rep, stress=None) e_dft_ref = convert_array([e_ref_slab, e_ref_n2]) f_dft_ref = convert_array(np.vstack((f_ref_slab, f_ref_n2))) db.write(atoms, relaxed=1, e_dft_ref=e_dft_ref, f_dft_ref=f_dft_ref) return
from ase.units import Bohr from gpaw.external import ConstantPotential from gpaw import RMMDIIS name = 'graphene_h' # 5 x 5 supercell of graphene index1 = 5 index2 = 5 a = 2.45 c = 3.355 gra = Graphene(symbol='C', latticeconstant={ 'a': a, 'c': c }, size=(index1, index2, 1), pbc=(1, 1, 0)) gra.center(vacuum=15.0, axis=2) gra.center() # Starting position of the projectile with an impact point at the # center of a hexagon projpos = [[gra[15].position[0], gra[15].position[1] + 1.41245, 25.0]] H = Atoms('H', cell=gra.cell, positions=projpos) # Combine target and projectile atoms = gra + H
import numpy as np from ase.lattice.hexagonal import Graphene from ase.parallel import parprint as pp from gpaw import GPAW from gpaw.response.df import DielectricFunction from gpaw.mpi import world system = Graphene(symbol='C', latticeconstant={'a': 2.45,'c': 1.0}, size=(1,1,1)) system.pbc = (1, 1, 0) system.center(axis=2, vacuum=4.0) nkpts = 5 communicator = world.new_communicator(np.array([world.rank])) gpwname = 'dump.graphene.gpw' if world.rank == 0: calc = GPAW(mode='pw', kpts=(nkpts, nkpts, 1), communicator=communicator, xc='oldLDA', nbands=len(system) * 6, txt='gpaw.graphene.txt') system.set_calculator(calc) system.get_potential_energy() calc.write(gpwname, mode='all')
import numpy as np from ase.lattice.hexagonal import Graphene # import ase.io as io # from ase import Atoms, Atom from ase.visualize import view from ase.parallel import parprint as pp from gpaw import GPAW, PW, restart from gpaw.response.df import DielectricFunction from gpaw.mpi import world from gpaw.version import version from ase.lattice import bulk system = Graphene(symbol="C", latticeconstant={"a": 2.45, "c": 1.0}, size=(1, 1, 1)) system.pbc = (1, 1, 0) system.center(axis=2, vacuum=4.0) nkpts = 5 communicator = world.new_communicator(np.array([world.rank])) gpwname = "dump.graphene.gpw" if world.rank == 0: calc = GPAW( mode="pw", kpts=(nkpts, nkpts, 1), communicator=communicator, xc="oldLDA",
if 1: calc = GPAW(mode='pw', xc='PBE', nbands=16, setups={'Mo': '6'}, eigensolver='rmm-diis', occupations=FermiDirac(0.001), kpts={ 'size': (6, 6, 1), 'gamma': True }) layer = Graphene(symbol='B', latticeconstant={ 'a': 2.5, 'c': 1.0 }, size=(1, 1, 1)) layer[0].symbol = 'N' layer.pbc = (1, 1, 0) layer.center(axis=2, vacuum=4.0) layer.set_calculator(calc) layer.get_potential_energy() nbecut = 50 from ase.units import Bohr, Hartree vol = layer.get_volume() / Bohr**3 nbands = int(vol * (nbecut / Hartree)**1.5 * 2**0.5 / 3 / np.pi**2) calc.diagonalize_full_hamiltonian(nbands) calc.write('hBN.gpw', mode='all')
import os os.environ['LAMMPS_COMMAND'] = '/n/home08/xiey/lammps-16Mar18/src/lmp_mpi' import numpy as np from ase import Atoms, Atom from ase.build import bulk, make_supercell from ase.calculators.lammpsrun import LAMMPS from ase.lattice.hexagonal import Graphene symbol = 'C' a = 2.46 c = 20.0 # vaccum unit_cell = Graphene(symbol, latticeconstant={'a': a, 'c': c}) multiplier = np.array([[10, 0, 0], [0, 10, 0], [0, 0, 1]]) super_cell = make_supercell(unit_cell, multiplier) nat = len(unit_cell.positions) cell = np.array([[25.51020000000000, 0.00000000000000, 0.00000000000000], [-12.75509999999999, 22.09248125562179, 0.00000000000000], [0.00000000000000, 0.00000000000000, 20.00000000000000]]) super_cell.cell = cell #a = [6.5, 6.5, 7.7] #d = 2.3608 #NaCl = Atoms([Atom('Na', [0, 0, 0]), # Atom('Cl', [0, 0, d])], # cell=a, pbc=True) pot_path = '/n/home08/xiey/lammps-16Mar18/potentials/' parameters = { 'pair_style': 'airebo 3.0',