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

Overplotting Q vectors on 3D crystal structure #32

Open henrikjacobsenfys opened 7 years ago

henrikjacobsenfys commented 7 years ago

Is there an easy way to plot one (or more) Q vectors along with the unit cell?

tsdev commented 7 years ago

You can plot arbitrary vectors using the swplot.plot() function onto a 3D crystal plot. For example (note the xyz coordinate system is used for the arrow plots):

myModel = sw_model('triAF',1);
plot(myModel,'range',[1 1 1/2])

% 100
Qrlu = [1 0 0];
QA   = Qrlu*myModel.rl;
swplot.plot('type','arrow','position',cat(3,zeros(3,1),QA'),'color','gold','unit','xyz');
swplot.plot('type','text','position',QA','text','[100]','unit','xyz')

% 010
Qrlu = [0 1 0];
QA   = Qrlu*myModel.rl;
swplot.plot('type','arrow','position',cat(3,zeros(3,1),QA'),'color','pink','unit','xyz');
swplot.plot('type','text','position',QA','text','[100]','unit','xyz')

The result should look like this: spinw_rlu_vector_plot