sisl icon indicating copy to clipboard operation
sisl copied to clipboard

Default `Lattice.nsc` and relation to periodic/nonperiodic directions

Open tfrederiksen opened this issue 8 months ago • 6 comments

I've noticed that the default Lattice.nsc = [1, 1, 1] is obtained when reading a geometry from file (XV, CONTCAR, fdf, etc). However, this prevents a function like .translate2uc() to take effect unless one first changes nsc[i] > 1 or explicitly sets axes=True (how I came across this issue).

Suggestion: Perhaps nsc[i] = 0 should be allowed to denote a nonperiodic direction, while a value of 1 would mean periodicity (but without explicit reference to neighbour cells)? This would be consistent with the pbc-parameter written to the xyz-header (obtained from pbc = ['T' if n else 'F' for n in nsc]).

With this definition, we could simply redefine the default axes=None in translate2uc to:

-            axes = (self.lattice.nsc > 1).nonzero()[0]
+            axes = (self.lattice.nsc >= 1).nonzero()[0]

tfrederiksen avatar Oct 09 '23 21:10 tfrederiksen