Dear aiida developpers or users,
I have a problem which I assume is related to my yet-too-poor understanding of the database query concepts.
I am trying to search for structures that have been created with a certain calcfunction called
'create_structure_and_info_from_cif' AND have then been used as an input to a certain relaxation workchain called
'MyRelaxWorkChain'.
I understand how to find matches to the first condition :
qb1 = QueryBuilder()
qb1.append(cls=CalcFunctionNode,
filters={
'attributes.function_name' : 'create_structure_and_info_from_cif',
'attributes.exit_status' : 0,
},
tag='Structure_creation_nodes'
)
qb1.append(cls=StructureData,
with_incoming='Structure_creation_nodes',
tag='Structures_created_from_cif'
)
But so far the best way to match the second condition I have found is to proceed along the graph and then back to the structures as follows :
# Get '
MyRelaxWorkChain's processes run from the above structures
qb1.append(cls=WorkChainNode,
filters={
'attributes.process_label' : MyRelaxWorkChain',
'attributes.process_state' : 'finished',
},
with_incoming='Structures_created_from_cif',
tag='my_relax_workchain_nodes',
)
# Go back to the input structures
qb1.append(cls=StructureData,
with_outgoing='
my_relax_workchain
_nodes',
tag='Structures_created_from_cif_and_relaxed',
project=['*','id','uuid'],
)
This works but seems unnecessarily complicated to me. What I am looking for is simplyn an inner_join of two queries :
- structures with an incoming 'create_structure_and_info_from_cif' calcfunction
-
structures with an outgoing 'MyRelaxWorkChain'
I tried to set both 'with_incoming' and 'with_outgoing' in my StructureData query but it does not seem to be possible.
Can someone help me figure out how to do this in a more clever manner ?
Thank you very much.
Sylvian.