adjust figure resolution

This commit is contained in:
陈浩南 2023-10-08 14:20:08 +08:00
parent e740ef87cb
commit 2460c298c7
6 changed files with 69 additions and 61 deletions

View File

@ -19,13 +19,16 @@ find_package(fmt REQUIRED)
find_package(concurrencpp REQUIRED) find_package(concurrencpp REQUIRED)
find_package(HighFive REQUIRED) find_package(HighFive REQUIRED)
find_package(TBB REQUIRED) find_package(TBB REQUIRED)
find_package(glad REQUIRED)
# find_package(Matplot++ REQUIRED COMPONENTS matplot_opengl)
find_package(Matplot++ REQUIRED) find_package(Matplot++ REQUIRED)
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED) find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
add_executable(ufo src/fold.cpp src/unfold.cpp src/plot.cpp src/main.cpp) add_executable(ufo src/fold.cpp src/unfold.cpp src/plot.cpp src/main.cpp)
target_include_directories(ufo PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR}) target_include_directories(ufo PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR})
target_link_libraries(ufo PRIVATE target_link_libraries(ufo PRIVATE
yaml-cpp Eigen3::Eigen fmt::fmt concurrencpp::concurrencpp HighFive_HighFive TBB::tbb Matplot++::matplot) yaml-cpp Eigen3::Eigen fmt::fmt concurrencpp::concurrencpp HighFive_HighFive TBB::tbb Matplot++::matplot
Matplot++::matplot_opengl)
# target_compile_definitions(ufo PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>) # target_compile_definitions(ufo PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS) get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)

View File

@ -9,11 +9,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693886279, "lastModified": 1696252780,
"narHash": "sha256-oVCA5yz6zcsFzGCCwRpVDuDml7Z0sWQqW1fEWWcC0xM=", "narHash": "sha256-sQEjVzzstiaNLyiFJ19EMwwbDSSNDyQZIbPiLonlDCQ=",
"owner": "ezKEa", "owner": "ezKEa",
"repo": "aagl-gtk-on-nix", "repo": "aagl-gtk-on-nix",
"rev": "8fc45fabbedef44a481c3bcabd9512732c0ade91", "rev": "0c9d93bdb311f7948f9fb0e98d869316d78eec12",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -290,11 +290,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693611461, "lastModified": 1696343447,
"narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -354,11 +354,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1657226504, "lastModified": 1696331477,
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", "narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=",
"owner": "gytis-ivaskevicius", "owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus", "repo": "flake-utils-plus",
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", "rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -537,11 +537,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1689397210, "lastModified": 1695684520,
"narHash": "sha256-fVxZnqxMbsDkB4GzGAs/B41K0wt/e+B/fLxmTFF/S20=", "narHash": "sha256-yORqGB0i1OtEf9MOCCT2BIbOd8txPZn216CM+ylMmhY=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "hercules-ci-effects", "repo": "hercules-ci-effects",
"rev": "0a63bfa3f00a3775ea3a6722b247880f1ffe91ce", "rev": "91fae5824f5f1199f61693c6590b4a89abaed9d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -558,11 +558,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694465129, "lastModified": 1695108154,
"narHash": "sha256-8BQiuobMrCfCbGM7w6Snx+OBYdtTIm0+cGVaKwQ5BFg=", "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "9787dffff5d315c9593d3f9fb0f9bf2097e1b57b", "rev": "07682fff75d41f18327a871088d20af2710d4744",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -702,11 +702,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1693880502, "lastModified": 1695714965,
"narHash": "sha256-krCRVLNdlCI7l7F1Bb2ovkgac8hoz015LyYvm/+aYZw=", "narHash": "sha256-uukcDCyFOIMo5vJWJbLJk2phHZtJ1DE7YrypSV48gII=",
"owner": "thiagokokada", "owner": "thiagokokada",
"repo": "nix-alien", "repo": "nix-alien",
"rev": "0fbd284930bcf1a5d1e3d07f2973e6f1738505cc", "rev": "a948cf76e084f4ac770793c6ff9c57ad8b8c099f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -723,11 +723,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694921880, "lastModified": 1696131323,
"narHash": "sha256-yU36cs5UdzhTwsM9bUWUz43N//ELzQ1ro69C07pU/8E=", "narHash": "sha256-Y47r8Jo+9rs+XUWHcDPZtkQs6wFeZ24L4CQTfVwE+vY=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "9d2bcc47110b3b6217dfebd6761ba20bc78aedf2", "rev": "031d4b22505fdea47bd53bfafad517cd03c26a4f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -769,11 +769,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694400214, "lastModified": 1695137077,
"narHash": "sha256-QHESodq9FQpjWshfxmdYePnEAPaNPsYEd3iBe/JYjqk=", "narHash": "sha256-wJ8EpYjsqrR4GFAF67wJKmZd4q86KuODWAag4acQL5Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixd", "repo": "nixd",
"rev": "69b533e8d643c5dcbda7962d4dff808d72165783", "rev": "e8f144ca50fe71e74d247e5308ae7ce122f0a0e6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -807,11 +807,11 @@
"touchix": "touchix" "touchix": "touchix"
}, },
"locked": { "locked": {
"lastModified": 1695866766, "lastModified": 1696743278,
"narHash": "sha256-EdTNjwCmgug/NXdxGsLapSOpwJebf0ruU5qkmXjY9eg=", "narHash": "sha256-ckBxRe2wjUiUzDQWs/WM+x0HgnRUjoZiHzO2c408dFg=",
"owner": "CHN-beta", "owner": "CHN-beta",
"repo": "nixos", "repo": "nixos",
"rev": "1957d682473ee67f96ace3ce3320c89b77aec8ae", "rev": "5ffdec57c08307cc2589ec57169d72cb68cf7c8b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -852,11 +852,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694664321, "lastModified": 1696478570,
"narHash": "sha256-NLuFP5JW2LRJTUg0zpeYXS14KjtrgTpFdhH0T7YqEpc=", "narHash": "sha256-Zqktub0f4M8K0jDHFYaTwsGUddkH3UqHU0NNfGJmIKY=",
"owner": "nixpak", "owner": "nixpak",
"repo": "nixpak", "repo": "nixpak",
"rev": "9dd948303ea4c7d531e0775146b1b7fd969994c9", "rev": "271e01d3912c5c622ca7fa99d63d790bea980de0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -951,11 +951,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1695562663, "lastModified": 1696511470,
"narHash": "sha256-cnPZFTKQGldgFHWC9LHt8mDtJVTmj4WJxvKHF5uw5qA=", "narHash": "sha256-eSIw2JSXKHjZwkZGM2d6Cj2/ega6+cqoWZ+EM6lWY04=",
"owner": "CHN-beta", "owner": "CHN-beta",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "82e02a1546fc59bc496f859e446ddcd412f09849", "rev": "c3cf1cffb3e119bd166c51ca86605c1cf12988d9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -999,11 +999,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1695281058, "lastModified": 1696511131,
"narHash": "sha256-YQs/xiqOW081DCqkeVc+Eonapo0fBCUGwy/5SD1rKTI=", "narHash": "sha256-IIhn6F8D26Kix77guTW/4KdpwBzpSHJ3mjG1C8FAwHc=",
"owner": "CHN-beta", "owner": "CHN-beta",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "53bdd8bdc15e678f30e450f5be8ef3cee572b11a", "rev": "1bac8e4beb5b30458994710236b9db265829327b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1015,11 +1015,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1695360818, "lastModified": 1696604326,
"narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1031,11 +1031,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1695048039, "lastModified": 1696506445,
"narHash": "sha256-zbJJylG0nrr6bP4+UXK10m2h9Kae5OUeYntU6rli02o=", "narHash": "sha256-ozu7YxmHsvxSyQazVlkajF8A8U7TaXz3asCL5hFxgNk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "e57ad2a4d59c577780da709180c36304a1d8106c", "rev": "0178289e0bd913fe9847605b01d6e15b7d076f6e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1055,11 +1055,11 @@
"nvfetcher": "nvfetcher" "nvfetcher": "nvfetcher"
}, },
"locked": { "locked": {
"lastModified": 1695017238, "lastModified": 1696487499,
"narHash": "sha256-JoGZyYAnWZnq8NPu+ptmydA9s/96kb518fY5Q56FcHE=", "narHash": "sha256-wvrBwhLpdF+oK5v3Lzgb1Yhz3vT1DHzIL3HKST/tCwU=",
"owner": "xddxdd", "owner": "xddxdd",
"repo": "nur-packages", "repo": "nur-packages",
"rev": "6e5f2de9db2dede7f1bf350b97adff4901209352", "rev": "9e53a952689cacfd88987c55466450e3076ced05",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1144,11 +1144,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693829707, "lastModified": 1696260682,
"narHash": "sha256-nBFIF+a1aqDIzmi+1Hue3zVXI4V4tK5R4aW2lyNXIXs=", "narHash": "sha256-iccjl57qw6aEe9nsCYFbF2bl7NEI/3Y4cn1U+QYvrFk=",
"owner": "Nix-QChem", "owner": "Nix-QChem",
"repo": "NixOS-QChem", "repo": "NixOS-QChem",
"rev": "ac7ffea07370d0df2c2b934ea582f0cc8acd0ae1", "rev": "7324cb54b7687718ed7b05581998f105fe2fd3e3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1175,11 +1175,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694495315, "lastModified": 1696320910,
"narHash": "sha256-sZEYXs9T1NVHZSSbMqBEtEm2PGa7dEDcx0ttQkArORc=", "narHash": "sha256-fbuEc6wylH+0VxG48lhPBK+SQJHfo2lusUwWHZNipIM=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "ea208e55f8742fdcc0986b256bdfa8986f5e4415", "rev": "746c7fa1a64c1671a4bf287737c27fdc7101c4c2",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -16,8 +16,8 @@
devShell.x86_64-linux = pkgs.mkShell.override { stdenv = pkgs.gcc13Stdenv; } devShell.x86_64-linux = pkgs.mkShell.override { stdenv = pkgs.gcc13Stdenv; }
{ {
packages = with pkgs; [ pkg-config cmake ninja ]; packages = with pkgs; [ pkg-config cmake ninja ];
buildInputs = (with pkgs; [ eigen yaml-cpp fmt highfive tbb_2021_8.dev ]) buildInputs = (with pkgs; [ eigen yaml-cpp fmt highfive tbb_2021_8.dev glfw libGL ])
++ (with localPackages; [ concurrencpp matplotplusplus zpp-bits ]); ++ (with localPackages; [ concurrencpp matplotplusplus zpp-bits glad ]);
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
# NIX_DEBUG = "1"; # NIX_DEBUG = "1";
}; };

View File

@ -22,6 +22,7 @@
# include <highfive/H5File.hpp> # include <highfive/H5File.hpp>
# include <zpp_bits.h> # include <zpp_bits.h>
# include <matplot/matplot.h> # include <matplot/matplot.h>
# include <matplot/backend/opengl.h>
// 在相位中, 约定为使用 $\exp (2 \pi i \vec{q} \cdot \vec{r})$ 来表示原子的运动状态 // 在相位中, 约定为使用 $\exp (2 \pi i \vec{q} \cdot \vec{r})$ 来表示原子的运动状态
// (而不是 $\exp (-2 \pi i \vec{q} \cdot \vec{r})$) // (而不是 $\exp (-2 \pi i \vec{q} \cdot \vec{r})$)

View File

@ -217,14 +217,18 @@ namespace ufo
for (unsigned i = 0; i < values[0].size(); i++) for (unsigned i = 0; i < values[0].size(); i++)
for (unsigned j = 0; j < values.size(); j++) for (unsigned j = 0; j < values.size(); j++)
{ {
r[i][j] = 255; a[i][j] = values[j][i] * 100 * 255;
g[i][j] = 0;
b[i][j] = 0;
a[i][j] = values[j][i] * 2 * 255;
if (a[i][j] > 255) if (a[i][j] > 255)
a[i][j] = 255; a[i][j] = 255;
r[i][j] = 255;
g[i][j] = 255 - values[j][i] * 2 * 255;
if (g[i][j] < 0)
g[i][j] = 0;
b[i][j] = 255 - values[j][i] * 2 * 255;
if (b[i][j] < 0)
b[i][j] = 0;
} }
auto f = matplot::figure(true); auto f = matplot::figure<matplot::backend::gnuplot>(true);
auto ax = f->current_axes(); auto ax = f->current_axes();
auto image = ax->image(std::tie(r, g, b)); auto image = ax->image(std::tie(r, g, b));
image->matrix_a(a); image->matrix_a(a);
@ -233,6 +237,6 @@ namespace ufo
ax->x_axis().tick_length(1); ax->x_axis().tick_length(1);
ax->y_axis().tick_values(y_ticks); ax->y_axis().tick_values(y_ticks);
ax->y_axis().tick_length(1); ax->y_axis().tick_length(1);
f->save(filename); f->save(filename, "png");
} }
} }

View File

@ -9,7 +9,7 @@ Figures:
- [ 0.5, 0, 0 ] - [ 0.5, 0, 0 ]
- [ 0.3333333, 0.3333333, 0 ] - [ 0.3333333, 0.3333333, 0 ]
- [ 0, 0, 0 ] - [ 0, 0, 0 ]
Resolution: [ 1024, 400 ] Resolution: [ 1024, 1024 ]
Range: [ -5, 35 ] Range: [ -5, 35 ]
Filename: ./test/14.2.6.4.png Filename: ./test/14.2.6.4.png
YTicks: [ 0, 5, 10, 15, 20, 25, 30 ] YTicks: [ 0, 5, 10, 15, 20, 25, 30 ]