spinw icon indicating copy to clipboard operation
spinw copied to clipboard

Overplotting Q vectors on 3D crystal structure

Open henrikjacobsenfys opened this issue 7 years ago • 1 comments

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

henrikjacobsenfys avatar Mar 06 '17 14:03 henrikjacobsenfys

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

tsdev avatar Mar 07 '17 13:03 tsdev