You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have attached an example where nexus.Structure::tile produced a supercell with two atoms on top of each other. @jtkrogel do you see an easy fix for this?
I found a workaround by adding "use_ase" flag to tile(). May I PR this as a feature?
diff --git a/nexus/lib/structure.py b/nexus/lib/structure.py
index a374ca728..9f2d6143d 100755
--- a/nexus/lib/structure.py
+++ b/nexus/lib/structure.py
@@ -2947,6 +2947,7 @@ class Structure(Sobj):
def tile(self,*td,**kwargs):
+ use_ase = kwargs.pop('use_ase',False)
in_place = kwargs.pop('in_place',False)
magnetic_order = kwargs.pop('magnetic_order',None)
magnetic_primitive = kwargs.pop('magnetic_primitive',True)
@@ -2979,8 +2980,18 @@ class Structure(Sobj):
self.recenter()
+ # get atomic positions "pos"
+ if use_ase:
+ from ase import Atoms
+ from ase.build import make_supercell
+ atext = ''.join(self.elem)
+ pbc = [True if b == 'p' else False for b in self.bconds]
+ a0 = Atoms(atext, cell=self.axes, positions=self.pos, pbc=pbc)
+ a1 = make_supercell(a0, tilematrix)
+ pos = a1.get_positions()
+ else:
+ pos = self.tile_points(self.pos,self.axes,tilematrix,tilevector)
elem = array(ncells*list(self.elem))
- pos = self.tile_points(self.pos,self.axes,tilematrix,tilevector)
axes = dot(tilematrix,self.axes)
center = axes.sum(0)/2
I'm looking at this now. Apparently performing the shear operations to obtain the diagonal tiling can depend on the order in which you perform them. I will explore whether an alternative based on row reduction and pivoting would do the right thing.
I have attached an example where nexus.Structure::tile produced a supercell with two atoms on top of each other. @jtkrogel do you see an easy fix for this?
I found a workaround by adding "use_ase" flag to tile(). May I PR this as a feature?
tile.zip
The text was updated successfully, but these errors were encountered: