Skip to content

Commit

Permalink
add hooks for global settings
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Oct 20, 2020
1 parent b102c6d commit 61d03f0
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions emmet-core/emmet/core/vasp/material.py
Expand Up @@ -39,7 +39,12 @@ class MaterialsDoc(CoreMaterialsDoc, StructureMetadata):
)

@classmethod
def from_tasks(cls, task_group: List[TaskDocument]) -> "MaterialsDoc":
def from_tasks(
cls,
task_group: List[TaskDocument],
quality_scores=SETTINGS.VASP_QUALITY_SCORES,
special_tags=SETTINGS.VASP_SPECIAL_TAGS,
) -> "MaterialsDoc":
"""
Converts a group of tasks into one material
"""
Expand Down Expand Up @@ -82,24 +87,17 @@ def _structure_eval(task: TaskDocument):
- Special Tags
- Energy
"""
qual_score = SETTINGS.VASP_QUALITY_SCORES

ispin = task.input.parameters.get("ISPIN", 1)
energy = task.output.energy_per_atom
task_run_type = task.run_type
special_tags = [
task.input.parameters.get(tag, False)
for tag in SETTINGS.VASP_SPECIAL_TAGS
]

is_valid = task.task_id in deprecated_tasks

return (
-1 * is_valid,
-1 * qual_score.get(task_run_type.value, 0),
-1 * ispin,
-1 * sum(special_tags),
energy,
-1 * quality_scores.get(task_run_type.value, 0),
-1 * task.input.parameters.get("ISPIN", 1),
-1 * sum(task.input.parameters.get(tag, False) for tag in special_tags),
task.output.energy_per_atom,
)

structure_calcs = structure_optimizations + statics
Expand Down

0 comments on commit 61d03f0

Please sign in to comment.