import mlipx
import zntrack

from models import MODELS

project = zntrack.Project()

frames = []
{% if datapath %}
with project.group("initialize"):
    for path in {{ datapath }}:
        frames.append(mlipx.LoadDataFile(path=path))
{% endif %}{% if material_ids %}
with project.group("initialize"):
    for material_id in {{ material_ids }}:
        frames.append(mlipx.MPRester(search_kwargs={"material_ids": [material_id]}))
{% endif %}{% if smiles %}
with project.group("initialize"):
    for smiles in {{ smiles }}:
        frames.append(mlipx.Smiles2Conformers(smiles=smiles, num_confs=1))
{% endif %}

for model_name, model in MODELS.items():
    with project.group(model_name):
        phon = mlipx.VibrationalAnalysis(
            data=sum([x.frames for x in frames], []),
            model=model,
            temperature=298.15,
            displacement=0.015,
            nfree=4,
            lower_freq_threshold=12,
        )


project.build()
