aiidateam / aiida-workgraph

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, and remote execution capabilities.
https://aiida-workgraph.readthedocs.io/en/latest/
MIT License
10 stars 5 forks source link

the identifier of the output type `aiida.orm.StructureData` is not 'workgraph.aiida_structuredata` but `StructureData` #355

Open rikigigi opened 5 days ago

rikigigi commented 5 days ago
@aiida_workgraph.task.calcfunction(outputs=[{'name': 'start_structure','identifier':aiida.orm.StructureData},{'name': 'start_velocities_A_au'}])
def get_structure_and_velocities(trajectory_or_structure : aiida.orm.TrajectoryData|aiida.orm.StructureData):
    outputs={
        'start_structure':trajectory_or_structure.get_step_structure(trajectory_or_structure.numsteps-1) if isinstance(trajectory_or_structure,aiida.orm.TrajectoryData) else trajectory_or_structure,
        'start_velocities_A_au':trajectory_or_structure.get_step_data(trajectory_or_structure.numsteps -1)['velocities'] if isinstance(trajectory_or_structure,aiida.orm.TrajectoryData) and 'velocities' in trajectory_or_structure.get_arraynames() else None
    }

# other lines omitted [....] 

struct_velocities = wg.add_task(get_structure_and_velocities, name=f'get_structure_and_velocities_{name}',
                        trajectory_or_structure=link_from.outputs['output_trajectory'])
print(struct_velocities.outputs['start_structure'].identifier)

the identifier of the output type aiida.orm.StructureData is not workgraph.aiida_structuredata but StructureData

the solution is to manually specify workgraph.aiida_structuredata as identifier, but this should be handled automatically

using last git main