Skip to content

Commit 5bd270f

Browse files
committed
shg scissor as classmethod
1 parent 2997833 commit 5bd270f

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

src/atomate2/abinit/flows/dfpt.py

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
generate_dte_perts,
2121
run_rf,
2222
)
23-
from atomate2.abinit.powerups import update_factory_kwargs, update_user_abinit_settings
2423
from atomate2.abinit.sets.core import ShgStaticSetGenerator, StaticSetGenerator
2524

2625
if TYPE_CHECKING:
@@ -223,6 +222,9 @@ class ShgFlowMaker(DfptFlowMaker):
223222
"""
224223
Maker to compute the static DFPT second-harmonic generation tensor.
225224
225+
Maker to compute the electronic contribution to the
226+
static DFPT second-harmonic generation tensor.
227+
226228
Parameters
227229
----------
228230
name : str
@@ -237,7 +239,6 @@ class ShgFlowMaker(DfptFlowMaker):
237239
static_maker: BaseAbinitMaker = field(
238240
default_factory=lambda: StaticMaker(input_set_generator=ShgStaticSetGenerator())
239241
)
240-
scissor: float | None = None
241242

242243
def make(
243244
self,
@@ -259,18 +260,43 @@ def make(
259260
Flow
260261
A DFPT flow
261262
"""
262-
shg_flow = super().make(structure=structure, restart_from=restart_from)
263+
return super().make(structure=structure, restart_from=restart_from)
263264

264-
if self.scissor:
265-
shg_flow = update_user_abinit_settings(
266-
shg_flow,
267-
{"dfpt_sciss": self.scissor * abu.eV_Ha},
268-
name_filter="Scf calculation",
269-
)
270-
shg_flow = update_factory_kwargs(
271-
shg_flow,
272-
{"nbdbuf": 0},
273-
name_filter="Scf calculation",
274-
)
265+
@classmethod
266+
def with_scissor(cls, scissor: float) -> ShgFlowMaker:
267+
"""
268+
Create a DFPT Flow to compute the static SHG tensor with a scissor correction.
269+
270+
Create a DFPT Flow to compute the electronic contribution
271+
to the static SHG tensor with a scissor correction.
272+
273+
Parameters
274+
----------
275+
scissor : float
276+
The scissor-correction to the band gap in eV.
275277
276-
return shg_flow
278+
Returns
279+
-------
280+
Flow
281+
An ShgFlowMaker Flow
282+
"""
283+
return cls(
284+
static_maker=StaticMaker(
285+
input_set_generator=ShgStaticSetGenerator(
286+
user_abinit_settings={
287+
"nstep": 500,
288+
"toldfe": 1e-22,
289+
"autoparal": 1,
290+
"npfft": 1,
291+
"dfpt_sciss": scissor * abu.eV_Ha,
292+
},
293+
factory_kwargs={
294+
"smearing": "nosmearing",
295+
"spin_mode": "unpolarized",
296+
"kppa": 3000,
297+
"nbdbuf": 0,
298+
},
299+
)
300+
),
301+
name="DFPT Chi2 SHG with scissor",
302+
)

0 commit comments

Comments
 (0)