tsdev / spinw

SpinW Matlab library for spin wave calculation
www.psi.ch/spinw
GNU General Public License v3.0
30 stars 35 forks source link

plotchem plots bonds outside of unit cell #37

Open henrikjacobsenfys opened 7 years ago

henrikjacobsenfys commented 7 years ago

Hi Sandor It seems that when an atom is right at the edge of the unit cell, plotchem will plot the bonds from that atom to where they are supposed to be outside the unit cell, even if this goes outside of the desired plot range. An example is given below Cheers, Henrik

clear
CuO = spinw;
CuO.fileid(0)
CuO.genlattice('lat_const',[4.684  3.423 5.129],'angled',[90 99.54 90],'sym','C 2/c')
CuO.addatom('r', [1/4 1/4 0],'S', 1/2,'label','Cu','color','blue') 
CuO.gencoupling
CuO.addatom('r', [0 0.416 1/4],'S', 0,'label','O','color','red')
CuO.plot('range',[2 1 2],'cellMode','inside')
swplot.plotchem('atom1','Cu','atom2','O','limit',4,'range',[2 1 2],'mode','bond')
tsdev commented 6 years ago

There is the extend option that you can set to false in case you don't want to plot bonds outside of the plotting range. However I realised it has a bug, I will try to fix it. Meanwhile you can delete individual bonds by using the swplot.findobj() and swplot.delete() functions.