Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $HistoryLength = 0;
- SetSystemOptions[
- "SparseArrayOptions" -> {"TreatRepeatedEntries" -> 1}];
- f[{a_, b_, c_}] :=
- If[a <= 0,
- "NA", {Round[200 b/a], Round[200 c/a], 1000/(a^2 + b^2 + c^2)}];
- initialCell =
- Table[{0.1, Sin[[Theta]]/5.0,
- Cos[[Theta]]/5.0}, {[Theta], [Pi]/16, 2 [Pi], [Pi]/16}];
- translatedCell[m1_, m2_,
- m3_] := {m1 + (-1)^m1 #[[1]], m2 + (-1)^m2 #[[2]],
- m3 + (-1)^m3 #[[3]]} & /@ initialCell;
- A = Flatten[
- Table[translatedCell[m1, m2, m3], {m1, 0, 18}, {m2, -18,
- 18}, {m3, -18, 18}], 3];
- << Developer`
- B = Cases[f /@ A, Except["NA"]];
- F = Cases[B, _?(Abs[#[[1]]] <= 800 && Abs[#[[2]]] <= 800 &)];
- G = SparseArray[{-801 + #[[1]], -801 + #[[2]]} -> 1.5/32 #[[3]] & /@
- F];
- {n1, n2} = Dimensions[G];
- fLor = Compile[{{x, _Integer}, {y, _Integer}}, (0.12/(
- 0.12 + x^2 + y^2))^1.15, RuntimeAttributes -> {Listable},
- CompilationTarget -> "C"];
- lor = RotateRight[
- fLor[#[[All, All, 1]], #[[All, All, 2]]] &@
- Outer[List, Range[-Floor[n1/2], Ceiling[n1/2] - 1],
- Range[-Floor[n2/2], Ceiling[n2/2] - 1]], {Floor[n1/2],
- Floor[n2/2]}];
- Image[Sqrt[1.0 n1 n2]
- Abs[InverseFourier[
- Fourier[G] Fourier[lor]]][TensorProduct]ToPackedArray[{1.0, 0.3,
- 0.1}], Magnification -> 1]
- initialCell =
- Table[{0.1, Sin[[Theta]]/5.0,
- Cos[[Theta]]/5.0}, {[Theta], [Pi]/16, 2 [Pi], [Pi]/16}];
- translatedCell[m1_, m2_,
- m3_] := {m1 + (-1)^m1 #[[1]], m2 + (-1)^m2 #[[2]],
- m3 + (-1)^m3 #[[3]]} & /@ initialCell;
- B = Cases[
- f /@ (Flatten[
- Table[translatedCell[m1, m2, m3], {m1, -20, 20}, {m2, -20,
- 20}, {m3, -20, 20}],
- 3].{{0.5`, -0.7071067811865475`, 0.5`}, {0.5`,
- 0.7071067811865475`, 0.5`}, {-0.7071067811865475`, 0.`,
- 0.7071067811865475`}}), Except["NA"]];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement