4
$\begingroup$

I wanted to do a variable-cell relaxation calculation using GPAW (similar to the one present in quantum ESPRESSO). It would be nice if I could get pointers on how to approach this.

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

This is system I'm trying to perform a geometry optimization on. (Or is it performed by BFGS under the hood?)

$\endgroup$
1
  • $\begingroup$ I gave you +1 long ago, but I am just commenting today to tell you not to make any new tags on this site (see my edit please). $\endgroup$ Commented Apr 27, 2024 at 21:02

1 Answer 1

5
$\begingroup$

This is more of an ASE question, given that a python script using ASE is employed to set up and run the GPAW calculation. GPAW only is used to compute energies/forces/stresses for a given structure, while ASE functions handle I/O and structure modification.

Indeed, the BFGS functionality in ASE can be used for geometry optimization. However, when used as in the example, only atomic coordinates will be relaxed. Cell parameters are left untouched, and no restraints are applied.

In order to achieve more control over what is modified in the optimization, ASE offers several "filters." Some of these allow for full cell relaxtions (atom positions and cell parameters). One of them is the ExpCellFilter. The simplest application of this filter looks like this:

box = ExpCellFilter(molecule) # the "box" object has extra degrees of freedom, # namely, the cell parameters # optimizing this object now means minimizing # atomic forces as well as stresses dyn = BFGS(box) dyn.run(fmax=0.005) 

For more options, do check the manual. In addition, different optimization techniques besides BFGS are implemented, although that one is kind of standard.

$\endgroup$
3
  • $\begingroup$ The ExpCellFilter doesnt seem to be importable.. can you tell me which version of ASE you are using? $\endgroup$ Commented Apr 15, 2024 at 15:08
  • $\begingroup$ from ase.constraints import ExpCellFilter doesn't work? This is what use with my older ASE version. Looking at the doc, it seems newer versions put filters in ase.filters $\endgroup$ Commented Apr 16, 2024 at 8:09
  • $\begingroup$ Thanks importing it from ase.constraints worked!! But now im facing a new issue. Ive posted it as a new question here : mattermodeling.stackexchange.com/questions/12790/…. Thanks again. $\endgroup$ Commented Apr 18, 2024 at 1:06

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.