[gpaw-users] Optimizing the unit cell using stress tensor
Filip Anselm Rasmussen
fras at fysik.dtu.dk
Mon Feb 9 09:19:40 CET 2015
Dear Jose,
This is actually more a ASE-related question, but let's take it here anyway:
As is written on the ASE web site
(https://wiki.fysik.dtu.dk/ase/ase/constraints.html#ase.constraints.UnitCellFilter)
both the UnitCellFilter and StrainFilter objects come with an optional
mask parameter that specifies which stress tensor components are allowed
to be non-zero (i.e. applied in the relaxation). If you only want to
relax in the z-direction you thus simply do this:
mask = [0, 0, 1, 0, 0, 0] # = [xx, yy, zz, yz, xz, xy] - we only need
zz-component
uf = UnitCellFilter(a, mask=mask)
If you only want your lattice constant to be relaxed and not the
internal atomic positions I would suggest you use the StrainFilter class
instead, it should also make the relaxation more stable.
One is also sometimes required to use a rather high PW cut-off when
relaxing units cells because the number of plane waves will change as
the unit cell changes and this can introduce small variations in the
energy. Personally I've in some cases needed as much as 750 eV to make
the relaxation stable.
- Filip
On 2015-02-08 05:51, sollebac wrote:
> Dear gpaw users,
>
> I'm trying to relax a nanotube C using the stress tensor, then
> i set periodic boundary conditions only in z direction [
> pbc=(False,False True) ]
> im wondering if there is a way to fix the "X" and "Y" sides of the
> unit cell and let move only in "z" direction?
>
> The nanotube is in a supercell and only is peridic in z ,
> here is the script that im using that is similar to example in the web :
> https://wiki.fysik.dtu.dk/gpaw/exercises/stress/stress.html
>
> i just want relax the nanotube and find the lattice parameter but
> only in z direction
>
> from ase import Atoms
> from ase.lattice import bulk
> from ase.optimize.bfgs import BFGS
> from ase.constraints import UnitCellFilter
> from gpaw import GPAW
> from gpaw import PW
> import numpy as np
> from ase.structure import nanotube
> from ase.io <http://ase.io> import read,write
>
> a=nanotube(7, 0, length=1, bond=1.4, symbol='C')
> a.center()
> a.set_pbc((False,False,True))
> write('a.traj', a)
> calc = GPAW(xc='PBE',
> mode=PW(100),
> # mode=PW(400, cell=a.get_cell()), # fix no of planewaves!
> kpts=(1, 1, 3),
> # convergence={'eigenstates': 1.e-10}, # converge tightly!
> txt='stress.txt')
>
> a.set_calculator(calc)
>
> uf = UnitCellFilter(a)
> relax = BFGS(uf)
> relax.run(fmax=0.05) # Consider much tighter fmax!
>
>
> b=a.get_cell()[0]
> #b=a.get_cell()
> print "Unit cell = ",a.get_cell()
>
>
>
> any advice is welcome
> thank you very much
>
> Jose Luis
>
>
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20150209/eb77d0d6/attachment.html>
More information about the gpaw-users
mailing list