Skip to content

Commit

Permalink
Fix testing
Browse files Browse the repository at this point in the history
Added Alvin comments
  • Loading branch information
JosePizarro3 committed Jan 17, 2024
1 parent 4321e24 commit 1c05f0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 34 deletions.
35 changes: 7 additions & 28 deletions simulationworkflowschema/general.py
Expand Up @@ -385,40 +385,19 @@ def normalize(self, archive, logger):
return

# We extract the workflow name from the tasks names
workflow_name = []
for task in self.tasks:
workflow_name.append(task.name)
self.name = "+".join(workflow_name)
if self.name != self.m_def.name.replace("Plus", "+"):
logger.warning(
"Joining tasks names does not match workflow name from class definition."
)

self.name = "+".join([task.name for task in self.tasks if task.name])
task_map = {
task.name.lower(): self.tasks[n] for n, task in enumerate(self.tasks)
}
# Resolve workflow2.results for each standard BeyondDFT workflow
if self.name == "DFT+GW":
task_map = {
"dft": self.tasks[0],
"gw": self.tasks[1],
}
self.get_electronic_structure_workflow_results(task_map)
elif self.name == "DFT+TB+DMFT":
# TODO extend for DFT tasks
task_map = {
"tb": self.tasks[0],
"dmft": self.tasks[1],
}
elif self.name == "TB+DMFT": # TODO extend for DFT tasks
self.get_electronic_structure_workflow_results(task_map)
elif self.name == "DMFT+MaxEnt":
task_map = {
"dmft": self.tasks[0],
"maxent": self.tasks[1],
}
self.get_electronic_structure_workflow_results(task_map)
elif self.name == "First Principles+TB":
task_map = {
"first_principles": self.tasks[0],
"tb": self.tasks[1],
}
elif self.name == "FirstPrinciples+TB":
task_map["first_principles"] = task_map.pop("firstprinciples")
self.get_electronic_structure_workflow_results(task_map)


Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Expand Up @@ -558,7 +558,7 @@ def get_template_dmft_workflow() -> EntryArchive:
run_normalize(archive_dmft)
# Defining Projection and DMFT tasks for later the DMFT workflow
task_proj = TaskReference(task=archive_tb.workflow2)
task_proj.name = "Projection"
task_proj.name = "TB"
task_proj.inputs = [
Link(name="Input structure", section=archive_tb.run[-1].system[-1])
]
Expand Down Expand Up @@ -623,15 +623,15 @@ def get_template_maxent_workflow() -> EntryArchive:
)
]
task_maxent = TaskReference(task=archive_dmft.workflow2)
task_maxent.name = "MaxEnt Sigma"
task_maxent.name = "MaxEnt"
task_maxent.inputs = [
Link(
name="Output DMFT calculation", section=archive_dmft.run[-1].calculation[-1]
)
]
task_maxent.outputs = [
Link(
name="Output MaxEnt Sigma calculation",
name="Output MaxEnt calculation",
section=archive_maxent.run[-1].calculation[-1],
)
]
Expand All @@ -655,7 +655,7 @@ def get_template_maxent_workflow() -> EntryArchive:
)
outputs = [
Link(
name="Output MaxEnt Sigma calculation",
name="Output MaxEnt calculation",
section=archive_dmft.run[-1].calculation[-1],
),
Link(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_simulationworkflowschema.py
Expand Up @@ -94,7 +94,7 @@ def test_gw_workflow(gw_workflow):
def test_dmft_workflow(dmft_workflow):
"""Testing DMFT workflow entry"""
workflow = dmft_workflow.workflow2
assert workflow.name == "DFT+TB+DMFT"
assert workflow.name == "TB+DMFT"
assert not workflow.method.tb_method_ref.wannier.is_maximally_localized
assert workflow.method.dmft_method_ref.n_impurities == 1
assert workflow.method.dmft_method_ref.n_correlated_orbitals[0] == 3
Expand All @@ -104,7 +104,7 @@ def test_dmft_workflow(dmft_workflow):
assert workflow.method.dmft_method_ref.impurity_solver == "CT-HYB"
results = dmft_workflow.results
assert results.method.method_name == "DMFT"
assert results.method.workflow_name == "DFT+TB+DMFT"
assert results.method.workflow_name == "TB+DMFT"
assert results.method.simulation.program_name == "w2dynamics"
assert results.method.simulation.dmft.impurity_solver_type == "CT-HYB"
assert results.method.simulation.dmft.inverse_temperature.magnitude == 60.0
Expand Down

0 comments on commit 1c05f0a

Please sign in to comment.