Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
-3.2251946581E-01 9.0284480687E-01 -1.8824324581E-01
4.0000000000E+00 0.0000000000E+00 0.0000000000E+00
4.4876385468E+00 -1.4925704575E-01 -8.9716581956E-01
4.2142401901E+00 -7.8694929117E-01 6.3097154506E-01
4.3498225718E+00 8.7106686509E-01 4.2709343135E-01
2.9570301511E+00 5.5992672027E-02 -1.3560839453E-01""", sep=" ").reshape((-1,3))
structure = abilab.Structure.from_abivars(
acell=abilab.ArrayWithUnit([10, 5, 5], "ang").to("bohr"),
rprim=np.eye(3),
typat=[1, 3, 3, 2, 3, 3, 3, 3], # Type of atoms (H2O + NH3 + H)
znucl=[8.0, 7.0, 1.0],
xangst=xangst,
)
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# Options for parallelism
paral_kgb=1,
# Input/output options
prtwf=0,
prtden=0,
prteig=0,
prtdensph=0,
timopt=-1,
# Convergence parameters
ecut=20.,
pawecutdg=40.,
0.89665333333333 0.84174666666666 0.67481666666667
0.93254833333333 0.97751666666666 0.81711666666667
0.91770833333333 0.93970666666666 0.99482666666667
0.92680333333333 0.14577666666666 0.95922666666667
""", sep=" ").reshape((-1,3))
# Crystal structure.
structure = abilab.Structure.from_abivars(
acell=[50.4, 25.2, 25.2],
rprim=np.eye(3),
typat=256*[1],
znucl=22,
xred=xred,
)
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# SCF algorithm
paral_kgb=1,
wfoptalg=1,
fftalg=402,
#fftalg-302, # To use FFTW instead of ABINIT FFT
# Basis set
ecut=5,
pawecutdg=10,
# SCF cycle
tolvrs=1.e-3,
nstep=20,
# K-Points and symmetries
ecut=8,
istwfk="*1",
chksymbreak=0,
#nstep=4,
nstep=10,
paral_kgb=paral_kgb,
)
# GS run
scf_inp = abilab.AbinitInput(structure, pseudos=pseudos)
scf_inp.set_vars(global_vars)
scf_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)
scf_inp["tolvrs"] = 1e-6
# NSCF run
nscf_inp = abilab.AbinitInput(structure, pseudos=pseudos)
nscf_inp.set_vars(global_vars)
nscf_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)
nscf_inp.set_vars(
tolwfr=1e-8,
nband=12,
nbdbuf=4,
iscf=-2,
)
# BSE run with Model dielectric function and Haydock (only resonant + W + v)
# Note that SCR file is not needed here
bse_inp = abilab.AbinitInput(structure, pseudos=pseudos)
bse_inp.set_vars(global_vars)
bse_inp.set_kmesh(ngkpt=[2, 2, 2], shiftk=shiftk)
def make_scf_input(paral_kgb=0):
"""
This function constructs the input file for the GS calculation:
"""
# Crystalline AlAs: computation of the second derivative of the total energy
structure = abidata.structure_from_ucell("AlAs")
pseudos = abidata.pseudos("13al.981214.fhi", "33as.pspnc")
gs_inp = abilab.AbinitInput(structure, pseudos=pseudos)
gs_inp.set_vars(
nband=4,
ecut=2.0,
ngkpt=[4, 4, 4],
nshiftk=4,
shiftk=[0.0, 0.0, 0.5, # This gives the usual fcc Monkhorst-Pack grid
0.0, 0.5, 0.0,
0.5, 0.0, 0.0,
0.5, 0.5, 0.5],
#shiftk=[0, 0, 0],
paral_kgb=paral_kgb,
tolvrs=1.0e-10,
ixc=1,
diemac=9.0,
#iomode=3,
global_vars = dict(
nband=12,
ecut=12.0,
pawecutdg=24.0 if paw else None,
ngkpt=[8, 8, 8],
nshiftk=4,
shiftk=[0.0, 0.0, 0.5, # This gives the usual fcc Monkhorst-Pack grid
0.0, 0.5, 0.0,
0.5, 0.0, 0.0,
0.5, 0.5, 0.5],
#shiftk=[0, 0, 0],
paral_kgb=0,
diemac=9.0,
)
gs_inp = abilab.AbinitInput(structure, pseudos=pseudos)
gs_inp.set_vars(global_vars, tolvrs=1.0e-18)
# Get the qpoints in the IBZ. Note that here we use a q-mesh with ngkpt=(4,4,4) and shiftk=(0,0,0)
# i.e. the same parameters used for the k-mesh in gs_inp.
#qpoints = gs_inp.abiget_ibz(ngkpt=(4,4,4), shiftk=(0,0,0), kptopt=1).points
#print("get_ibz", qpoints)
ph_inp = abilab.AbinitInput(structure, pseudos)
# Response-function calculation for phonons.
qpt = [0, 0, 0]
qpt = [0.25, 0, 0]
ph_inp.set_vars(
global_vars,
rfphon=1, # Will consider phonon-type perturbation
nqpt=1, # One wavevector is to be considered
def make_input(paw=False):
"""Build a template input file for GS calculations with k-point parallelism """
pseudos = abidata.pseudos("14si.pspnc", "8o.pspnc") if not paw else \
abidata.pseudos("Si.GGA_PBE-JTH-paw.xml", "o.paw")
structure = abidata.structure_from_ucell("SiO2-alpha")
inp = abilab.AbinitInput(structure, pseudos)
inp.set_kmesh(ngkpt=[1,1,1], shiftk=[0,0,0])
# Global variables
ecut = 24
inp.set_vars(
ecut=ecut,
pawecutdg=ecut*2 if paw else None,
nsppol=1,
nband=28,
paral_kgb=0,
#istwfk="*1",
#fftalg=312,
timopt=-1,
chksymbreak=0,
prtwf=0,
prtden=0,
0.66666667E+00 0.83333333E+00 0.83333333E+00
0.83333333E+00 0.66666667E+00 0.83333333E+00
0.83333333E+00 0.83333333E+00 0.66666667E+00
""", sep=" ").reshape((-1,3))
# Crystal structure (32 Al atoms)
structure = abilab.Structure.from_abivars(
acell=3*[19.215],
rprim=np.eye(3),
ntypat=1,
typat=108*[1],
znucl=13.0,
xred=xred,
)
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# parallelization
paral_kgb=1,
ecut=3.0,
pawecutdg=6.0 if paw else None,
nband=300,
nsppol=1,
# SCF cycle parameters
tolvrs=1.e-3,
nstep=50,
# K-points and sym
occopt=3,
global_vars = dict(
nband=12,
ecut=12.0,
pawecutdg=24 if paw else None,
ngkpt=[8, 8, 8],
nshiftk=4,
shiftk=[0.0, 0.0, 0.5, # This gives the usual fcc Monkhorst-Pack grid
0.0, 0.5, 0.0,
0.5, 0.0, 0.0,
0.5, 0.5, 0.5],
#shiftk=[0, 0, 0],
paral_kgb=0,
diemac=9.0,
)
gs_inp = abilab.AbinitInput(structure, pseudos=pseudos)
gs_inp.set_vars(global_vars, tolvrs=1.0e-18)
# Get the qpoints in the IBZ. Note that here we use a q-mesh with ngkpt=(4,4,4) and shiftk=(0,0,0)
# i.e. the same parameters used for the k-mesh in gs_inp.
#qpoints = gs_inp.abiget_ibz(ngkpt=(4,4,4), shiftk=(0,0,0), kptopt=1).points
#print("get_ibz", qpoints)
ph_inp = abilab.AbinitInput(structure, pseudos)
# Response-function calculation for phonons.
qpt = [0, 0, 0]
qpt = [0.25, 0, 0]
ph_inp.set_vars(
global_vars,
rfphon=1, # Will consider phonon-type perturbation
nqpt=1, # One wavevector is to be considered
def make_scf_input(ngkpt, paral_kgb=0):
"""
This function constructs the input file for the GS calculation for a given IBZ sampling.
"""
# Crystalline AlAs: computation of the second derivative of the total energy
structure = abidata.structure_from_ucell("AlAs")
pseudos = abidata.pseudos("13al.981214.fhi", "33as.pspnc")
gs_inp = abilab.AbinitInput(structure, pseudos=pseudos)
gs_inp.set_vars(
nband=4,
ecut=2.0,
ngkpt=ngkpt,
nshiftk=4,
shiftk=[0.0, 0.0, 0.5, # This gives the usual fcc Monkhorst-Pack grid
0.0, 0.5, 0.0,
0.5, 0.0, 0.0,
0.5, 0.5, 0.5],
#shiftk=[0, 0, 0],
paral_kgb=paral_kgb,
tolvrs=1.0e-10,
ixc=1,
diemac=9.0,
#iomode=3,