pyiron / FAQs

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

How to read a custom LAMMPS potential file #53

Open aageo25 opened 3 months ago

aageo25 commented 3 months ago

I want to use a potential file that I've made small changes to and stored in my project folder.

Is there a function in pyrion to read the potential file that job.potential can receive?

The job wasc created with pr.create_job(jobtype=pr.job_type.Lammps)

jan-janssen commented 3 months ago

https://pyiron.readthedocs.io/en/latest/source/faq.html#how-to-use-a-custom-potential-in-lammps

aageo25 commented 3 months ago

https://pyiron.readthedocs.io/en/latest/source/faq.html#how-to-use-a-custom-potential-in-lammps

So, if I understood correctly, I have to manually create the DataFrame with the customized potential.

Would it be possible to extract this information from the file in the in the LAMMPS setfl format?

Here is how the file looks like: https://github.com/mrkllntschpp/lammps-tutorials/blob/master/Al99.eam.alloy

aageo25 commented 3 months ago

Hej.

Thanks to the Q&A session on Friday, I managed to do what I wanted. For my case, setting-up the Config column was easier than the one from the page @jan-janssen suggested. Here is my code snippet:

filename = '/path/to/file/ni_h.eam.alloy'

potential = pd.DataFrame({
  'Name': ['ni_h_rcut4.90_rcut2.eam.alloy'],
  'Filename': [[]],
  'Model': ['eam'],
  'Species': [['Ni', 'H']],
  'Config': [['pair_style eam/alloy\n', # Pair style hele follows the convention of the file I read in pair_coeff
              f'pair_coeff * * {filename} Ni H\n']]
})
samwaseda commented 3 months ago

The one @jan-janssen suggested was a fairly complete one used by a former colleague of ours. I think for heavy Lammps users it somewhat makes sense but it's true that maybe we should update it to the needs of most of the people who don't require such a complex input.