2
$\begingroup$

I am trying to create the espresso input for magnetic calculation, reading the data from a cif file.

The ase code for the same is:

# Input
 # Reading Input from CIF
  filename = args.cif
  system = aio.read(filename)
# Adding the magmom
  system.magmom = [3]
  print(system.magmom)
 
 
  # vcrelax
  input_data = {
      'calculation': 'vc-relax',
      'outdir': odir,
      'occupations': 'smearing',
      'degauss': 0.05,
      'nspin': 2,
      'smearing': 'gaussian',
      "starting_magnetization(1)": 3.0
  }
  calc = Espresso(pseudopotentials=pseudo_list,
                  pseudo_dir=pseudodir,
                  input_data=input_data,
                  crystal_coordinates=True,
                  tstress=True,
                  tprnfor=True,
                  kpts=(6, 6, 6))
  system.calc = calc
  print(system.get_potential_energy())

I am expecting the generated input with 'starting_magnetization(1)=3', But I am getting the input as:

&SYSTEM
   starting_magnetization(1) = 0.0
   occupations      = 'smearing'
   degauss          = 0.05
   smearing         = 'gaussian'
   nspin            = 2
   ntyp             = 1
   nat              = 2
   ibrav            = 0
/

Hence, my scf is showing 0 absolute magnetizations.

How I can use ase to create a proper spin-DFT input for QE using ASE?

$\endgroup$

1 Answer 1

3
$\begingroup$

Need to scale magmom by number of valance electron

from ase.spacegroup import crystal
from ase.io import read
a = 4.05
al = crystal('Al', [(0, 0, 0)], spacegroup=225, cellpar=[a, a, a, 90, 90, 90])
al.write('al.cfg',format='cfg')

#=========above are optional just to generate cfg file===============


system = read('al.cfg')
scale=3 # valance_electron of Al



system.set_initial_magnetic_moments(magmoms=4*[3*scale])
input_data = {
      'calculation': 'vc-relax',
      'outdir': './out',
      'occupations': 'smearing',
      'degauss': 0.05,
      'ispin': 2,
      'tprnfor':True,
      'tstress':True,
      'smearing': 'gaussian'
  }
system.write('Al.in',format='espresso-in',input_data=input_data,pseudopotentials={'Al': 'Al.pbe-rrkjus.UPF'},kpts=(10, 10, 10))

OUTPUT

&CONTROL
   calculation      = 'vc-relax'
   tstress          = .true.
   tprnfor          = .true.
   outdir           = './out'
/
&SYSTEM
   occupations      = 'smearing'
   degauss          = 0.05
   smearing         = 'gaussian'
   nspin            = 2
   starting_magnetization(1) = 3.0
   ntyp             = 1
   nat              = 4
   ibrav            = 0
/
&ELECTRONS
/
&IONS
/
&CELL
/

ATOMIC_SPECIES
Al  26.981538 Al.pbe-rrkjus.UPF

K_POINTS automatic
10 10 10  0 0 0

CELL_PARAMETERS angstrom
4.05000000000000 0.00000000000000 0.00000000000000
0.00000000000000 4.05000000000000 0.00000000000000
0.00000000000000 0.00000000000000 4.05000000000000

ATOMIC_POSITIONS angstrom
Al  0.0000000000 0.0000000000 0.0000000000
Al  0.0000000000 2.0250000000 2.0250000000
Al  2.0250000000 0.0000000000 2.0250000000
Al  2.0250000000 2.0250000000 0.0000000000

$\endgroup$

You must log in to answer this question.

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