Querying from attributes

Hello!

I have a small question. I’m trying to query for the structures which contains a given element. I’m able to write a query that is something like this

qb = orm.QueryBuilder()
qb.append(
     orm.StructureData,
     filters={
         'attributes.kinds.0.symbols': {'contains': ['Si']}
     }
)

This means that I can check if the first kind has Si, but is there a way to generalize it for it to check in any symbol?

1 Like

I have seen the answer about alloys-by-elements. And that might work, I do wonder however, if there is a way of just checking by the symbols, as not having to worry about the kind object itself.

Hi @JPchico! Unfortunately, I think the (rather cumbersome) kind solution is the best I can think of at the moment. We’ve been working on a new StructureData type though (mostly to be able to add properties), and there I would simply add the formula (or chemical system) to the attributes directly in some fashion.

A workaround I’ve been using to keep my life simple is writing a loop that checks if the formula is in the extras for all StructureData, and adding it in case it isn’t. This is not a very satisfying solution however, since newly created StructureData won’t have these extras.

Hi @mbercx ! Sorry for the late reply I must have missed this notification.

No worries I understand, I was just wondering if there was a better way. I normally do store the formula in the extras, but I have to relabel nodes for exactly the reason that you are mentioning, new nodes do not have those extras.

But that is no problem :slight_smile: will keep doing it that way

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.