LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] How to wrap atoms into simulation box with read_data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] How to wrap atoms into simulation box with read_data

From: Axel Kohlmeyer <akohlmey@...24...>
Date: Tue, 14 Nov 2017 00:34:12 -0500

On Mon, Nov 13, 2017 at 9:44 PM, Andrew Gibbons <agibbons@...7214...32...> wrote:

I have a script that generates molecule files that can be read into LAMMPS using read_data. My problem is that this file can generate molecules that lie outside of the simulation box. When reading into a periodic boundary system this is not a problem, but trying to read into a fixed boundary box causes an error. What is the best way to reposition the atoms when reading the data file?

​this is a bug in your script. if atoms are outside the box with fixed boundaries, then either your script is not properly checking where atoms are placed or your box dimensions are incorrect.
LAMMPS does the only meaningful thing and discards atoms that are outside the box. after all, *you* request the box dimensions.​

Here the relevant part of the LAMMPS script:

    # Initialization
    units        real
    boundary    f f f
    atom_style    molecular
    log         log.${simname}.txt
    read_data    ${fname}

This causes an error as the atoms are outside of the box defined in the atom data file.

I found a way around this, basically I change the atom images and box boundary conditions after loading the data file.

    # Initialization
    units        real
    boundary    p p p
    atom_style    molecular
    log         log.${simname}.txt
    read_data    ${fname}
    set atom * image 0 0 0
    change_box all boundary f f f

But I was wondering is a better way?

​what if part of a molecule is outside the box? with this "hack" different parts of the same molecule will end up on different ends of ​the box.

fix your script to produce valid data files and there are no problems.




Check out the vibrant tech community on one of the world's most
engaging tech sites,!
lammps-users mailing list

Dr. Axel Kohlmeyer  akohlmey@...92......
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.