#!/usr/bin/env amspython # Calculate lattice parameters of ZnO using DFTB for different k-space samplings # This file is part of the "Crystals and Surfaces" tutorial of the Amsterdam Modeling Suite # This script requires AMS2026 or later. # USAGE: $AMSBIN/amspython dftb_lattopt_example.py from scm.plams import Settings, AMSJob from scm.base import ChemicalSystem cs = ChemicalSystem.from_xyz("ZnO_wurtzite.xyz") s = Settings() s.input.ams.Task = "GeometryOptimization" s.input.ams.GeometryOptimization.OptimizeLattice = "Yes" s.input.dftb.model = "SCC-DFTB" s.input.dftb.resourcesdir = "DFTB.org/znorg-0-1" jobs = [] for kspace in ["Basic", "Normal", "Good", "VeryGood"]: s.input.dftb.kspace.quality = kspace jobs.append(AMSJob(settings=s, molecule=cs, name=kspace)) for job in jobs: job.run() print("ZnO wurtzite optimized with SCC-DFTB znorg-0-1") print("lengths in angstrom, angles in degrees") print("kspace a b c alpha beta gamma") for job in jobs: opt_sys = job.results.get_main_system() lengths = opt_sys.lattice.get_lengths(unit="angstrom") angles = opt_sys.lattice.get_angles(unit="degree") print( "{} {:.3f} {:.3f} {:.3f} {:.3f} {:.3f} {:.3f}".format( job.name, lengths[0], lengths[1], lengths[2], angles[0], angles[1], angles[2] ) )