What's the ordering of "dynamical_matrix" command computes dynamical matrixs

Hi,
I am using the code below the attachment by “dynamical_matrix” command for computes the dynamical matrix. Which for harmonic vibrational frequencies and modes by diagonalizing the dynamical matrix.
I got some problems about that:

  1. The result of the calculation is sorted according to what exactly, the atom pairs are sorted according to the atom global atom id, that is, the atom id of the data in “read_data”?
    Or is it sorted by the atom number that is mapped to the local atom id after turning on “atom_modify map yes” by command (If it is, where can i get the map information for the local atom id corresponding global id)?
  2. The matrix calculated using the code in my attachment is a sparse matrix, i.e. most of the elements are 0. I’m not sure if this is accurate, as I suspect I’m having problems adjusting the unit conversions.
    It is not possible to use the atom pair type directly in dynamical_matrix.cpp for calculating lj. So I made an adjustment to line 517. I’m not sure what principle this adjustment should be based on, so hopefully for getting some guidance.

Thanks very much for your patience.

AQS_attachment.in (5.1 KB)

The dynamical matrix has atoms indexed by their global index (atom ID).
In fact, it is processing atoms in the order of their global index and then computing the matrix elements one by one.

It makes no sense at all to do the dynamical matrix calculation in reduced units and to expect to recover values in real units. So rather than converting your parameters first into reduced units and then converting the results back, you can just use real units right away and thus avoid many possible errors resulting from incorrect conversions or incorrect interpretation of how LAMMPS defines reduced units. I consider changing the source code to make this work a bad idea and will not spent an iota of effort even to try figuring out what kind of changes you have to make. Your input example is far too complex and convoluted to make sense of it and part of that is that you are converting parameters to reduced units, which I consider a mistake in the first place.

Thank you for your reply.
The unit conversion in input file is for post-processing conveniently. But i don’t know the conversion has effect on the dynamical matrix calculation. I thought the calculation of dynamical matrix is only about the distance and the interatomic potential energy.
I am sorry that i didn’t understand your suggestion exactly. Because the LJ unit is not work in the source code. So your advice is using real unit in my calculation instead of LJ unit. I need to convert the LJ unit to real unit first and use real unit in my calculation.

Your input suggests that your reduced unit parameters are derived from real units. So, for the most part all you need to do is to undo that conversion. That should be trivial.
In general, I find it extremely confusing how much effort people spend on performing calculations in reduced units and then want to convert this back to some specific unit set for a specific material. That just flies in the face of the purpose of reduced units, which is to have a generic result that is not mapped to a specific compound.

If you don’t understand this reasoning, that is fine with me, but that also means that I cannot help you (and do not want to since in my mind this is rather a waste of effort).

Again, thank you sincerely for your response and apologize for my ignorance.
I understand what you mean, I did the unit conversion on doing extra useless work, such as converting units from real unit to reduced unit for calculations, and then reconverting the results back to real unit. Thank you for pointing out this redundancy.

So all I need to do is just delete all the unit conversions and just calculate using real unit, but at the same time I need to convert the unit in the potential table to real unit (which is in reduced unit), am I right?