4
$\begingroup$

I want to do an ionic relaxation of just the ions inside my unit cell (not the cell dimensions), with Quantum Espresso through ASE. However, I have only been able to find structure optimization methods in the [documentation][1] that:

  • Use ASE's own algorithms (not the QE methods one).
  • Do not allow me to control what to relax and what to freeze (ie, cell dimensions, ions, etc)

So far this is what I have been able to produce.

from ase.calculators.espresso import Espresso
from ase.constraints import UnitCellFilter
from ase.optimize import LBFGS
from ase import Atoms

pseudopotentials = {'Cl': 'Cl.pz-nl-rrkjus_psl.1.0.0.UPF',
                            'Na': 'Na.pz-spnl-rrkjus_psl.1.0.0.UPF'}

symbols = ["Na", "Na", "Na", "Na",
           "Cl", "Cl", "Cl", "Cl",]
cell = [[5.69, 0.00, 0.00],
        [0.00, 5.69, 0.00],
        [0.00, 0.00, 5.69]]
scaled_positions = [[0.00, 0.00, 0.00],
                    [0.00, 0.50, 0.50],
                    [0.50, 0.00, 0.50],
                    [0.50, 0.50, 0.00],
                    [0.50, 0.50, 0.50],
                    [0.50, 0.00, 0.00],
                    [0.00, 0.50, 0.00],
                    [0.00, 0.00, 0.50]]

rocksalt = Atoms(symbols=symbols,
                 scaled_positions=scaled_positions,
                 cell=cell,
                 pbc=True)

calc = Espresso(pseudopotentials=pseudopotentials,
                tstress=True,
                tprnfor=True,
                kpts=(1, 1, 1))
rocksalt.calc = calc

ucf = UnitCellFilter(rocksalt)
opt = LBFGS(ucf)
opt.run(fmax=0.005)

I was wondering if there is something along the lines of:

rocksalt.relaxation(cell=(x=False, y=False, z=False), ions=True)

[1][[https://wiki.fysik.dtu.dk/ase/ase/optimize.html]

$\endgroup$
1
  • $\begingroup$ I think you can do that using the UnitCellFilter object. Look at the arguments for UnitCellFilter here, using the mask argument should be able to fix the cell. $\endgroup$
    – CW Tan
    May 11, 2023 at 2:48

2 Answers 2

5
$\begingroup$

When you use an ASE optimizer to relax your structure, it doesn't relax your unit cell by default. It is only necessary to use UnitCellFilter when you want to simultaneously optimize the ionic positions and unit cell. In that case, I often use the improved version ExpCellFilter.

$\endgroup$
2
$\begingroup$

i) If you do not want to relax your unit cell dimension, do not use the UnitCellFilter or equivalent.

ii) I think you are looking for the constraints module to fix positions. See also the docs.

$\endgroup$
1
  • $\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Oct 24, 2023 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .