Implementation of Spin Rotator.
This commit is contained in:
32
geant4/spin_rot/run/field_import.m
Normal file
32
geant4/spin_rot/run/field_import.m
Normal file
@ -0,0 +1,32 @@
|
||||
[x y z bx by bz] = textread('sep_0nl.lis','%f %f %f %f %f %f', 'headerlines', 13);
|
||||
[nx ny nz] = textread('sep_0nl.lis','%*s %*s %*s %*s %u %u %u', 1, 'headerlines', 10);
|
||||
|
||||
|
||||
Bx = reshape(bx,nx,ny,nz);
|
||||
By = reshape(by,nx,ny,nz);
|
||||
Bz = reshape(bz,nx,ny,nz);
|
||||
|
||||
x1 = reshape(x,nx,ny,nz);
|
||||
y1 = reshape(y,nx,ny,nz);
|
||||
z1 = reshape(z,nx,ny,nz);
|
||||
|
||||
i=1:32;
|
||||
test = [x1(i);y1(i);z1(i)]'
|
||||
|
||||
%min(x) max(x)
|
||||
|
||||
sx = max(diff(x)); % read step size along x
|
||||
sy = max(diff(y)); % read step size along y
|
||||
sz = max(diff(z)); % read step size along z
|
||||
|
||||
x2 = -x(end:-1:1);
|
||||
x3 = -x(end:-1:1);
|
||||
x4 = -x(end:-1:1);
|
||||
|
||||
x2 = reshape(x2,nx,ny,nz);
|
||||
x3 = reshape(x3,nx,ny,nz);
|
||||
x4 = reshape(x4,nx,ny,nz);
|
||||
|
||||
%p = [x(:)'; y(:)'; z(:)'];
|
||||
%ind2sub
|
||||
%[i j] = ind2sub(3,x1);
|
Reference in New Issue
Block a user