Forum Navigation
You need to log in to create posts and topics.

Add a new particle type to a loaded Lammps data file in Ovito GUI

Hello,

I have a Lammps data file with one particle type and the bond info among this type of particles. After loading this data file, I would like to add a trajectory (Lammps dump) which contains a new particle type (type 2) in addition to the type 1 I have already defined via  data file. How can I tell Ovito that this new trajectory has a new particle type that should be added to the visualization? Can I do it before loading the trajectory? or I need to first load the trajectory and then add the new particle type?

I am looking for a GUI option not a Python one.

I use version 2.9 (basic).

Thanks in advance for your help.

Amir

Hello Amir,

In that case I think it's easiest if you send me some example data (either upload it here or contact us through the official mail support), then it's easier for me to help.

-Constanze

Dear Constanze,

Please find the example data attached.

This is actually what I want to do: 1. Open the lammps data file which contains the topology information for particle type one. 2. Add all the trajectory files (more than 10 with style xxx.j*.XXX - consecutive naming) that all together compose the whole simulation (due to the largeness of the whole simulation file I chunked it to more than 10 smaller files which I want to read in all together) - The trajectory files contains the coordinates of type one and type two particles. while type one has the topology defined in the data file, type two particles are simply rigid spheres.

Thanks for you help.

Uploaded files:

Thanks for uploading the files, Amir. Usually the procedure would be that you import the lammps data file and then use a Load Trajectory Modifier to add the trajectory files (simply activate the option "auto-generate" below File-sequence -> Search pattern in the modifier settings panel. OVITO will find all trajectory files and automatically combine them for you.

I can see that the Load Trajectory Modifier has a problem with particles id > 2000 missing from the topology file and then only displays the first 2000 atoms (all particle type 1).

We will look into this further, but as a quick workaround for OVITO 3, you can execute the following python script in the GUI (click on File -> run python script in the program menu) or use the scripting interface ovitos.
What this script does is load the lammps data file and adds dummy particles for the missing particle type 2 particles and then exports it as a new data file.

from ovito.data import *
from ovito.io import import_file, export_file

pipeline = import_file("chain.2000.data", atom_style = "bond")


def create_dummy_particles(frame, data):
    
  for i in range(2001, 38585):
      data.particles_.create_particle((0,0,0))
  data.particles_.particle_type[2000:] = 2
  data.particles_.identifiers[2000:] = range(2001, 38585)

pipeline.modifiers.append(create_dummy_particles)

export_file(pipeline, "chain.2000-2.data",  "lammps/data", atom_style = "bond")

Now you can import this new data file in the GUI as usual and then use the Load Trajectory Modifier to add your trajectory as described above.

I'm wondering though if it might be easiest to add a write_data statement at the beginning of your lammps script instead? Then you could export a topology file with all particles.

Just a short update: Alex has extended the Load Trajectory Modifier in the next versions of OVITO Basic and Pro, such that it can deal with trajectory files that contain more particles than the topology file. You thus won't need the above described workaround.

The new program version, OVITO 3.2.1, was made available today. The updated Load Trajectory modifier now adds any excess particles to the system that it finds in the trajectory dataset. Let us know if you experience any problems.