pyiron / FAQs

General question board for pyiron users
3 stars 0 forks source link

How to use `input/structure` from another project #59

Open aageo25 opened 1 month ago

aageo25 commented 1 month ago

I would like to use the input structure of a job in pr2 into newjob. The idea is to use tags that were previously assigned to a Pyiron structure.

What I tried to do was collect the structure via pr2.inspect('singlepoint')['input/structure']. I tried the following:

It would be optimal for me if I could convert the structure into an ASE's Atoms object since I will systematically modify the simulation cell in a series of jobs.

Thank you in advance.

jan-janssen commented 1 month ago
pyiron_to_ase(pr2.inspect('singlepoint')['input/structure'].to_object())
aageo25 commented 1 month ago

A word of warning. arrays/tags are not included when a structure is converted into an object, i.e., calling to_object(). My workaround was assigning the tag again:

simcell = pyiron_to_ase(
    proj['simcell'].inspect('singlepoint')['input/structure'].to_object())

seldyn = proj['simcell'].inspect(
    'singlepoint')['input/structure/tags/selective_dynamics']

simcell.set_array(
    'selective_dynamics', np.array(seldyn)
)