From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Jul 13 2021 - 15:31:04 CDT

You see a difference because of the differences in the data models in VMD
and LAMMPS.
While atom types are numeric in LAMMPS they are strings in VMD. This is no
problem when reading, since numbers are also valid strings, but creates a
problem on writing, since not all strings are valid numbers. Upon writing
the molfile API will pass references to the strings to the plugin for
writing LAMMPS files and that creates a hash table for those strings to map
them back to numeric types in the order they are encountered. This is where
things can become inconsistent.
To change this behavior you would have to change the C code of the LAMMPS
molfile plugin to:
- verify that all atom types are strings of integer numbers
- have an alternate code path that instead of creating a 1-based map of
unique strings used for atom types will use an atoi() call to convert the
string to a number provided the check passes.

This is doable but would require some programming.

Axel.

On Tue, Jul 13, 2021 at 10:04 AM Yann Claveau <yann.claveau_at_univ-rennes1.fr>
wrote:

> Hi all,
>
> I want to unwrap lammps trajectories. I opened the dump.lammpstrj in vmd,
> then did
>
> pbc unwrap -all
>
> It worked. Then I saved the new coordinates. When opening the new file,
> all types have been renamed.
>
> for instance in the dump.wrapped.lammpstrj : 0 = 1, H =2, Si = 3
>
> while in the dump.unwrapped.lammpstrj : Si = 1, O = 2, H = 3.
>
> The problem is that I use MDAnalysis that needs the *.data file too. It
> would be troublesome if the types in the data file are not the same as in
> the dump.
>
> Is there a way to force vmd to keep the same atom types when saving the
> new coordinates ?
>
> Thanks,
>
> --
> Yann claveau, PhD
> Département Matériaux-Nanosciences
> Bât. 11A, bureau 122,
> Campus de Beaulieu
> Institut de Physique de Rennes - UMR-CNRS 6251
> Université de Rennes 1
> 35042 Rennes cedex FRANCE
>
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  https://urldefense.com/v3/__http://goo.gl/1wk0__;!!DZ3fjg!tPc0n_Xa3RGReP0_lWA7WmqcuTwSPP0Q4A2LNs5pOu59ovrwAmhFevKxm8Yk175ozg$ 
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.