Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Aug 7, 2024
1 parent 0e85b8b commit e0ba422
Show file tree
Hide file tree
Showing 10 changed files with 4,809 additions and 4,302 deletions.
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.8.7.0454</AssemblyVersion>
<FileVersion>2024.8.7.0454</FileVersion>
<AssemblyVersion>2024.8.7.0911</AssemblyVersion>
<FileVersion>2024.8.7.0911</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Crystallography.OpenGL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.8.7.0454</AssemblyVersion>
<FileVersion>2024.8.7.0454</FileVersion>
<AssemblyVersion>2024.8.7.0911</AssemblyVersion>
<FileVersion>2024.8.7.0911</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand Down
43 changes: 22 additions & 21 deletions Crystallography/Crystal/Crystal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -964,11 +964,25 @@ public void SetVectorOfAxis(int uMax, int vMax, int wMax)
/// 引数で指定された指数の面ベクトルを計算し、VectorOfPlaneに格納
/// </summary>
/// <param name="indices"></param>
public void SetVectorOfPlane((int H, int K, int L)[] indices)
public void SetVectorOfPlane((int h, int k, int l)[] indices, WaveSource waveSource)
{
VectorOfPlane = [];
foreach (var (H, K, L) in indices)
VectorOfPlane.Add(new Vector3D(H * A_Star + K * B_Star + L * C_Star) { Text = $"({H}{K}{L})" });
foreach (var (h, k, l) in indices)
{
var vec = new Vector3D(h * A_Star + k * B_Star + l * C_Star);
vec.F = GetStructureFactor(waveSource, Atoms, (h, k, l), vec.Length2 / 4.0);
vec.RawIntensity = vec.F.MagnitudeSquared();
vec.Text = $"({h}{k}{l})";
vec.Index = (h, k, l);
VectorOfPlane.Add(vec);
}

if (VectorOfPlane.Count > 0)
{
var max = VectorOfPlane.Max(v => v.RawIntensity);
if (max > 0)
VectorOfPlane.ForEach(v => v.RelativeIntensity = v.RawIntensity / max);
}
}

/// <summary>
Expand All @@ -977,28 +991,16 @@ public void SetVectorOfPlane((int H, int K, int L)[] indices)
/// <param name="hMax"></param>
/// <param name="kMax"></param>
/// <param name="lMax"></param>
public void SetVectorOfPlane(int hMax, int kMax, int lMax)
public void SetVectorOfPlane(int hMax, int kMax, int lMax, WaveSource waveSource)
{
VectorOfPlane = [];
Vector3D vec;

vec = CalcHklVector(1, 0, 0); vec = vec * GetLengthPlane(1, 0, 0) / vec.d; vec.Text = "(100)"; VectorOfPlane.Add(vec);
vec = CalcHklVector(0, 1, 0); vec = vec * GetLengthPlane(0, 1, 0) / vec.d; vec.Text = "(010)"; VectorOfPlane.Add(vec);
vec = CalcHklVector(0, 0, 1); vec = vec * GetLengthPlane(0, 0, 1) / vec.d; vec.Text = "(001)"; VectorOfPlane.Add(vec);
vec = CalcHklVector(-1, 0, 0); vec = vec * GetLengthPlane(-1, 0, 0) / vec.d; vec.Text = "(-100)"; VectorOfPlane.Add(vec);
vec = CalcHklVector(0, -1, 0); vec = vec * GetLengthPlane(0, -1, 0) / vec.d; vec.Text = "(0-10)"; VectorOfPlane.Add(vec);
vec = CalcHklVector(0, 0, -1); vec = vec * GetLengthPlane(0, 0, -1) / vec.d; vec.Text = "(00-1)"; VectorOfPlane.Add(vec);
var indices = new List<(int h, int k, int l)> { (1, 0, 0), (0, 1, 0), (0, 0, 1), (-1, 0, 0), (0, -1, 0), (0, 0, -1) };
for (int h = -hMax; h <= hMax; h++)
for (int k = -kMax; k <= kMax; k++)
for (int l = -lMax; l <= lMax; l++)

if (CheckIrreducible(h, k, l) && !(h * k == 0 && k * l == 0 && l * h == 0))
{
vec = CalcHklVector(h, k, l);
vec = vec * GetLengthPlane(h, k, l) / vec.d;
vec.Text = $"({h}{k}{l})";
VectorOfPlane.Add(vec);
}
indices.Add((h, k, l));

SetVectorOfPlane([.. indices], waveSource);
}

/// <summary>
Expand Down Expand Up @@ -1028,7 +1030,6 @@ public void SetPlanes(double dMax, double dMin, bool excludeEquivalentPlane, boo

var shift = directions.Select(dir => (MatrixInverse * dir).Length).Max();


var maxNum = _maxNum;
var outer = new List<(int H, int K, int L, double len)>() { (0, 0, 0, 0) };
var gHash = new HashSet<(int H, int K, int L)>((int)(maxNum * 1.5)) { (0, 0, 0) }; //全てのhklを検索するため、composeを使えないことに注意
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.8.7.0454</AssemblyVersion>
<FileVersion>2024.8.7.0454</FileVersion>
<AssemblyVersion>2024.8.7.0911</AssemblyVersion>
<FileVersion>2024.8.7.0911</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand Down
Loading

0 comments on commit e0ba422

Please sign in to comment.