packages.ufo: add a test

This commit is contained in:
陈浩南 2024-09-03 15:10:46 +08:00
parent d67b60ded3
commit 1c4a3eea53
6 changed files with 70 additions and 2 deletions

View File

@ -1 +0,0 @@
test

View File

@ -25,3 +25,9 @@ install(TARGETS ufo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
include(CTest)
add_test(NAME fold COMMAND ufo fold ${PROJECT_SOURCE_DIR}/test/fold/config.yaml)
add_test(NAME fold-compare COMMAND ${CMAKE_COMMAND} -E compare_files fold-output.yaml
${PROJECT_SOURCE_DIR}/test/fold/output.yaml)
set_tests_properties(fold-compare PROPERTIES DEPENDS fold)

View File

@ -0,0 +1,45 @@
分为几个功能:
* fold根据要计算的单胞的 q 点路径,计算超胞中对应的 q 点路径,生成的路径再交给 phonopy 计算。
* unfold根据 phonopy 计算的结果,将超胞的结果展开到单胞中。
* plot对计算结果画图。
主要的输入输出格式均为 yaml。对于数据特别大的情况也可以从 hdf5 中读取一部分数据或者将一部分数据写入到 hdf5 文件中。
# fold
## 输入
```yaml
# 三个整数组成的向量,表示从单胞到超胞,三个晶格矢量的倍数
# 必写
SuperCellMultiplier: [2, 2, 2]
# 一个变换矩阵,表明超胞经历了怎样的扭曲。
# 可选,默认值为单位矩阵
SuperCellDeformation: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
# 一个由三个浮点数组成的向量,表示考虑的 q 点
# 必写
Qpoints:
- [0, 0, 0]
- [0.1, 0, 0]
- [0.2, 0, 0]
- [0.3, 0, 0]
- [0.4, 0, 0]
- [0.5, 0, 0]
# 一个 DataFile 类型的对象,表明输出结果到哪个文件
# 必写
OutputFile:
```
## 输出
```yaml
# 得到的 q 点坐标
Qpoints:
- [0, 0, 0]
- [0.1, 0, 0]
- [0.2, 0, 0]
- [0.3, 0, 0]
- [0.4, 0, 0]
- [0.5, 0, 0]
```

View File

@ -18,7 +18,7 @@ namespace ufo
Eigen::Matrix3d PrimativeCell;
// 单胞到超胞的格矢转换时用到的矩阵
// SuperCellMultiplier 是一个三维列向量且各个元素都是整数,表示单胞在各个方向扩大到多少倍之后,可以得到和超胞一样的体积
// SuperCsolver.hpp>mation 是一个行列式为 1 的矩阵,它表示经过 SuperCellMultiplier 扩大后,还需要怎样的变换才能得到超胞
// SuperCellDeformation 是一个行列式为 1 的矩阵,它表示经过 SuperCellMultiplier 扩大后,还需要怎样的变换才能得到超胞
// SuperCell = (SuperCellDeformation * SuperCellMultiplier.asDiagonal()) * PrimativeCell
// ReciprocalPrimativeCell = (SuperCellDeformation * SuperCellMultiplier.asDiagonal()).transpose()
// * ReciprocalSuperCell

View File

@ -0,0 +1,11 @@
SuperCellMultiplier: [ 2, 2, 2 ]
Qpoints:
- [0, 0, 0]
- [0.1, 0, 0]
- [0.2, 0, 0]
- [0.3, 0, 0]
- [0.4, 0, 0]
- [0.5, 0, 0]
OutputFile:
Filename: fold-output.yaml
Format: yaml

View File

@ -0,0 +1,7 @@
Qpoints:
- [ 0.00000000, 0.00000000, 0.00000000 ]
- [ 0.20000000, 0.00000000, 0.00000000 ]
- [ 0.40000000, 0.00000000, 0.00000000 ]
- [ 0.60000000, 0.00000000, 0.00000000 ]
- [ 0.80000000, 0.00000000, 0.00000000 ]
- [ 0.00000000, 0.00000000, 0.00000000 ]