pyiron / FAQs

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

Creating a Lammps Data file from pyiron output #72

Open LAPikachu opened 3 months ago

LAPikachu commented 3 months ago

How can I write the output of a pyiron minimization job to a lammp data file.

I tried the following:
from ase.io.lammpsdata import write_lammps_data
write_lammps_data('datafile.lmp', pyiron_job['output/structure'].to_object())

this did create a lammps data file, however it was missing the masses section

trying
write_lammps_data('datafile.lmp', pyiron_job['output/structure'].to_object()), masses = True
resulted in the error
write_lammps_data() got an unexpected keyword argument 'masses'
is there a pyiron specific function to obtain a complete lammps data file; which in the best case would look like the structure.inp file created in the *_hdf5/ directory adjacent to the respective job.

jan-janssen commented 3 months ago

Which version of ASE are you using? In 3.23.0 the masses keyword is implemented: https://gitlab.com/ase/ase/-/blob/3.23.0/ase/io/lammpsdata.py?ref_type=tags#L382 In 3.22.1 it is not: https://gitlab.com/ase/ase/-/blob/3.22.1/ase/io/lammpsdata.py?ref_type=tags#L406

LAPikachu commented 3 months ago

I am using the jupyter server on the cmti cluster, which is running 3.22.1 as far as I can see. Thank you for pointing this out.

jan-janssen commented 3 months ago

The conda environment in https://github.com/pyiron/docker-stacks/releases/tag/2024-08-05 already contains the latest version. I assume that this is also the version on the cluster. Which kernel do you use? It should be pyiron/latest. Maybe @niklassiemer can help.

niklassiemer commented 3 months ago

Just run

import sys
print(sys.prefix)

and report the outcome. That one should point to a conda env with the corresponding date.

LAPikachu commented 3 months ago

@niklassiemer Hmm, this is weird. When I choose the kernel: pyiron/latest (Python3.11)
it reports: /cmmc/ptmp/pyironhb/mambaforge/envs/pyiron_mpie_cmti_2024-07-01 when I choose: pyiron/08-05-2024 (python3.11)
it switches to the newer env: /cmmc/ptmp/pyironhb/mambaforge/envs/pyiron_mpie_cmti_2024-08-05
Does "latest" fall back to the last stable version?

LAPikachu commented 3 months ago

But thank you anyway :) I will use the newer Kernel for using the 'write_lammps_data' function

niklassiemer commented 3 months ago

That is weird indeed! Could you try to restart your Jupyterhub server if possible without problems on your work? I have the suspicion that this will update the latest kernel in your case... i.e. that the auto-update of latest is not properly working 😑

LAPikachu commented 3 months ago

@niklassiemer Yes - you were right. Restarting the server did the trick!

niklassiemer commented 3 months ago

Thanks for testing. I think I know how to fix this 🙃