As a continuation of my previous question, I would like to do variable cell relaxation of BaTiO3 under the influence of a constant electric field. The script I've used is given below:

from ase.constraints import ExpCellFilter
from gpaw.external import ConstantElectricField
from gpaw import GPAW, PW
from ase.optimize import BFGS
from ase.io import read 

molecule_file = 'BaTiO3.cif'
molecule = read(molecule_file)
molecule.calc = GPAW(mode=PW(300),nbands=30,xc='PBE',gpts=(24, 24, 24),external=ConstantElectricField(2.5, [0, 0, 1]))
box = ExpCellFilter(molecule)
dyn = BFGS(box)

In the output file, I've observed that the external potential matrix has a different shape:

rank=3 L42:     dens.ghat.integrate(ham.vHt_q + vext_q, W_aL)
rank=3 L43:                         ~~~~~~~~~~^~~~~~~~
rank=3 L44: ValueError: operands could not be broadcast together with shapes (1043,) (1545,) 
GPAW CLEANUP (node 3): <class 'ValueError'> occurred.  Calling MPI_Abort!

Any pointers to solve this would be highly appreciated.



You must log in to answer this question.