pyiron / pyiron_atomistics

pyiron_atomistics - an integrated development environment (IDE) for atomistic simulation in computational materials science.
https://pyiron-atomistics.readthedocs.io
BSD 3-Clause "New" or "Revised" License
44 stars 15 forks source link

Lammps: fix species for atomstyle charge #1360

Closed jan-janssen closed 7 months ago

jan-janssen commented 7 months ago

@Leimeroth I gave it a first try, but unfortunately I do not have an example to test this. Can you provide a test for this function?

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 8384624071

Details


Totals Coverage Status
Change from base Build 8345641982: 0.002%
Covered Lines: 14214
Relevant Lines: 15255

💛 - Coveralls
Leimeroth commented 7 months ago

This correctly orders the elements which are actually present in the structure. However, when using atom_style charge no species can be set in the potential, which are not actually present in the structure, because the wrong number of atoms is written to structure.inp than:

Start File for LAMMPS
9 atoms
2 atom types

0. 4.921000003800000 xlo xhi
0. 4.261711015300000 ylo yhi
0. 5.400000095400000 zlo zhi
2.460500001800000 0E-15 0E-15 xy xz yz

Masses

  1 28.085000
  2 15.999000
  3 1.000000

Also the mass of C is not correct. Without atom_style charge it sets the correct N atom types and masses and than just never assigns the type. This brings me back to the question why there are so many different structure writing functions that all use different ways of ordering? I think extracting the ordering functionality from the well tested atom style atomic writer into a separate function that is used by all writes would be the best option

Leimeroth commented 7 months ago

I drafted a version refactoring the sorting in #1361. This is only working for charge and atom styles right now, because I am not sure how it works for bond and full styles.

jan-janssen commented 7 months ago

Also the mass of C is not correct.

Atoms which are not used in the simulation cell but defined in the potential are set to 1.0. In this case there are no C atoms in the simulation cell, correct?