pwtools.calculators.Pwscf¶
- class pwtools.calculators.Pwscf(**kwds)[source]¶
Bases:
FileIOCalculator
,CalculatorBase
Pwscf (pw.x) calculator.
ATM, we don’t write a
ase.calculators.calculator.Parameters
class (dict) and have no read() method so I guess that restarts don’t work. Only simple SCF runs for now.Examples
Define a calculator object:
>>> calc=Pwscf(label='pw', ... directory='/path/to/calculation/dir', ... kpts=1/0.35, ... ecutwfc=80, ... conv_thr=1e-8, ... pp='pbe-n-kjpaw_psl.0.1.UPF', ... pseudo_dir='/home/schmerler/soft/share/espresso/pseudo/espresso/', ... calc_name='my_calc', ... outdir='/scratch/schmerler/', ... command='mpirun -np 16 pw.x < pw.in > pw.out') >>> at=crys.Structure(...).get_ase_atoms(pbc=True) >>> at.set_calculator(calc) >>> at.get_potential_energy()
Relation to ASE k-grid tools:
>>> import numpy as np >>> from ase.calculators.calculator import kpts2mp >>> from pwtools.crys import kgrid >>> st=crys.Structure(cell=np.diag([5,3,3]), ... coords=rand(5,3), ... symbols=['H']*5) >>> at=st.get_ase_atoms(pbc=True) >>> crys.kgrid(st.cell, h=0.35) array([4, 6, 6]) >>> kpts2mp(at, kpts=1/0.35) array([4, 6, 6])
- __init__(**kwds)[source]¶
- Parameters:
parameters (All)
label (str) – Basename of input and output files (e.g. ‘pw’). ASE’s FileIOCalculator will then set:
self.prefix=label
, whileself.label
will become{self.directory}/{self.prefix}
. Don’t ask :) Inself.command
, we use ‘{self.prefix}.in’ and ‘{self.prefix}.out’ as file names.directory (str) – Path to a calculation dir where input and output files shall be written, e.g.
pw.in
andpw.out
.kpts (ASE k-points description) – Examples:
3.5
,[6,6,4]
. If a floatx
is used, then it is the inverse of the k-grid spacing h per reciprocal axis as inkpts=pwtools.crys.kgrid(struct.cell, h=1/x)
calc_name (str) – ‘prefix’ in PWscf input files
pp (str or sequence) – Definition of the pseudopotential file and thus xc. If pp is a string (e.g. ‘pbe-n-kjpaw_psl.0.1.UPF’), then the atom symbols are used to build the PP file name
'<atom_symbol>.pbe-n-kjpaw_psl.0.1.UPF'
for each atom type. Needs a file of that name in pseudo_dir. If pp is a list, e.g.['Al.pbe-n-kjpaw_psl.0.1.UPF', 'N.pbe-n-kjpaw_psl.0.1.UPF']
, then this is used for each atom type.outdir – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
pseudo_dir – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
ecutwfc – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
ecutrho – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
diagonalization – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
mixing_mode – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
mixing_beta – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
electron_maxstep – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
conv_thr – as in PWscf, see http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
backup (bool) – make backup of old pw.in and pw.out if found, uses
backup()
Methods
Replace all placeholders in
self.infile_templ
.init_params_from_input
(kwds)Set
self.parameters = self.default_parameters
and update with input keyword arguments kwds.write_input
(atoms[, properties, system_changes])Attributes