spinw icon indicating copy to clipboard operation
spinw copied to clipboard

Bug when plotting octahedra

Open henrikjacobsenfys opened this issue 5 years ago • 0 comments

There seems to be problems sometimes when plotting octahedra. I have a fairly complicated example with 40 atoms in the unit cell (the space group I've used is P 21/n which isn't standard, so I've opted to omit symmetry for plotting in spinw for now and just put all atoms in by hand).

I am trying to plot octahedra around the Ca1 atoms, but for some reason this doesn't work. I've managed to plot a single one the way I want it in red. The code is below:

Thanks.

close all clear

r= [ 0.7566 0.5206 0.8821 0.7434 0.0206 0.6179 0.2434 0.4794 0.1179 0.2566 0.9794 0.3821 0.7628 0.4920 0.3785 0.7372 0.9920 0.1215 0.2372 0.5080 0.6215 0.2628 0.0080 0.8785 0.5114 0.9905 0.7577 0.9886 0.4905 0.7423 0.4886 0.0095 0.2423 0.0114 0.5095 0.2577 0 0 0 0.5000 0.5000 0.5000 0 0 0.5000 0.5000 0.5000 0 0.7779 0.9315 0.9480 0.7221 0.4315 0.5520 0.2221 0.0685 0.0520 0.2779 0.5685 0.4480 0.7673 0.0357 0.3937 0.7327 0.5357 0.1063 0.2327 0.9643 0.6062 0.2673 0.4643 0.8938 0.5274 0.2257 0.6140 0.9726 0.7257 0.8860 0.4726 0.7743 0.3860 0.0274 0.2743 0.1140 0.5283 0.3369 0.1477 0.9717 0.8369 0.3523 0.4717 0.6631 0.8523 0.0283 0.1631 0.6477 0.5849 0.7011 0.6594 0.9151 0.2011 0.8406 0.4151 0.2989 0.3406 0.0849 0.7989 0.1594 0.4971 0.7954 0.0813 0.0029 0.2954 0.4187 0.5029 0.2046 0.9187 0.9971 0.7046 0.5813];

idx= [1 1 1 1 2 2 2 2 3 3 3 3 4 4 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11];

colors={'k' 'k' 'b' 'gold' 'gold' 'r' 'r' 'r' 'r' 'r' 'r'}; % atomName={'Pb1' 'Pb2' 'Ca1' 'Os1' 'Os2' 'O11' 'O12' 'O21' 'O22' 'O31' 'O32'}; atomName={'Pb1' 'Pb2' 'Ca1' 'Os1' 'Os2' 'O' 'O' 'O' 'O' 'O' 'O'}; S=[0 0 0 0.6063 0.6063 0 0 0 0 0 0]; Pb=spinw; Pb.genlattice('lat_const',[10.0826 5.6881 11.8366],'angled',[90 125.32 90]);

for k=1:length(idx) Pb.addatom('r',r(k,:),'S',S(idx(k)),'label',atomName{idx(k)},'color',colors{idx(k)}); end

plot(Pb,'range',[0 1; -0.4 1; 0 1]) % swplot.plotchem('atom1','Ca','atom2','O','limit',[0 2.1],'color','blue','replace',0); swplot.plotchem('atom1','Ca','atom2','O','limit',6,'color','blue','replace',0);

r=Pb.atom.r;

R=[r(:,31)+[0 -1 0]' r(:,17)+[0 -1 0]' r(:,39)+[0 0 0]' r(:,23)+[0 -1 0]' r(:,33)+[0 -1 0]' r(:,25)+[0 0 0]']';

swplot.plot('type','polyhedron','position',permute(R,[2 3 1]),'color','red','alpha',0.5)

henrikjacobsenfys avatar Sep 06 '18 11:09 henrikjacobsenfys