Hi all,

I’m facing a weird problem with a custom oriented lattice. Following is a portion of my input file:

variable a equal 4.1

variable dx equal sqrt(1+1+0)

variable dy equal sqrt(1+1+1)

variable dz equal sqrt(1+1+4)

variable xmax equal 2*a*{dx}

variable ymax equal 2*a*{dy}

variable zmax equal 2*a*{dz}

lattice fcc a orient x 1 -1 0 orient y 1 1 1 orient z -1 -1 2 spacing {dx} {dy} {dz}

region whole block -{xmax} {xmax} -{ymax} {ymax} -{zmax} {zmax} units box

create_box 1 whole

create_atoms 1 region whole

If I define the region as mentioned above, i.e. from -x to +x, -y to +y, and -z to +z, I don’t face any problem. The calculation runs smoothly and it gives the correct lattice parameter, energy, and structure.

But, if I modify the code as follows (only modified portion presented):

variable xmax equal 4*a*{dx}

variable ymax equal 4*a*{dy}

variable zmax equal 4*a*{dz}

lattice fcc a orient x 1 -1 0 orient y 1 1 1 orient z -1 -1 2 spacing {dx} {dy} {dz}

region whole block 0 {xmax} 0 {ymax} 0 ${zmax} units box

Here, instead of spanning the region from -x to x, -y to y, and -z to z, I allow the region to span from 0 to 2x, 0 to 2y, 0 to 2z.

Interestingly, this code outputs a wrong structure, with wrong lattice parameters and energy values.

According to my understanding, both the conditions should give the same result. I do not understand why this is happening.

Can someone please explain as to why is this happening?

Thanks and regards,

Subham

Hi all,

I'm facing a weird problem with a custom oriented lattice. Following is a

portion of my input file:

variable a equal 4.1

variable dx equal sqrt(1+1+0)

variable dy equal sqrt(1+1+1)

variable dz equal sqrt(1+1+4)

variable xmax equal 2*a\*{dx}

variable ymax equal 2*a\*{dy}

variable zmax equal 2*a\*{dz}

lattice fcc a orient x 1 \-1 0 orient y 1 1 1 orient z \-1 \-1 2
spacing {dx} \{dy\} {dz}

region whole block -\{xmax\} {xmax} -\{ymax\} {ymax} -\{zmax\}
{zmax} units box

create_box 1 whole

create_atoms 1 region whole

If I define the region as mentioned above, i.e. from -x to +x, -y to +y,

and -z to +z, I don't face any problem. The calculation runs smoothly and

it gives the correct lattice parameter, energy, and structure.

But, if I modify the code as follows (only modified portion presented):

variable xmax equal 4*a\*{dx}

variable ymax equal 4*a\*{dy}

variable zmax equal 4*a\*{dz}

lattice fcc a orient x 1 \-1 0 orient y 1 1 1 orient z \-1 \-1 2
spacing {dx} \{dy\} {dz}

region whole block 0 \{xmax\} 0 {ymax} 0 ${zmax} units box

Here, instead of spanning the region from -x to x, -y to y, and -z to z, I

allow the region to span from 0 to 2x, 0 to 2y, 0 to 2z.

Interestingly, this code outputs a wrong structure, with wrong lattice

parameters and energy values.

According to my understanding, both the conditions should give the same

result. I do not understand why this is happening.

Can someone please explain as to why is this happening?

have you checked for correct periodic continuation of the lattice and for

overlapping atoms?

when you generate your box so that it coincides *exactly* with the lattice

points on which atoms are created, you put yourself at the mercy of the

inexact nature of floating point math.

check out these blog posts for more insight on that:

http://blog.reverberate.org/2014/09/what-every-computer-programmer-should.html

http://blog.reverberate.org/2016/02/06/floating-point-demystified-part2.html

the best way to deal with these issues is to shift your box by 0.1 unit, so

that the ambiguity is removed.

axel.

Thanks sir for the information.

I’d checked for periodic continuation, which wasn’t correct in the second case. Hence, I thought it had something to do with floating points - which you mentioned.

Changing the box by 0.1 units did the job. Although the number of atoms, energy, and structure are consistent now, lattice parameters along the three orthogonal directions are not same i.e. a=4.0535, b=4.0503, and c=4.0462. For the first case, lattice parameter is same everywhere, 4.05 i.e.

Can you please tell what I might be doing wrong?

Thanks again,

Subham