TB2J 0.9.9rc6__tar.gz → 0.9.9rc7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. tb2j-0.9.9rc7/.github/workflows/pylint.yml.bak +23 -0
  2. tb2j-0.9.9rc7/.github/workflows/python-app.yml +44 -0
  3. tb2j-0.9.9rc7/.gitignore +131 -0
  4. tb2j-0.9.9rc7/.pre-commit-config.yaml +11 -0
  5. tb2j-0.9.9rc7/.readthedocs.yml +28 -0
  6. tb2j-0.9.9rc7/.ruff.toml +78 -0
  7. tb2j-0.9.9rc7/.travis.yml +33 -0
  8. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/PKG-INFO +11 -2
  9. tb2j-0.9.9rc7/TB2J/.gitignore +5 -0
  10. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/Jdownfolder.py +11 -9
  11. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/MAEGreen.py +96 -22
  12. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/anisotropy.py +104 -30
  13. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/exchange.py +0 -11
  14. tb2j-0.9.9rc7/TB2J/interfaces/abacus/.gitignore +2 -0
  15. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/siesta_interface.py +2 -1
  16. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_exchange.py +44 -5
  17. tb2j-0.9.9rc7/TB2J/io_exchange/io_matjes.py +225 -0
  18. tb2j-0.9.9rc7/TB2J/mathutils/fibonacci_sphere.py +74 -0
  19. tb2j-0.9.9rc7/TB2J/orbital_magmom.py +36 -0
  20. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/symmetrize_J.py +23 -12
  21. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J.egg-info/PKG-INFO +11 -2
  22. tb2j-0.9.9rc7/TB2J.egg-info/SOURCES.txt +214 -0
  23. tb2j-0.9.9rc7/buildimage.sh +51 -0
  24. tb2j-0.9.9rc7/docs/Makefile +20 -0
  25. tb2j-0.9.9rc7/docs/conf.py +61 -0
  26. tb2j-0.9.9rc7/docs/index.rst +44 -0
  27. tb2j-0.9.9rc7/docs/make.bat +35 -0
  28. tb2j-0.9.9rc7/docs/requirements.txt +3 -0
  29. tb2j-0.9.9rc7/docs/src/BFOvarT.png +0 -0
  30. tb2j-0.9.9rc7/docs/src/Contributors.rst +44 -0
  31. tb2j-0.9.9rc7/docs/src/ReleaseNotes.md +208 -0
  32. tb2j-0.9.9rc7/docs/src/SrMnO3_DOS.png +0 -0
  33. tb2j-0.9.9rc7/docs/src/abacus.md +103 -0
  34. tb2j-0.9.9rc7/docs/src/applications.rst +9 -0
  35. tb2j-0.9.9rc7/docs/src/convention.rst +18 -0
  36. tb2j-0.9.9rc7/docs/src/development.md +22 -0
  37. tb2j-0.9.9rc7/docs/src/downfold.md +28 -0
  38. tb2j-0.9.9rc7/docs/src/ecosystem.md +51 -0
  39. tb2j-0.9.9rc7/docs/src/eigen.rst +34 -0
  40. tb2j-0.9.9rc7/docs/src/extend.rst +45 -0
  41. tb2j-0.9.9rc7/docs/src/faq.rst +79 -0
  42. tb2j-0.9.9rc7/docs/src/install.rst +86 -0
  43. tb2j-0.9.9rc7/docs/src/mae.md +127 -0
  44. tb2j-0.9.9rc7/docs/src/magnon_band.assets/exchange_magnon-1593690872101.png +0 -0
  45. tb2j-0.9.9rc7/docs/src/magnon_band.assets/exchange_magnon.png +0 -0
  46. tb2j-0.9.9rc7/docs/src/magnon_band.assets/magnon_dos.png +0 -0
  47. tb2j-0.9.9rc7/docs/src/magnon_band.rst +98 -0
  48. tb2j-0.9.9rc7/docs/src/multibinit.rst +89 -0
  49. tb2j-0.9.9rc7/docs/src/openmx.rst +27 -0
  50. tb2j-0.9.9rc7/docs/src/orbital_contribution.md +80 -0
  51. tb2j-0.9.9rc7/docs/src/output.rst +52 -0
  52. tb2j-0.9.9rc7/docs/src/parameters.rst +28 -0
  53. tb2j-0.9.9rc7/docs/src/references.rst +36 -0
  54. tb2j-0.9.9rc7/docs/src/roadmap.md +8 -0
  55. tb2j-0.9.9rc7/docs/src/rotate_and_merge.rst +54 -0
  56. tb2j-0.9.9rc7/docs/src/siesta.rst +38 -0
  57. tb2j-0.9.9rc7/docs/src/spin_model_assets/canting_DMI.png +0 -0
  58. tb2j-0.9.9rc7/docs/src/spin_model_assets/tmulti5_2.png +0 -0
  59. tb2j-0.9.9rc7/docs/src/symmetry.md +42 -0
  60. tb2j-0.9.9rc7/docs/src/tutorial.rst +18 -0
  61. tb2j-0.9.9rc7/docs/src/wannier.rst +228 -0
  62. tb2j-0.9.9rc7/examples/Siesta/BccFe/Fe.1.psml +1181 -0
  63. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/EigenJq.txt +119 -0
  64. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/exchange.xml +4126 -0
  65. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/exchange_kpth.txt +8 -0
  66. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/exchange_magnon.png +0 -0
  67. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/magnon.py +3 -0
  68. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/magnon_band.json +3332 -0
  69. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/magnon_band.pdf +0 -0
  70. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/magnon_dos.png +0 -0
  71. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/magnon_dos.txt +302 -0
  72. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/mb.files +3 -0
  73. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/mb.in +33 -0
  74. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/plot.sh +1 -0
  75. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/plot_magnon_dos.sh +1 -0
  76. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/Multibinit/plot_magnon_from_json_file.py +73 -0
  77. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/TB2J.pickle +0 -0
  78. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/TomASD/exchange.exch +1381 -0
  79. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/TomASD/exchange.ucf +3 -0
  80. tb2j-0.9.9rc7/examples/Siesta/BccFe/TB2J_results/exchange.out +3097 -0
  81. tb2j-0.9.9rc7/examples/Siesta/BccFe/getJ.sh +2 -0
  82. tb2j-0.9.9rc7/examples/Siesta/BccFe/run.sh +3 -0
  83. tb2j-0.9.9rc7/examples/Siesta/BccFe/siesta.fdf +61 -0
  84. tb2j-0.9.9rc7/examples/Siesta/HcpCo/Co.1.psml +3174 -0
  85. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Multibinit/exchange.xml +7610 -0
  86. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Multibinit/mb.files +3 -0
  87. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Multibinit/mb.in +33 -0
  88. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/TB2J.pickle +0 -0
  89. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/TomASD/exchange.exch +2556 -0
  90. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/TomASD/exchange.ucf +4 -0
  91. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Vampire/input +42 -0
  92. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Vampire/vampire.UCF +644 -0
  93. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/Vampire/vampire.mat +24 -0
  94. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/exchange.out +5708 -0
  95. tb2j-0.9.9rc7/examples/Siesta/HcpCo/TB2J_results/summary.txt +10 -0
  96. tb2j-0.9.9rc7/examples/Siesta/HcpCo/getJ.sh +1 -0
  97. tb2j-0.9.9rc7/examples/Siesta/HcpCo/run.sh +3 -0
  98. tb2j-0.9.9rc7/examples/Siesta/HcpCo/siesta.fdf +63 -0
  99. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/JvsR.pdf +0 -0
  100. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Multibinit/exchange.xml +533 -0
  101. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Multibinit/mb.files +3 -0
  102. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Multibinit/mb.in +33 -0
  103. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/TB2J.pickle +0 -0
  104. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/TomASD/exchange.exch +509 -0
  105. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/TomASD/exchange.ucf +3 -0
  106. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Vampire/input +42 -0
  107. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Vampire/vampire.UCF +135 -0
  108. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/Vampire/vampire.mat +13 -0
  109. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/assigned_basis.txt +14 -0
  110. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/exchange.out +406 -0
  111. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/TB2J_results/exchange_orb_decomposition.out +1274 -0
  112. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinit.files +8 -0
  113. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinit.in +83 -0
  114. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_down.win +113 -0
  115. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_down_centres.xyz +21 -0
  116. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_down_hr.dat +24512 -0
  117. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_up.win +113 -0
  118. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_up_centres.xyz +21 -0
  119. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/abinito_w90_up_hr.dat +24512 -0
  120. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/get_J.sh +1 -0
  121. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/psp/Mn.GGA-PBESOL-JTH.xml +16818 -0
  122. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/psp/O.GGA-PBESOL-JTH.xml +12782 -0
  123. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/psp/Sr.GGA-PBESOL-JTH.xml +12646 -0
  124. tb2j-0.9.9rc7/examples/abinit-w90/SrMnO3/run.sh +6 -0
  125. tb2j-0.9.9rc7/requirements.txt +10 -0
  126. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/setup.py +1 -1
  127. tb2j-0.9.9rc7/upload_to_pip.sh +5 -0
  128. tb2j-0.9.9rc6/TB2J.egg-info/SOURCES.txt +0 -98
  129. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/LICENSE +0 -0
  130. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/README.md +0 -0
  131. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/Jtensor.py +0 -0
  132. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/MAE.py +0 -0
  133. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/Oiju.py +0 -0
  134. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/Oiju_epc.py +0 -0
  135. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/__init__.py +0 -0
  136. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/basis.py +0 -0
  137. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/citation.py +0 -0
  138. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/contour.py +0 -0
  139. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/density_matrix.py +0 -0
  140. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/epc.py +0 -0
  141. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/exchangeCL2.py +0 -0
  142. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/exchange_params.py +0 -0
  143. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/exchange_pert.py +0 -0
  144. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/exchange_qspace.py +0 -0
  145. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/external/__init__.py +0 -0
  146. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/external/p_tqdm.py +0 -0
  147. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/gpaw_wrapper.py +0 -0
  148. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/green.py +0 -0
  149. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/greentest.py +0 -0
  150. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/__init__.py +0 -0
  151. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/__init__.py +0 -0
  152. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/abacus_api.py +0 -0
  153. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/abacus_wrapper.py +0 -0
  154. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/gen_exchange_abacus.py +0 -0
  155. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/orbital_api.py +0 -0
  156. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/stru_api.py +0 -0
  157. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/test_density_matrix.py +0 -0
  158. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/test_read_HRSR.py +0 -0
  159. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/abacus/test_read_stru.py +0 -0
  160. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/gpaw_interface.py +0 -0
  161. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/lawaf_interface.py +0 -0
  162. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/manager.py +0 -0
  163. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/interfaces/wannier90_interface.py +0 -0
  164. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/__init__.py +0 -0
  165. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_multibinit.py +0 -0
  166. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_tomsasd.py +0 -0
  167. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_txt.py +0 -0
  168. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_uppasd.py +0 -0
  169. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_exchange/io_vampire.py +0 -0
  170. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/io_merge.py +0 -0
  171. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/kpoints.py +0 -0
  172. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mathutils/__init__.py +0 -0
  173. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mathutils/fermi.py +0 -0
  174. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mathutils/kR_convert.py +0 -0
  175. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mathutils/lowdin.py +0 -0
  176. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mathutils/rotate_spin.py +0 -0
  177. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/myTB.py +0 -0
  178. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/mycfr.py +0 -0
  179. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/orbmap.py +0 -0
  180. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/pauli.py +0 -0
  181. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/pert.py +0 -0
  182. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/plot.py +0 -0
  183. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/rotate_atoms.py +0 -0
  184. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/rotate_siestaDM.py +0 -0
  185. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/sisl_wrapper.py +0 -0
  186. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/__init__.py +0 -0
  187. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/base_parser.py +0 -0
  188. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/constants.py +0 -0
  189. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/hamiltonian.py +0 -0
  190. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/hamiltonian_terms.py +0 -0
  191. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/plot.py +0 -0
  192. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/qsolver.py +0 -0
  193. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/spin_api.py +0 -0
  194. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/spin_xml.py +0 -0
  195. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/spinham/supercell.py +0 -0
  196. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/tensor_rotate.py +0 -0
  197. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/utest.py +0 -0
  198. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/utils.py +0 -0
  199. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/versioninfo.py +0 -0
  200. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/wannier/__init__.py +0 -0
  201. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/wannier/w90_parser.py +0 -0
  202. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J/wannier/w90_tb_parser.py +0 -0
  203. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J.egg-info/dependency_links.txt +0 -0
  204. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J.egg-info/entry_points.txt +0 -0
  205. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J.egg-info/requires.txt +0 -0
  206. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/TB2J.egg-info/top_level.txt +0 -0
  207. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_downfold.py +0 -0
  208. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_eigen.py +0 -0
  209. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_magnon.py +0 -0
  210. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_magnon_dos.py +0 -0
  211. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_merge.py +0 -0
  212. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_rotate.py +0 -0
  213. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/TB2J_rotateDM.py +0 -0
  214. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/abacus2J.py +0 -0
  215. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/siesta2J.py +0 -0
  216. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/scripts/wann2J.py +0 -0
  217. {tb2j-0.9.9rc6 → tb2j-0.9.9rc7}/setup.cfg +0 -0
@@ -0,0 +1,23 @@
1
+ name: Pylint
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ python-version: ["3.8", "3.9", "3.10"]
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - name: Set up Python ${{ matrix.python-version }}
14
+ uses: actions/setup-python@v3
15
+ with:
16
+ python-version: ${{ matrix.python-version }}
17
+ - name: Install dependencies
18
+ run: |
19
+ python -m pip install --upgrade pip
20
+ pip install pylint
21
+ - name: Analysing the code with pylint
22
+ run: |
23
+ pylint $(git ls-files '*.py')
@@ -0,0 +1,44 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: Python application
5
+
6
+ on:
7
+ push:
8
+ branches: [ "master" ]
9
+ pull_request:
10
+ branches: [ "master" ]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Set up Python 3.10
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.10"
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install flake8 pytest
28
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29
+ - name: Lint with flake8
30
+ run: |
31
+ # stop the build if there are Python syntax errors or undefined names
32
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35
+ - name: Test with pytest
36
+ run: |
37
+ #pytest
38
+ # - pwd
39
+ python -m pip install .
40
+ cd examples/abinit-w90/SrMnO3
41
+ ls -lah
42
+ sh get_J.sh
43
+ cd TB2J_results/Multibinit
44
+ TB2J_magnon.py --figfname magnon.png
@@ -0,0 +1,131 @@
1
+ doc/refs/*.pdf
2
+
3
+
4
+ *.swp
5
+
6
+ # Latex
7
+ *.aux
8
+
9
+ # xyz files
10
+
11
+ .DS_Store
12
+
13
+ # Byte-compiled / optimized / DLL files
14
+ __pycache__/
15
+ *.py[cod]
16
+ *$py.class
17
+
18
+ # numpy results
19
+ *.npy
20
+
21
+ # png files
22
+
23
+ # C extensions
24
+ *.so
25
+ *.a
26
+
27
+ # Fortran extensions
28
+ *.fpp
29
+ *.mod
30
+ *.o
31
+
32
+ # F90wrap files
33
+ *.plist
34
+
35
+ # Distribution / packaging
36
+ .Python
37
+ env/
38
+ build/
39
+ develop-eggs/
40
+ dist/
41
+ downloads/
42
+ eggs/
43
+ .eggs/
44
+ lib/
45
+ lib64/
46
+ parts/
47
+ sdist/
48
+ var/
49
+ wheels/
50
+ *.egg-info/
51
+ *.egg-info/*
52
+ .installed.cfg
53
+ *.egg
54
+
55
+ # temporary files
56
+ temp/
57
+
58
+ # PyInstaller
59
+ # Usually these files are written by a python script from a template
60
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
61
+ *.manifest
62
+ *.spec
63
+
64
+ # Installer logs
65
+ pip-log.txt
66
+ pip-delete-this-directory.txt
67
+
68
+ # Unit test / coverage reports
69
+ htmlcov/
70
+ .tox/
71
+ .coverage
72
+ .coverage.*
73
+ .cache
74
+ nosetests.xml
75
+ coverage.xml
76
+ *.cover
77
+ .hypothesis/
78
+
79
+ # Translations
80
+ *.mo
81
+ *.pot
82
+
83
+ # Django stuff:
84
+ *.log
85
+ local_settings.py
86
+
87
+ # Flask stuff:
88
+ instance/
89
+ .webassets-cache
90
+
91
+ # Scrapy stuff:
92
+ .scrapy
93
+
94
+ # Sphinx documentation
95
+ docs/_build/
96
+
97
+ # PyBuilder
98
+ target/
99
+
100
+ # Jupyter Notebook
101
+ .ipynb_checkpoints
102
+
103
+ # pyenv
104
+ .python-version
105
+
106
+ # celery beat schedule file
107
+ celerybeat-schedule
108
+
109
+ # SageMath parsed files
110
+ *.sage.py
111
+
112
+ # dotenv
113
+ .env
114
+
115
+ # virtualenv
116
+ .venv
117
+ venv/
118
+ ENV/
119
+
120
+ # Spyder project settings
121
+ .spyderproject
122
+ .spyproject
123
+
124
+ # Rope project settings
125
+ .ropeproject
126
+
127
+ # mkdocs documentation
128
+ /site
129
+
130
+ # mypy
131
+ .mypy_cache/
@@ -0,0 +1,11 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.3.5
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ # --select I sorts imports
9
+ args: [ --fix, --extend-select, I ]
10
+ # Run the formatter.
11
+ - id: ruff-format
@@ -0,0 +1,28 @@
1
+ # .readthedocs.yml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+ build:
8
+ os: "ubuntu-22.04"
9
+ tools:
10
+ python: "3.11"
11
+
12
+ # Build documentation in the docs/ directory with Sphinx
13
+ sphinx:
14
+ configuration: docs/conf.py
15
+
16
+ # Build documentation with MkDocs
17
+ #mkdocs:
18
+ # configuration: mkdocs.yml
19
+
20
+ # Optionally build your docs in additional formats such as PDF
21
+ formats:
22
+ - pdf
23
+
24
+ # Optionally set the version of Python and requirements required to build your docs
25
+ python:
26
+ install:
27
+ - requirements: requirements.txt
28
+ - requirements: docs/requirements.txt
@@ -0,0 +1,78 @@
1
+ # Exclude a variety of commonly ignored directories.
2
+ exclude = [
3
+ ".bzr",
4
+ ".direnv",
5
+ ".eggs",
6
+ ".git",
7
+ ".git-rewrite",
8
+ ".hg",
9
+ ".ipynb_checkpoints",
10
+ ".mypy_cache",
11
+ ".nox",
12
+ ".pants.d",
13
+ ".pyenv",
14
+ ".pytest_cache",
15
+ ".pytype",
16
+ ".ruff_cache",
17
+ ".svn",
18
+ ".tox",
19
+ ".venv",
20
+ ".vscode",
21
+ "__pypackages__",
22
+ "_build",
23
+ "buck-out",
24
+ "build",
25
+ "dist",
26
+ "node_modules",
27
+ "site-packages",
28
+ "venv",
29
+ ]
30
+
31
+ # Same as Black.
32
+ line-length = 88
33
+ indent-width = 4
34
+
35
+ # Assume Python 3.8
36
+ target-version = "py38"
37
+
38
+ [lint]
39
+ # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
40
+ # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
41
+ # McCabe complexity (`C901`) by default.
42
+ select = ["E4", "E7", "E9", "F"]
43
+ ignore = ["E741"]
44
+
45
+ # Allow fix for all enabled rules (when `--fix`) is provided.
46
+ fixable = ["ALL"]
47
+ unfixable = []
48
+
49
+ # Allow unused variables when underscore-prefixed.
50
+ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
51
+
52
+ [format]
53
+ # Like Black, use double quotes for strings.
54
+ quote-style = "double"
55
+
56
+ # Like Black, indent with spaces, rather than tabs.
57
+ indent-style = "space"
58
+
59
+ # Like Black, respect magic trailing commas.
60
+ skip-magic-trailing-comma = false
61
+
62
+ # Like Black, automatically detect the appropriate line ending.
63
+ line-ending = "auto"
64
+
65
+ # Enable auto-formatting of code examples in docstrings. Markdown,
66
+ # reStructuredText code/literal blocks and doctests are all supported.
67
+ #
68
+ # This is currently disabled by default, but it is planned for this
69
+ # to be opt-out in the future.
70
+ docstring-code-format = false
71
+
72
+ # Set the line length limit used when formatting code snippets in
73
+ # docstrings.
74
+ #
75
+ # This only has an effect when the `docstring-code-format` setting is
76
+ # enabled.
77
+ docstring-code-line-length = "dynamic"
78
+
@@ -0,0 +1,33 @@
1
+ language: python
2
+ python:
3
+ - "3.7"
4
+ - "3.8"
5
+ - "3.9"
6
+ - "3.10"
7
+ - "3.11"
8
+ cache: pip
9
+
10
+ addons:
11
+ apt:
12
+ packages: &common_packages
13
+ - gfortran
14
+ - libatlas-base-dev
15
+ - liblapack-dev
16
+ - libnetcdf-dev
17
+ - libnetcdff-dev
18
+ - eatmydata
19
+ - ccache
20
+ before_install:
21
+ - if [[ $TRAVIS_PYTHON_VERSION == 3.7 ]]; then pip install -U importlib_metadata; fi
22
+
23
+ install:
24
+ - pip install -r requirements.txt
25
+ - pip install sisl
26
+ - pip install -e .
27
+ script:
28
+ - pwd
29
+ - cd examples/abinit-w90/SrMnO3
30
+ - ls -lah
31
+ - sh get_J.sh
32
+ - cd TB2J_results/Multibinit
33
+ - TB2J_magnon.py --figfname magnon.png
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: TB2J
3
- Version: 0.9.9rc6
3
+ Version: 0.9.9rc7
4
4
  Summary: TB2J: First principle to Heisenberg exchange J using tight-binding Green function method
5
5
  Author: Xu He
6
6
  Author-email: mailhexu@gmail.com
@@ -24,5 +24,14 @@ Requires-Dist: packaging>=20.0
24
24
  Requires-Dist: HamiltonIO>=0.1.9
25
25
  Requires-Dist: pre-commit
26
26
  Requires-Dist: sympair>0.1.0
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: license
32
+ Dynamic: license-file
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
27
36
 
28
37
  TB2J is a Python package aimed to compute automatically the magnetic interactions (superexchange and Dzyaloshinskii-Moriya) between atoms of magnetic crystals from DFT Hamiltonian based on Wannier functions or Linear combination of atomic orbitals. It uses the Green's function method and take the local rigid spin rotation as a perturbation. The package can take the output from Wannier90, which is interfaced with many density functional theory codes or from codes based on localised orbitals. A minimal user input is needed, which allows for an easily integration into a high-throughput workflows.
@@ -0,0 +1,5 @@
1
+ *.o
2
+ *.x
3
+ *.mod
4
+ exchanges.sublime-project
5
+ exchanges.sublime-workspace
@@ -1,7 +1,9 @@
1
1
  import os
2
2
  from collections import defaultdict
3
+
3
4
  import numpy as np
4
5
  from ase.dft.kpoints import monkhorst_pack
6
+
5
7
  from TB2J.io_exchange import SpinIO
6
8
  from TB2J.Jtensor import decompose_J_tensor
7
9
 
@@ -73,8 +75,8 @@ class JDownfolder:
73
75
  class PWFDownfolder:
74
76
  def __init__(self, JR, Rlist, iM, iL, qmesh, atoms=None, iso_only=False, **kwargs):
75
77
  from lawaf.interfaces.magnon.magnon_downfolder import (
76
- MagnonWrapper,
77
78
  MagnonDownfolder,
79
+ MagnonWrapper,
78
80
  )
79
81
 
80
82
  model = MagnonWrapper(JR, Rlist, atoms)
@@ -92,13 +94,13 @@ class PWFDownfolder:
92
94
  # anchors={(0, 0, 0): (-1, -2, -3, -4)},
93
95
  # anchors={(0, 0, 0): ()},
94
96
  # use_proj=True,
95
- enhance_Amn=2.0,
97
+ enhance_Amn=0.0,
96
98
  )
97
99
  params.update(kwargs)
98
100
  wann.set_parameters(**params)
99
101
  print("begin downfold")
100
102
  ewf = wann.downfold()
101
- ewf.save_hr_pickle("downfolded_JR.pickle")
103
+ # ewf.save_hr_pickle("downfolded_JR.pickle")
102
104
 
103
105
  # Plot the band structure.
104
106
  wann.plot_band_fitting(
@@ -135,7 +137,7 @@ class JDownfolder_pickle:
135
137
  qmesh=[7, 7, 7],
136
138
  iso_only=False,
137
139
  method="pwf",
138
- **kwargs
140
+ **kwargs,
139
141
  ):
140
142
  self.exc = SpinIO.load_pickle(path=inpath, fname="TB2J.pickle")
141
143
 
@@ -193,7 +195,7 @@ class JDownfolder_pickle:
193
195
  qmesh=self.qmesh,
194
196
  atoms=self.atoms,
195
197
  iso_only=self.iso_only,
196
- **kwargs
198
+ **kwargs,
197
199
  )
198
200
  Jd, Rlist = d.get_JR()
199
201
  return Jd, Rlist
@@ -274,10 +276,10 @@ class JDownfolder_pickle:
274
276
  def test():
275
277
  # pass
276
278
  # inpath = "/home/hexu/projects/NiCl2/vasp_inputs/TB2J_results"
277
- # inpath = "/home/hexu/projects/TB2J_example/CrI3/TB2J_results"
278
- inpath = "/home/hexu/projects/TB2J_projects/NiCl2/TB2J_NiCl/TB2J_results"
279
- fname = os.path.join(inpath, "TB2J.pickle")
280
- p = JDownfolder_pickle(
279
+ inpath = "/home/hexu/projects/TB2J_example/CrI3/TB2J_results"
280
+ # inpath = "/home/hexu/projects/TB2J_projects/NiCl2/TB2J_NiCl/TB2J_results"
281
+ _fname = os.path.join(inpath, "TB2J.pickle")
282
+ _p = JDownfolder_pickle(
281
283
  inpath=inpath, metals=["Ni"], ligands=["Cl"], outpath="TB2J_results_downfolded"
282
284
  )
283
285
 
@@ -1,13 +1,17 @@
1
+ import gc
1
2
  from pathlib import Path
2
3
 
4
+ import matplotlib.pyplot as plt
3
5
  import numpy as np
4
6
  import tqdm
5
7
  from HamiltonIO.abacus.abacus_wrapper import AbacusSplitSOCParser
6
8
  from HamiltonIO.model.occupations import GaussOccupations
7
9
  from typing_extensions import DefaultDict
8
10
 
11
+ from TB2J.anisotropy import Anisotropy
9
12
  from TB2J.exchange import ExchangeNCL
10
13
  from TB2J.external import p_map
14
+ from TB2J.mathutils.fibonacci_sphere import fibonacci_semisphere
11
15
 
12
16
  # from HamiltonIO.model.rotate_spin import rotate_Matrix_from_z_to_axis, rotate_Matrix_from_z_to_sperical
13
17
  # from TB2J.abacus.abacus_wrapper import AbacusWrapper, AbacusParser
@@ -23,12 +27,21 @@ def get_occupation(evals, kweights, nel, width=0.1):
23
27
 
24
28
  class MAEGreen(ExchangeNCL):
25
29
  def __init__(self, angles=None, **kwargs):
30
+ """
31
+ angles are defined as theta, phi pairs, where theta is the angle between the z-axis and the magnetization direction, and phi is the angle between the x-axis and the projection of the magnetization direction on the x-y plane.
32
+ """
26
33
  super().__init__(**kwargs)
27
34
  self.natoms = len(self.atoms)
28
35
  if angles is None or angles == "axis":
29
36
  self.set_angles_axis()
30
37
  elif angles == "scan":
31
38
  self.set_angles_scan()
39
+ elif angles == "fib":
40
+ self.set_angles_fib()
41
+ elif angles == "random":
42
+ self.set_angles_random()
43
+ elif angles == "miller":
44
+ self.set_angles_miller()
32
45
  else:
33
46
  self.thetas = angles[0]
34
47
  self.phis = angles[1]
@@ -39,9 +52,32 @@ class MAEGreen(ExchangeNCL):
39
52
  self.es_atom_orb = DefaultDict(lambda: 0)
40
53
 
41
54
  def set_angles_axis(self):
42
- """theta and phi are defined as the x, y, z, axis."""
43
- self.thetas = [0, np.pi / 2, np.pi / 2, np.pi / 2, np.pi]
44
- self.phis = [0, 0, np.pi / 2, np.pi / 4, 0]
55
+ """theta and phi are defined as the x, y, z, xy, yz, xz, xyz, x-yz, -xyz, -x-yz axis."""
56
+ self.thetas = [0, np.pi / 2, np.pi / 2, np.pi / 2, np.pi, 0, np.pi / 2, 0, 0, 0]
57
+ self.phis = [0, 0, np.pi / 2, np.pi / 4, 0, 0, 0, np.pi]
58
+
59
+ def set_angles_miller(self, nmax=2):
60
+ """theta and angles corresponding to the miller index. remove duplicates.
61
+ e.g. 002 and 001 are the same.
62
+ """
63
+ thetas = []
64
+ phis = []
65
+ for k in range(0, nmax + 1):
66
+ for j in range(-nmax, nmax + 1):
67
+ for i in range(-nmax, nmax + 1):
68
+ if i == 0 and j == 0 and k == 0:
69
+ continue
70
+ thetas.append(np.arccos(k / np.sqrt(i**2 + j**2 + k**2)))
71
+ if i == 0 and j == 0:
72
+ phis.append(0)
73
+ else:
74
+ phis.append(np.arctan2(j, i))
75
+ self.thetas = thetas
76
+ self.phis = phis
77
+ self.angle_pairs = list(zip(thetas, phis))
78
+ # remove duplicates of angles using sets.
79
+ self.angle_pairs = list(set(self.angle_pairs))
80
+ self.thetas, self.phis = zip(*self.angle_pairs)
45
81
 
46
82
  def set_angles_scan(self, step=15):
47
83
  self.thetas = []
@@ -51,6 +87,21 @@ class MAEGreen(ExchangeNCL):
51
87
  self.thetas.append(i * np.pi / 180)
52
88
  self.phis.append(j * np.pi / 180)
53
89
 
90
+ def set_angles_random(self, n=16):
91
+ # n random pairs of theta, phi
92
+ self.thetas = np.random.random(n) * np.pi
93
+ self.phis = np.random.random(n) * 2 * np.pi
94
+
95
+ def set_angles_fib(self, n=35):
96
+ self.thetas, self.phis = fibonacci_semisphere(n)
97
+ # thetas and phis are np.array
98
+ # add (theta, phi): (pi/2, pi/2) and (pi/2, pi/4)
99
+ # self.thetas += [np.pi / 2, np.pi / 2]
100
+ # self.phis += [np.pi / 2, np.pi / 4]
101
+ for i in range(8):
102
+ self.thetas = np.concatenate([self.thetas, [np.pi / 2]])
103
+ self.phis = np.concatenate([self.phis, [np.pi * i / 8]])
104
+
54
105
  def get_band_energy_vs_angles_from_eigen(
55
106
  self,
56
107
  thetas,
@@ -79,16 +130,12 @@ class MAEGreen(ExchangeNCL):
79
130
 
80
131
  def get_perturbed(self, e, thetas, phis):
81
132
  self.tbmodel.set_so_strength(0.0)
82
- maxsoc = self.tbmodel.get_max_Hsoc_abs()
83
- maxH0 = self.tbmodel.get_max_H0_spin_abs()
84
- if maxsoc > maxH0 * 0.01:
85
- print(f"""Warning: The SOC of the Hamiltonian has a maximum of {maxsoc} eV,
86
- comparing to the maximum of {maxH0} eV of the spin part of the Hamiltonian.
87
- The SOC is too strong, the perturbation theory may not be valid.""")
88
-
89
- print(f"""Warning: The SOC of the Hamiltonian has a maximum of {maxsoc} eV,
90
- comparing to the maximum of {maxH0} eV of the spin part of the Hamiltonian.
91
- The SOC is too strong, the perturbation theory may not be valid.""")
133
+ # maxsoc = self.tbmodel.get_max_Hsoc_abs()
134
+ # maxH0 = self.tbmodel.get_max_H0_spin_abs()
135
+ # if maxsoc > maxH0 * 0.01:
136
+ # print(f"""Warning: The SOC of the Hamiltonian has a maximum of {maxsoc} eV,
137
+ # comparing to the maximum of {maxH0} eV of the spin part of the Hamiltonian.
138
+ # The SOC is too strong, the perturbation theory may not be valid.""")
92
139
 
93
140
  G0K = self.G.get_Gk_all(e)
94
141
  Hsoc_k = self.tbmodel.get_Hk_soc(self.G.kpts)
@@ -104,12 +151,12 @@ class MAEGreen(ExchangeNCL):
104
151
  GdH = G0K[ik] @ dHi
105
152
  # dE += np.trace(GdH @ G0K[i].T.conj() @ dHi) * self.kweights[i]
106
153
  # diagonal of second order perturbation.
107
- dG2diag = np.diag(GdH @ GdH)
154
+ # dG2diag = np.diag(GdH @ GdH)
108
155
  # dG2 = np.einsum("ij,ji->ij", GdH, GdH)
109
156
  dG2 = GdH * GdH.T
110
157
  dG2sum = np.sum(dG2)
111
158
  # print(f"dG2sum-sum: {dG2sum}")
112
- dG2sum = np.sum(dG2diag)
159
+ # dG2sum = np.sum(dG2diag)
113
160
 
114
161
  # dG2sum = np.trace(GdH @ GdH)
115
162
  # print(f"dG2sum-Tr: {dG2sum}")
@@ -130,13 +177,11 @@ class MAEGreen(ExchangeNCL):
130
177
  + dE_atom_orb[1::2, ::2]
131
178
  + dE_atom_orb[::2, 1::2]
132
179
  )
180
+ dE_atom = np.sum(dE_atom_orb)
133
181
  mmat = self.mmats[iatom]
134
182
  dE_atom_orb = mmat.T @ dE_atom_orb @ mmat
135
-
136
183
  dE_angle_atom_orb[(iangle, iatom)] += dE_atom_orb
137
-
138
- dE_atom = np.sum(dG2diag[iorb]) * self.G.kweights[ik]
139
- # dE_atom = np.sum(dE_atom_orb)
184
+ # dE_atom = np.sum(dG2diag[iorb]) * self.G.kweights[ik]
140
185
  dE_angle_atom[iangle, iatom] += dE_atom
141
186
  return dE_angle, dE_angle_atom, dE_angle_atom_orb
142
187
 
@@ -189,10 +234,25 @@ class MAEGreen(ExchangeNCL):
189
234
  for key, value in self.es_atom_orb.items():
190
235
  self.es_atom_orb[key] = -np.imag(value) / (2 * np.pi)
191
236
 
192
- def output(self, output_path="TB2J_anisotropy", with_eigen=True):
237
+ def fit_anisotropy_tensor(self):
238
+ self.ani = Anisotropy.fit_from_data(self.thetas, self.phis, self.es)
239
+ return self.ani
240
+
241
+ def output(
242
+ self,
243
+ output_path="TB2J_anisotropy",
244
+ with_eigen=True,
245
+ figure3d="MAE_3d.png",
246
+ figure_contourf="MAE_contourf.png",
247
+ ):
193
248
  Path(output_path).mkdir(exist_ok=True)
194
249
  fname = f"{output_path}/MAE.dat"
195
250
  fname_orb = f"{output_path}/MAE_orb.dat"
251
+ fname_tensor = f"{output_path}/MAE_tensor.dat"
252
+ if figure3d is not None:
253
+ fname_fig3d = f"{output_path}/{figure3d}"
254
+ if figure_contourf is not None:
255
+ fname_figcontourf = f"{output_path}/{figure_contourf}"
196
256
 
197
257
  # ouput with eigenvalues.
198
258
  if with_eigen:
@@ -208,15 +268,29 @@ class MAEGreen(ExchangeNCL):
208
268
  f.write("\n")
209
269
 
210
270
  with open(fname, "w") as f:
211
- f.write("# theta, phi, MAE(total), MAE(atom-wise) Unit: meV\n")
271
+ f.write("# theta (rad), phi(rad), MAE(total), MAE(atom-wise) Unit: meV\n")
212
272
  for i, (theta, phi, e, es) in enumerate(
213
273
  zip(self.thetas, self.phis, self.es, self.es_atom)
214
274
  ):
215
- f.write(f"{theta:.5f} {phi:.5f} {e*1e3:.8f} ")
275
+ f.write(f"{theta%np.pi:.5f} {phi%(2*np.pi):.5f} {e*1e3:.8f} ")
216
276
  for ea in es:
217
277
  f.write(f"{ea*1e3:.8f} ")
218
278
  f.write("\n")
219
279
 
280
+ self.ani = self.fit_anisotropy_tensor()
281
+ with open(fname_tensor, "w") as f:
282
+ f.write("# Anisotropy tensor in meV\n")
283
+ f.write(f"{self.ani.tensor_strings(include_isotropic=False)}\n")
284
+
285
+ if figure3d is not None:
286
+ self.ani.plot_3d(figname=fname_fig3d, show=False)
287
+
288
+ if figure_contourf is not None:
289
+ self.ani.plot_contourf(figname=fname_figcontourf, show=False)
290
+
291
+ plt.close()
292
+ gc.collect()
293
+
220
294
  with open(fname_orb, "w") as f:
221
295
  f.write("=" * 80 + "\n")
222
296
  f.write("Orbitals for each atom: \n")