3
$\begingroup$

Ive been trying to do a vc relax using GPAW and ASE on the BaTiO3 unitcell. The input file is as below:

from ase.io import read, write from ase.visualize import view from ase.constraints import ExpCellFilter from gpaw import GPAW from ase.optimize import BFGS from ase.io import read, write from gpaw.eigensolvers import RMMDIIS molecule_file = 'BaTiO3.cif' gpaw_args = dict(convergence={'eigenstates': 1e-08, 'density': 1e-08}, h=0.18, xc='PBE',parallel={"sl_auto":True}, eigensolver=RMMDIIS(niter=5)) molecule = read(molecule_file) # molecule.center(vacuum=7.0) view(molecule) box = ExpCellFilter(molecule) box.calc = GPAW(**gpaw_args) dyn = BFGS(box,trajectory='{}_T2.traj'.format(molecule_file[:-4])) dyn.run(fmax=0.005) 

But Im having the following error.

rank=07 L0: Traceback (most recent call last): rank=07 L1: File "/users/home/data/PZ/piezoconst/sim.py", line 33, in <module> rank=07 L2: box.calc = GPAW(**gpaw_args) rank=07 L3: AttributeError: can't set attribute 

Any pointers would be nice. Is it because Im not using calculator attribute properly?

$\endgroup$
1
  • $\begingroup$ you should set the calculator to the underlying molecule variable. The filter is just a wrapper around the the actual Atoms object $\endgroup$ Commented Apr 18, 2024 at 7:28

1 Answer 1

2
$\begingroup$

After some fiddling around (with the inputs from @kristof bal) I understood that the filters dont quite work with the finite difference mode of GPAW. It works perfectly with the PAW mode (given by mode=PW(cutoff)). I've attached a script below for future reference:

from ase.io import read from ase.constraints import ExpCellFilter from gpaw import GPAW, PW from ase.optimize import BFGS molecule_file = 'BaTiO3.cif' molecule = read(molecule_file) molecule.calc = GPAW(mode=PW(200),nbands=30,xc='PBE',gpts=(24, 24, 24)) box = ExpCellFilter(molecule) dyn = BFGS(box) dyn.run(fmax=0.005) 
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.