pierrehirel / atomsk

Atomsk: A Tool For Manipulating And Converting Atomic Data Files -
https://atomsk.univ-lille.fr
GNU General Public License v3.0
198 stars 75 forks source link

polycrystal: grain number one contains more atoms than it should #9

Closed jfikar closed 5 years ago

jfikar commented 5 years ago

Dear Pierre,

I think I've found another bug in atomsk. I'm creating my hexagonal tungsten polycrystal as before, just this time the box is smaller in Z:

atomsk --create bcc 3.1652 W xsf
atomsk --polycrystal W.xsf poly.txt poly.cfg

poly.txt:

box 106.6 79.9 40
node 0.125*box 0.0000*box 0.5*box random
node 0.125*box 0.3333*box 0.5*box random
node 0.125*box 0.6667*box 0.5*box random
node 0.375*box 0.1667*box 0.5*box random
node 0.375*box 0.5000*box 0.5*box random
node 0.375*box 0.8333*box 0.5*box random
node 0.625*box 0.0000*box 0.5*box random
node 0.625*box 0.3333*box 0.5*box random
node 0.625*box 0.6667*box 0.5*box random
node 0.875*box 0.1667*box 0.5*box random
node 0.875*box 0.5000*box 0.5*box random
node 0.875*box 0.8333*box 0.5*box random

Then the grain number one is no more hexagonal, but it is on one side bigger bordered with right angle. It also contains more atoms than the other grains, as it is outputted by atomsk: about 2600 atoms, while other grains have around 1800 atoms. Then the extra atoms from grain one are inside of other grains via periodic boundary conditions. Here I omitted the -wrap switch so the wrong shape of the grain number one is obvious.

The weird shape of grain number one happens when the box Z dimension is 0 - 40 A. At 45 A and bigger it behaves as expected.

It seems the order of nodes is not the problem, it seems it is the position of node one.

pierrehirel commented 5 years ago

Thank you for reporting this bug. It had to do with the searching of colinear vertices, which was wrongly eliminating some vertices from the neighbor list, hence the grain was not cut correctly.

I just pushed a new version to Github. I tried it with your example and with other systems, and I believe the issue is now fixed. Please confirm when you can.

Regards

jfikar commented 5 years ago

I can confirm the issue is fixed. Thank you very much