35 lines
861 B
Python
35 lines
861 B
Python
from ase.build import molecule, fcc111, add_adsorbate
|
|
from ase.constraints import FixAtoms
|
|
from ase.visualize import view
|
|
from ase.optimize import BFGS
|
|
from gpaw import GPAW, PW
|
|
|
|
# Build Cu(111) surface
|
|
slab = fcc111("Cu", size=(4, 4, 3), vacuum=10.0)
|
|
slab.center(axis=2) # Center in z
|
|
|
|
# Fix bottom layer of Cu atoms
|
|
mask = [atom.tag == 1 for atom in slab]
|
|
slab.set_constraint(FixAtoms(mask=mask))
|
|
|
|
# Load glycine molecule (neutral form, gas phase)
|
|
gly = molecule("glycine")
|
|
|
|
# Optional: adjust conformation if needed here
|
|
gly.center()
|
|
|
|
# Add glycine 3 Å above the surface
|
|
add_adsorbate(slab, gly, height=3.0, position="ontop")
|
|
|
|
# Set calculator
|
|
slab.calc = GPAW(
|
|
mode=PW(500), xc="PBE", kpts=(4, 4, 1), txt="glycine_cu_adsorption.log"
|
|
)
|
|
|
|
# Relaxation
|
|
dyn = BFGS(slab, trajectory="adsorption.traj")
|
|
dyn.run(fmax=0.05)
|
|
|
|
# Optional: View result
|
|
view(slab)
|