Skip to content

Commit

Permalink
Merge pull request abinit#194 from gpetretto/wf_refactor
Browse files Browse the repository at this point in the history
fix dfpt anaddb input
  • Loading branch information
gmatteo authored Mar 6, 2020
2 parents d55d8ec + 46bd779 commit 149c2c9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
13 changes: 8 additions & 5 deletions abipy/abio/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2770,9 +2770,9 @@ def ifc(cls, structure, ngqpt, ifcout=None, q1shft=(0, 0, 0), asr=2, chneut=1, d

@classmethod
def dfpt(cls, structure, ngqpt=None, relaxed_ion=False, piezo=False, dde=False, strain=False, dte=False,
stress_correction=False, nqsmall=None, qppa=None, ndivsm=20, line_density=None, q1shft=(0, 0, 0),
qptbounds=None, asr=2, chneut=1, dipdip=1, ramansr=1, alphon=1, dos_method="tetra", directions=None,
anaddb_args=None, anaddb_kwargs=None, comment=None):
raman=False, stress_correction=False, nqsmall=None, qppa=None, ndivsm=20, line_density=None,
q1shft=(0, 0, 0), qptbounds=None, asr=2, chneut=1, dipdip=1, ramansr=1, alphon=1, dos_method="tetra",
directions=None, anaddb_args=None, anaddb_kwargs=None, comment=None):
"""
Builds an |AnaddbInput| to post-process a generic DFPT calculation.
Expand All @@ -2790,6 +2790,7 @@ def dfpt(cls, structure, ngqpt=None, relaxed_ion=False, piezo=False, dde=False,
strain: if True the elastic tensors will be calculated (requires the strain perturbations)
dte: if True properties related to the nonlinear tensors will be calculated
(requires third orders perturbations)
raman: if True the Raman tensor will be calculated (sets dte to True).
nqsmall: Used to generate the (dense) mesh for the DOS.
It defines the number of q-points used to sample the smallest lattice vector.
qppa: Defines the homogeneous q-mesh used for the DOS in units of q-points per reciproval atom.
Expand Down Expand Up @@ -2850,11 +2851,13 @@ def dfpt(cls, structure, ngqpt=None, relaxed_ion=False, piezo=False, dde=False,
if elaflag > 1:
anaddb_input["instrflag"] = 1

if raman:
dte = True

if dte:
prtmbm = 0

# if there are phonons at gamma
if (ngqpt and not q1shft) or np.allclose(q1shft, [0, 0, 0]):
if raman:
nlflag = 1
ramansr = ramansr
alphon = alphon
Expand Down
4 changes: 4 additions & 0 deletions abipy/abio/tests/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@ def test_dfpt(self):
assert anaddb_input['nlflag'] == 3
assert anaddb_input['alphon'] == 0

anaddb_input = AnaddbInput.dfpt(self.structure, raman=True)
assert anaddb_input['nlflag'] == 1
assert anaddb_input['ramansr'] == 1


class TestCut3DInput(AbipyTest):
"""Unit tests for AbinitInput."""
Expand Down
6 changes: 3 additions & 3 deletions abipy/dfpt/ddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ def anaget_elastic(self, relaxed_ion="automatic", piezo="automatic",
def anaget_raman(self, asr=2, chneut=1, ramansr=1, alphon=1, workdir=None, mpi_procs=1,
manager=None, verbose=0, directions=None, anaddb_kwargs=None):
"""
Execute anaddb to compute phonon modes at the given q-point (without LO-TO splitting)
Execute anaddb to compute the Raman spectrum
Args:
qpoint: Reduced coordinates of the qpoint where phonon modes are computed.
Expand All @@ -1466,10 +1466,10 @@ def anaget_raman(self, asr=2, chneut=1, ramansr=1, alphon=1, workdir=None, mpi_p
If None the three cartesian direction will be used.
anaddb_kwargs: additional kwargs for anaddb.
Return: |PhononBands| object.
Return: |Raman| object.
"""

inp = AnaddbInput.dfpt(self.structure, dte=True, asr=asr, chneut=chneut, ramansr=ramansr,
inp = AnaddbInput.dfpt(self.structure, raman=True, asr=asr, chneut=chneut, ramansr=ramansr,
alphon=alphon, directions=directions, anaddb_kwargs=anaddb_kwargs)

task = self._run_anaddb_task(inp, mpi_procs, workdir, manager, verbose)
Expand Down

0 comments on commit 149c2c9

Please sign in to comment.