Lattice mapping to region patch 01feb2019 vs. the 2007 version.

Hi Lammps users,

I have been using lammps version 2007 for a while now and recently updated to the newest version 01feb2019. But there seem to be a change in how Lammps does the mapping of a lattice to a region?

I am trying to map a fcc lattice rotated 45 degree about the z-axis to a cubic region. In the 2007 version of Lammps the rotated lattice fills the entire region, but in the newest version only a thin “slap” of the region is by the lattice. I have tried to illustrate the problem in the attached drawing.

The relevant part of the input file is:

units metal
dimension 3
boundary s s s
atom_style atomic
variable latconst equal 3.615

lattice fcc {latconst} region cube block 0 10 0 10 0 10 create_box 3 cube lattice fcc {latconst} orient x 1 1 0 orient y -1 1 0 orient z 0 0 1
create_atoms 1 region cube

Kind regards,
Anders Vesti

lammps_issue.png

Hi Lammps users,

I have been using lammps version 2007 for a while now and recently updated to the newest version 01feb2019. But there seem to be a change in how Lammps does the mapping of a lattice to a region?

well, there obviously is a change, but it is not intentional. it is an
undesired side effect to an optimization that was added recently and
thus it is a bug.
you can turn off that optimization by making the following small change:

$ git diff
diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp
index 83175b9..5eeff11 100644
--- a/src/create_atoms.cpp
+++ b/src/create_atoms.cpp
@@ -729,7 +729,7 @@ void CreateAtoms::add_lattice()

   // narrow down min/max further by extent of the region, if possible

- if ((style == REGION) && domain->regions[nregion]->bboxflag) {
+ if (0 && (style == REGION) && domain->regions[nregion]->bboxflag) {
     double rxmin = domain->regions[nregion]->extent_xlo;
     double rxmax = domain->regions[nregion]->extent_xhi;
     double rymin = domain->regions[nregion]->extent_ylo;

axel.

anders,

there is now a new patch release of LAMMPS available here
https://github.com/lammps/lammps/releases/tag/patch_8Feb2018 that has
the buggy code removed and should be used instead of the 1Feb2019
version.

axel.

Thank you very much for the quick response. I will check it out.

best regards
Anders