From 2a85ccdf9733173edc6c0932271fa944faac42d3 Mon Sep 17 00:00:00 2001 From: Nick Papior Date: Thu, 12 Aug 2021 09:38:06 +0200 Subject: [PATCH] bug: fixed #102 I am not sure this will solve all problems. Basically the problem I encountered refers to systems where sc.origo is defined, that variable does not have a unified meaning, but really should have. --- sisl/geometry.py | 4 ++-- sisl/physics/electron.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sisl/geometry.py b/sisl/geometry.py index 23b43454a0..e6f3979e9a 100644 --- a/sisl/geometry.py +++ b/sisl/geometry.py @@ -4095,8 +4095,8 @@ def within_inf(self, sc, periodic=None, tol=1e-5, origo=None): length tolerance for the fractional coordinates to be on a duplicate site (in Ang). This allows atoms within `tol` of the cell boundaries to be taken as *inside* the cell. - origo : (3, ) of float - origo that is the basis for comparison + origo : (3,) of float, optional + origo that is the basis for comparison, default to 0. Returns ------- diff --git a/sisl/physics/electron.py b/sisl/physics/electron.py index 009617e5e2..7b77676ee7 100644 --- a/sisl/physics/electron.py +++ b/sisl/physics/electron.py @@ -1268,6 +1268,9 @@ def wavefunction(v, grid, geometry=None, k=None, spinor=0, spin=None, eta=None): geometry = grid.geometry if geometry is None: raise SislError("wavefunction: did not find a usable Geometry through keywords or the Grid!") + # Ensure coordinates are in the primary unit-cell, regardless of origo etc. + geometry = geometry.copy() + geometry.xyz = (geometry.fxyz % 1) @ geometry.sc.cell # In case the user has passed several vectors we sum them to plot the summed state if v.ndim == 2: