Package: pynabi
PynAbiPython package to easily createAbinitinput files.pip install pynabiExamplefrompynabiimportcreateAbi,DataSet,AbIn,AbOutfrompynabi.kspaceimportCriticalPointsOf,BZ,SymmetricGrid,UsualKShifts,Pathfrompynabi.calculationimportToleranceOn,EnergyCutoff,MaxSteps,SCFMixing,NonSelfConsistentCalcfrompynabi.crystalimportAtom,FluoriteLikefrompynabi.occupationimportOccupationPerBandfrompynabi.unitsimporteV,nm# create manually an atom -> Atom(<Z>, <pseudo potential name>)# or using sensible defaults as followsZr=Atom.of("Zr")# Z=40 and pseudos located at "Zr.psp8"Oxy=Atom.of("O")# Z=8 and pseudos located at "O.psp8"# base dataset with common variablesbase=DataSet(AbOut("./scf/scf"),# prefix for output filesAbIn().PseudoPotentials("./pseudos/PBE-SR"),# folder with pseudo potentialsFluoriteLike(Zr,Oxy,0.5135*nm),# creates AtomBasis and Lattice of a crystal like fluorite# with lattice constant 0.5135nmSymmetricGrid(BZ.Irreducible,UsualKShifts.FCC)# easily define kptopt, ngkpt, nshiftk, kpt.ofMonkhorstPack(4),SCFMixing(density=True).Pulay(10),# scf cycle with Pulay mixing of the density# based on the last 10 iterationToleranceOn.EnergyDifference(1e-6),# expressively define the toleranceMaxSteps(30)# nstep)# set the default energy unit in eV (from now on)eV.setAsReference()# datasets to see the convergenge as a function of energysets=[DataSet(EnergyCutoff(8.0+i*0.25))foriinrange(0,17)]# final non-self-consistent round to find bandsbands=DataSet(NonSelfConsistentCalc(),ToleranceOn.WavefunctionSquaredResidual(1e-12),AbIn().ElectronDensity(sets[-1]),# get the electron density from the last datasetOccupationPerBand(2.0,repeat=8),# same number of bands (max 8) for each k pointPath.auto(10,"GXWKGLUWLK",CriticalPointsOf.FCC)# easily define a path in the k-space)withopen("./out.txt",'w')asf:f.write(createAbi(base,*sets,bands))Outputndtset 18

# Atoms definition
ntypat 2
znucl 40 8
pseudos "Zr.psp8, O.psp8"

# Common DataSet
natom 3
typat 1 2 2
xred 0 0 0   0.3333333333333333 0.3333333333333333 0.3333333333333333   0.6666666666666666 0.6666666666666666 0.6666666666666666
outdata_prefix "./scf/scf"
pp_dirpath "./pseudos/PBE-SR"
scalecart 0.5135 0.5135 0.5135 nm
rprim 0.5 0.5 0.0   0.0 0.5 0.5   0.5 0.0 0.5
kptopt 1
nshiftk 4
shiftk 0.5 0.5 0.5 0.5 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5
ngkpt 4 4 4
iscf 17
npulayit 10
toldfe 1e-06
nstep 30

# DataSet 1
ecut1 8.0 eV

# DataSet 2
ecut2 8.25 eV

# DataSet 3
ecut3 8.5 eV

# DataSet 4
ecut4 8.75 eV

# DataSet 5
ecut5 9.0 eV

# DataSet 6
ecut6 9.25 eV

# DataSet 7
ecut7 9.5 eV

# DataSet 8
ecut8 9.75 eV

# DataSet 9
ecut9 10.0 eV

# DataSet 10
ecut10 10.25 eV

# DataSet 11
ecut11 10.5 eV

# DataSet 12
ecut12 10.75 eV

# DataSet 13
ecut13 11.0 eV

# DataSet 14
ecut14 11.25 eV

# DataSet 15
ecut15 11.5 eV

# DataSet 16
ecut16 11.75 eV

# DataSet 17
ecut17 12.0 eV

# DataSet 18
iscf18 -2
tolwfr18 1e-12
getden18 17
occopt18 0
occ18 8*2.0
band18 8
kptopt18 -9
kptbounds18 0 0 0  0.0 0.5 0.5  0.25 0.75 0.5  0.375 0.75 0.375  0 0 0  0.5 0.5 0.5  0.25 0.625 0.625  0.25 0.75 0.5  0.5 0.5 0.5  0.375 0.75 0.375
ndivsm18 10FeaturesMulti dataset supportHelper functions for common crystal structures (caesium chloride, rock-salt, fluorite, zincblende, wurtzite, nickeline, HCP)Registered critical points of and methodsto create lattices of CUB, BCC, FCC, HEX, TET, BCT, ORC, ORCCSmooth experience in defining the k-pointsHandy management offile handling variablesAlmost full covarage ofbasic input variables(missing nbandhf, symrel, tnons, wvl_hgrid)Partial coverage ofground state variablesPartial coverage ofrelaxation variablesMore to come...Why PynAbi over pure Abinit files?If you're a very experienced Abinit user who knows its variables and their possible values (and associated meaning), then this package probably isn't for you.
For all other users, on top of all the aforementioned features, here's a list of reasons why you could find PynAbi useful:You have all the power of coding to generate Abinit instructions, e.g. reusability, loops to generate datasets programmaticallyIt provides some useful presets and helper functions/methods that allows you to skip to the fun part of the simulationUnder the hood, it checks for the validity of variable valuesbeforestarting AbinitIt makes use of expressive declarations and definition, leading to readable and comprehensible istructionsIf you're using a code editor (with autocompletition), you'll get suggetions of all the possible options in a more natural languageSome prior knowledge of Abinit (and DFT in general) is nonetheless needed to fully understand what actually is to be simulated: this package only provides a handier way to generate the required files.DocumentationAlthough currently severely incomplete, a wiki is available on theGitHub repository Wiki. Ideally a wiki for this package shouldn't be needed if your editor has some autocompletition: the aim is to document every class and function with a detailed description taken from the relevant parts of ABINIT documentation.