Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert marketplacemodel bulk ferromagnets #592

Merged
merged 25 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eabe6f3
parallelepiped chains based on MagneticOrientedChains
astellhorn Jan 19, 2024
df52fcb
model without magnetic sld
astellhorn Jan 19, 2024
e4e3171
Have added the magnetic_functions.c, micromagnetic_FF_3D.c, and micro…
astellhorn Feb 23, 2024
600b1bf
separate ParallelepipedChain into separate PR
dehoni Apr 8, 2024
a6f51ea
work around pocl problems (for now)
Jan 29, 2024
4e135a1
work around pocl problems (for now)
Jan 29, 2024
108c0c2
work around pocl problems (for now)
Jan 29, 2024
062fbff
add image and check model describtion
dehoni May 21, 2024
e1b714e
Merge branch 'release_1.0.8' into insert-marketplacemodel-bulk-ferrom…
butlerpd Jul 15, 2024
8116f74
move magnetic_functions.c as library and align names
dehoni Jul 30, 2024
3e76d8e
Merge branch 'release_1.0.8' into insert-marketplacemodel-bulk-ferrom…
dehoni Jul 30, 2024
d85cbcb
generalise models for varing structural, magnetic, and anisotropy str…
dehoni Jul 30, 2024
20c4a5c
Merge branch 'insert-marketplacemodel-bulk-ferromagnets' of https://g…
dehoni Jul 30, 2024
f2405b3
add exploration for precision of the langevin function 1/tanh(x) + 1/x
Aug 30, 2024
3023920
Make clip() available to all models in the kernel header.
Sep 3, 2024
d0f2039
Remove compiler warnings for generic magnetic models
Sep 3, 2024
c1581a1
make vector calculations accessible for models
dehoni Sep 10, 2024
a2a0a20
rename carthesian q components
dehoni Sep 10, 2024
f9c7c5f
simplifying magnetic form factors
dehoni Sep 10, 2024
5414c55
refactor model
dehoni Sep 10, 2024
f424e94
refactored intensity calculation
dehoni Sep 13, 2024
52f6906
add test with default values
dehoni Sep 23, 2024
f399580
documentation reflects model is now validated
dehoni Sep 23, 2024
6a8c795
Remove GPu acceleration from ubuntu
krzywon Sep 26, 2024
ad40327
Update release notes to include final changes
krzywon Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename carthesian q components
dehoni committed Sep 10, 2024

Verified

This commit was signed with the committer’s verified signature.
0xNe0x1 0xNe0x1
commit a2a0a203addda130cd8d8f7b14cd8d94fc0dfd3b
10 changes: 5 additions & 5 deletions sasmodels/models/lib/magnetic_functions.c
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ static double langevin(

if (x < 0.00001) {
// avoid dividing by zero
return 1.0/3.0*x;
return 1.0/3.0*x-1.0/45.0 * pow(x, 3) + 2.0/945.0 * pow(x, 5) - 1.0/4725.0 * pow(x, 7);
} else {
return 1.0/tanh(x)-1/x;
}
@@ -21,7 +21,7 @@ static double langevinoverx(

if (x < 0.00001) {
// avoid dividing by zero
return 1.0/3.0;
return 1.0/3.0-1.0/45.0 * pow(x, 2) + 2.0/945.0 * pow(x, 4) - 1.0/4725.0 * pow(x, 6);
} else {
return langevin(x)/x;
}
@@ -84,7 +84,7 @@ static void set_weights(double in_spin, double out_spin, double weight[8]) //fro
//Evaluating the magnetic scattering vector (Halpern Johnson vector) for general orientation of q and collecting terms for the spin-resolved (POLARIS) cross sections. Mz is along the applied magnetic field direction, which is also the polarisation direction.
static void mag_sld(
// 0=dd.real, 1=dd.imag, 2=uu.real, 3=uu.imag, 4=du.real, 5=du.imag, 6=ud.real, 7=ud.imag
double x, double y, double z,
double qx, double qy, double qz,
double mxreal, double mximag, double myreal, double myimag, double mzreal,double mzimag, double nuc, double sld[8])
{
double vector[3];
@@ -100,8 +100,8 @@ static void mag_sld(
double Mperpreal[3];
double Mperpimag[3];

const double q = sqrt(x*x + y*y + z*z);
SET_VEC(vector, x/q, y/q, z/q);
const double q = sqrt(qx*qx + qy*qy + qz*qz);
SET_VEC(vector, qx/q, qy/q, qz/q);

//Moon-Riste-Koehler notation choose z as pointing along field/polarisation axis
//totally different to what is used in SASview (historical reasons)
24 changes: 12 additions & 12 deletions sasmodels/models/micromagnetic_FF_3D.c
Original file line number Diff line number Diff line change
@@ -46,31 +46,31 @@ static double reduced_field(double q, double Ms, double Hi,
//the two transversal magnetisation components, reacting to a magnetic field.
//The micromagnetic solution for the magnetisation are from Michels et al. PRB 94, 054424 (2016).

static double fqMxreal( double x, double y, double z, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
static double fqMxreal( double qx, double qy, double qz, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
{
const double q = sqrt(x*x + y*y + z*z);
const double f = reduced_field(q, Ms, Hi, A)*(Hkx*(1.0+reduced_field(q, Ms, Hi, A)*y*y/q/q)-Ms*Mz*x*z/q/q*(1.0+reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,q)*DMI_length(Ms, D,q))-Hky*reduced_field(q, Ms, Hi, A)*x*y/q/q)/(1.0+reduced_field(q, Ms, Hi, A)*(x*x+y*y)/q/q-square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z)));
const double q = sqrt(qx*qx + qy*qy + qz*qz);
const double f = reduced_field(q, Ms, Hi, A)*(Hkx*(1.0+reduced_field(q, Ms, Hi, A)*qy*qy/q/q)-Ms*Mz*qx*qz/q/q*(1.0+reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,q)*DMI_length(Ms, D,q))-Hky*reduced_field(q, Ms, Hi, A)*qx*qy/q/q)/(1.0+reduced_field(q, Ms, Hi, A)*(qx*qx+qy*qy)/q/q-square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz)));
return f;
}

static double fqMximag(double x, double y, double z, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
static double fqMximag(double qx, double qy, double qz, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
{
const double q = sqrt(x*x + y*y + z*z);
const double f = -reduced_field(q, Ms, Hi, A)*(Ms*Mz*(1.0+reduced_field(q, Ms, Hi, A))*DMI_length(Ms, D,y)+Hky*reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z))/(1.0+reduced_field(q, Ms, Hi, A)*(x*x+y*y)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z)));
const double q = sqrt(qx*qx + qy*qy + qz*qz);
const double f = -reduced_field(q, Ms, Hi, A)*(Ms*Mz*(1.0+reduced_field(q, Ms, Hi, A))*DMI_length(Ms, D,qy)+Hky*reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz))/(1.0+reduced_field(q, Ms, Hi, A)*(qx*qx+qy*qy)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz)));
return f;
}

static double fqMyreal( double x, double y, double z, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
static double fqMyreal( double qx, double qy, double qz, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
{
const double q = sqrt(x*x + y*y + z*z);
const double f = reduced_field(q, Ms, Hi, A)*(Hky*(1.0+reduced_field(q, Ms, Hi, A)*x*x/q/q)-Ms*Mz*y*z/q/q*(1.0+reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,q)*DMI_length(Ms, D,q))-Hkx*reduced_field(q, Ms, Hi, A)*x*y/q/q)/(1.0+reduced_field(q, Ms, Hi, A)*(x*x+y*y)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z)));
const double q = sqrt(qx*qx + qy*qy + qz*qz);
const double f = reduced_field(q, Ms, Hi, A)*(Hky*(1.0+reduced_field(q, Ms, Hi, A)*qx*qx/q/q)-Ms*Mz*qy*qz/q/q*(1.0+reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,q)*DMI_length(Ms, D,q))-Hkx*reduced_field(q, Ms, Hi, A)*qx*qy/q/q)/(1.0+reduced_field(q, Ms, Hi, A)*(qx*qx+qy*qy)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz)));
return f;
}

static double fqMyimag( double x, double y, double z, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
static double fqMyimag( double qx, double qy, double qz, double Mz, double Hkx, double Hky, double Hi, double Ms, double A, double D)
{
const double q = sqrt(x*x + y*y + z*z);
const double f = reduced_field(q, Ms, Hi, A)*(Ms*Mz*(1.0+reduced_field(q, Ms, Hi, A))*DMI_length(Ms, D,x)-Hkx*reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z))/(1.0+reduced_field(q, Ms, Hi, A)*(x*x+y*y)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,z)));
const double q = sqrt(qx*qx + qy*qy + qz*qz);
const double f = reduced_field(q, Ms, Hi, A)*(Ms*Mz*(1.0+reduced_field(q, Ms, Hi, A))*DMI_length(Ms, D,qx)-Hkx*reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz))/(1.0+reduced_field(q, Ms, Hi, A)*(qx*qx+qy*qy)/q/q -square(reduced_field(q, Ms, Hi, A)*DMI_length(Ms, D,qz)));
return f;
}

1 change: 1 addition & 0 deletions sasmodels/models/micromagnetic_FF_3D.py
Original file line number Diff line number Diff line change
@@ -166,6 +166,7 @@
structure_factor = False
have_Fq = False
single=False
opencl = False


def random():