From 6e64054ffccb87331682c0f8a1e97f7c7cca2680 Mon Sep 17 00:00:00 2001 From: chn Date: Tue, 3 Dec 2024 19:11:48 +0800 Subject: [PATCH] fix --- src/project-to-mode.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/project-to-mode.cpp b/src/project-to-mode.cpp index 19d111a..d5a0e6d 100644 --- a/src/project-to-mode.cpp +++ b/src/project-to-mode.cpp @@ -29,7 +29,7 @@ void ufo::project_to_mode(std::string config_file) .SubQpoint = input.Super.Qpoint[config.SuperQpointIndex].SubQpoint[config.SubQpointIndex], .PrimativeQpoint = input.Primative.Qpoint[config.PrimativeQpointIndex].Qpoint, .Coefficient = std::vector>(input.Super.Qpoint[config.SuperQpointIndex].Mode.size(), - std::vector(input.Primative.Qpoint[config.PrimativeQpointIndex].Mode.size(), 0)) + std::vector(input.Primative.Qpoint[config.PrimativeQpointIndex].Mode.size())) }; if ((output.SubQpoint - output.PrimativeQpoint).norm() > 0.01) log.error("sub qpoint {} != primative qpoint {}"_f(output.SubQpoint, output.PrimativeQpoint)); @@ -99,7 +99,7 @@ void ufo::project_to_mode(std::string config_file) | ranges::views::transform([&](const auto& mode) { return primative_basis - | ranges::views::transform([&](const auto& basis) -> std::array, 3> + | ranges::views::transform([&](const auto& basis) { return (basis.transpose().conjugate() * mode.EigenVector).eval() | biu::fromEigen; }) | ranges::to_vector | biu::toEigen<>; @@ -121,9 +121,8 @@ void ufo::project_to_mode(std::string config_file) { for (auto [i_of_primative_mode, primative_mode] : ranges::views::enumerate(primative_projection_coefficient)) - for (auto i_of_direction : std::array{0, 1, 2}) - output.Coefficient[i_of_super_mode][i_of_primative_mode] += - (super_mode.col(i_of_direction).transpose().conjugate() * primative_mode.col(i_of_direction)).norm(); + output.Coefficient[i_of_super_mode][i_of_primative_mode] = + std::norm((super_mode.transpose().conjugate() * primative_mode).trace()); auto sum = ranges::accumulate(output.Coefficient[i_of_super_mode], 0.); for (auto& coefficient : output.Coefficient[i_of_super_mode]) coefficient *=