mzkhalid039 / DWBuilder

Ferroelectric/Ferroelastic domain wall builder
https://github.com/mzkhalid039/DWBuilder
MIT License
16 stars 2 forks source link

The number of atoms that are inconsistent #3

Closed MoseyQAQ closed 2 weeks ago

MoseyQAQ commented 3 weeks ago

Hi!

I am trying to use dwbuilder to build a 180-degree domain wall in PbTiO3. However, I noticed some issues in the following file: examples/P4mm/PbO/P4mm_T180/T180_domain1.vasp.

  1. The number of atoms seems inconsistent with the expected stoichiometry for perovskite oxides (ABO3): https://github.com/mzkhalid039/DWBuilder/blob/37dbf89dda3cbb9c9f80a6746bd14d9c8426a44a/examples/P4mm/PbO/P4mm_T180/T180_domain1.vasp#L6-L7

  2. It appears that some atoms are overlapping, which suggests the remove_close_atoms function may not be working as intended: https://github.com/mzkhalid039/DWBuilder/blob/37dbf89dda3cbb9c9f80a6746bd14d9c8426a44a/examples/P4mm/PbO/P4mm_T180/T180_domain1.vasp#L31-L32

Could you please take a look into this? Thank you!

mzkhalid039 commented 2 weeks ago

Hi,

Thank you for identifying this issue. The original implementation of the remove_close_atoms function did not account for periodic boundary conditions, leading to incorrect removal of atoms and producing non-stoichiometric domains.

This update improves the function by using the minimum image convention (MIC) to correctly handle periodic boundary conditions. The issue has now been fixed.

MoseyQAQ commented 2 weeks ago

Thanks!