3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-12 17:13:48 +01:00

Compare commits

...

642 Commits
2.2.x ... 3.1.0

Author SHA1 Message Date
Alexander Hampel
6c94c72a8f update README 2022-03-09 12:28:30 -05:00
Alexander Hampel
d6e04091b0
Merge pull request #208 from hschnait/new_gf_struct
Modify gf_struct to be in line with triqs/3.1.x
2022-03-09 12:22:06 -05:00
Alexander Hampel
320b2d2dfd remove gf_struct_flatten function and replace with triqs version 2022-03-09 09:15:10 -05:00
Hermann Schnait
d28fe3c1ef Update Changelog 2022-03-09 12:23:54 +01:00
Hermann Schnait
23d689f8f7 Issue a Warning when old gf_struct is provided 2022-03-09 12:23:26 +01:00
Hermann Schnait
4c44dbe2af Remove tkinter import (don't know how this ended up in the code) 2022-03-09 10:07:10 +01:00
hschnait
507fe32308 Update Unit-Tests to new gfstruct 2022-03-08 18:50:17 +01:00
hschnait
c2a53ab835 Update Unit-Tests for new gf_struct 2022-03-08 18:49:40 +01:00
hschnait
c8806ddda8 Updatye SumkDFT_Tools to new gf_struct 2022-03-08 18:49:12 +01:00
hschnait
660807fe25 Small bugfix in sumkdft 2022-03-08 18:22:57 +01:00
hschnait
33200f9b8a Add backwards-compatibility in constructor of block_strucutre 2022-03-08 18:21:32 +01:00
hschnait
cbeb26cc7f Update trans_basis for new gf_struct convention. 2022-03-08 17:47:36 +01:00
hschnait
abf70b6ead Update map_gf_struct_solver function to new gf_struct convention 2022-03-08 17:38:50 +01:00
hschnait
0a95ffd9d0 Modify block_structure for new gf_struct convention. 2022-03-08 17:22:48 +01:00
Hermann Schnait
9bac476c5f Use rotloc matrix in add_dc only when use_rotations is True (Issue #190) 2022-03-08 09:39:09 -05:00
hschnait
a8338819f0 Update SumkDFT for new gf_struct 2022-03-08 14:35:01 +01:00
hschnait
9ae739afd0 Update Docstrings in SK properties 2022-03-08 11:19:58 +01:00
Alexander Hampel
c4db7e6867 update documentation to use autosummary
* remove manual module reference files
* move hdf5 structure reference to guide
* fix various doc strings
* remove very old update_archive python script for triqs 1.2
* refine main documentation.rst file -> better overview
2022-03-02 14:13:12 -05:00
Alexander Hampel
9a512320d2 update changelog for 3.1.x 2022-03-01 17:32:26 -05:00
Alexander Hampel
7d934429d4
Merge pull request #206 from Lidra1/unstable
BUGFIX: negative k vectors in QE nscf.out
2022-03-01 12:51:39 -05:00
Alexander Hampel
94630a4495
Merge pull request #205 from phibeck/sumk_bugfix
Bugfix for analyse_block_structure in sumk_dft
2022-03-01 12:01:03 -05:00
acarta
f30d14fbd1 BUGFIX: changed character in QE output for reading occupations with
negative k vector
2022-03-01 14:51:37 +01:00
Hermann Schnait
64dd1cb167 Update docstring for extract_G_loc concering n_inequiv_shells and n_corr_shells 2022-03-01 09:31:01 +01:00
Nils Wentzell
b12eebdf1b Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2022-02-28 15:20:12 -05:00
Nils Wentzell
58298e35ea Merge remote-tracking branch 'app4triqs-remote/3.1.x' into unstable 2022-02-28 15:18:51 -05:00
Nils Wentzell
125eddfa7c [doc] Minor formatting correction in doc/documentation.rst 2022-02-28 11:57:08 -05:00
Nils Wentzell
b74b87fc4b Bump version number in conda/meta.yaml 2022-02-24 17:51:08 -05:00
phibeck
3cd95dcd02 Bugfix for analyse_block_structure in sumk_dft
This caused inconsistencies between the shapes of Hloc and density_matrix,
since they were in the shape of n_corr_shells vs n_inequiv_shells, respectively.
2022-02-18 16:38:01 -05:00
Nils Wentzell
b5a85e3034 Squash app4triqs/3.1.x to reduce skeleton history when tracking
Co-authored-by: Dylan Simon <dylan@dylex.net>
Co-authored-by: Alexander Hampel <ahampel@flatironinstitute.org>
2022-02-17 17:04:28 -05:00
Alexander Hampel
8362b69e28 properly load module and add toctree for class generation 2022-02-17 16:42:44 -05:00
Alexander Hampel
d9c66bf77f enable autosummary in sphinx 2022-02-17 16:42:44 -05:00
Nils Wentzell
dcb5456162 Update template for easybuild config file 2022-02-16 10:25:50 -05:00
Nils Wentzell
4f183b9bb2 Run port_to_triqs3 script 2022-02-10 15:34:45 -05:00
Nils Wentzell
157d5d2549 [doc] Update Changelog for 3.1.0 2022-02-07 17:06:18 -05:00
Dylan Simon
289265af40 [jenkins] remove bouncing email address 2022-01-25 19:33:42 -05:00
Nils Wentzell
3b1d926dae [ghactions] Correction to build.yml for macos-11 2022-01-24 14:55:00 -05:00
Nils Wentzell
6cae099a1b [ghactions] Switch back to macos-11 workers as macos-12 ones are not yet available 2022-01-24 14:34:25 -05:00
Nils Wentzell
63d06e5444 [ghactions] Switch from macos-11 to macos-12 2022-01-20 16:33:39 -05:00
Nils Wentzell
60b27ad3c9 [jenkins] Build argument -DBuild_Deps=Always no longer needed, is now the default 2022-01-20 15:38:11 -05:00
Nils Wentzell
4b6cc21a2c [cmake] Fix warning in FindSphinx.cmake 2022-01-20 15:28:46 -05:00
Nils Wentzell
67e07551f7 [ghactions] Fix: Run llvm install script for version 13 instead of 12 2022-01-20 15:28:32 -05:00
Alexander Hampel
558572de90
Merge pull request #201 from phibeck/w90
Previous commit still not correct for multiple impurities. For now re…
2021-12-20 15:44:07 -05:00
phibeck
2e8d66ab5c Previous commit still not correct for multiple impurities. For now restrict to just a single impurity. 2021-12-20 08:14:36 -05:00
Alexander Hampel
3a10b0366a
Merge pull request #200 from phibeck/w90
Bugfix in Wannier90Converter
2021-12-17 15:34:22 -05:00
phibeck
9a33958161 Bugfix in Wannier90COnverter such that add_lambda can be used for multiple impurities 2021-12-17 14:39:25 -05:00
Alexander Hampel
cd1672cad7
Merge pull request #199 from phibeck/w90
Make sure Wannier90 Hamiltonian is Hermitian (remove diagonal complex entries)
2021-12-16 16:41:51 -05:00
phibeck
a995f114ae This fix ensures than in the bloch_basis=False mode the complex diagonal components of the Hamiltonian are zero. If this is not checked it can lead to instabilities in the inversion for G_latt, which is a problem for ReFreq Green's functions 2021-12-15 17:35:39 -05:00
Alexander Hampel
64bbe9925b
Merge pull request #198 from AlynJ/unstable
elk interface bug fixes
2021-12-15 09:36:12 -05:00
Alyn James
e2c038ae8a elk interface bug fixs 2021-12-15 12:57:57 +00:00
Nils Wentzell
e58cd8c19d Bump clang version for github action build from 12 to 13 2021-12-14 17:39:10 -05:00
Nils Wentzell
cdcb46dca9 [cmake] No longer set CPLUS_INCLUDE_PATH and LIBRARY_PATH in triqsvars.sh, already done through cmake target 2021-11-18 16:37:20 -05:00
Alexander Hampel
f82af2823c update gtest branch master -> main 2021-11-16 12:07:34 -05:00
Nils Wentzell
32e399a384 [cmake] Fix googletest master branch was renamed to main 2021-11-16 12:06:50 -05:00
Alexander Hampel
2350b99193
add indmftpr helper script for dmftproj (#186)
* helper script to write inmdftpr file
* add init_dmftpr to cmake lists and adapt documentation
* docstring fro init_dmftpr


Co-authored-by: Hermann Schnait <42941106+hschnait@users.noreply.github.com>
Co-authored-by: Alexander Hampel <ahampel@flatironinstitute.org>
2021-11-16 09:59:04 -05:00
harrisonlabollita
b15e9bef03 docstring fro init_dmftpr 2021-11-16 06:59:32 -07:00
Alexander Hampel
d63f4b1448
Merge pull request #191 from phibeck/w90
Wannier90Converter abort in case of incorrectly mapped shells
2021-11-15 15:22:01 -05:00
phibeck
e06653d7bb This fix in the Wannier90Converter makes the function find_rot_mat
safer to use in case there are errors in finding the correct mapping.
The converter will now abort if the agreement in mapping is below a
user-definable threshold.
2021-11-15 15:20:08 -05:00
Alexander Hampel
b16374be5f add init_dmftpr to cmake lists and adapt documentation 2021-11-09 08:27:04 -05:00
Harry LaBollita
0d25d7eb15 Update bin/init_dmftpr
Co-authored-by: Hermann Schnait <42941106+hschnait@users.noreply.github.com>
2021-11-08 17:03:33 -05:00
Harry LaBollita
0c4c63f917 Update bin/init_dmftpr
Co-authored-by: Hermann Schnait <42941106+hschnait@users.noreply.github.com>
2021-11-08 17:03:33 -05:00
harrisonlabollita
ab7d2f5151 add basis from file 2021-11-08 17:03:33 -05:00
harrisonlabollita
df7c885705 fixed edge cases 2021-11-08 17:03:33 -05:00
harrisonlabollita
5ff53d6dc6 minor tweaks 2021-11-08 17:03:32 -05:00
harrisonlabollita
27f642b11d helper script to write inmdftpr file 2021-11-08 17:03:32 -05:00
Alexander Hampel
b8b1b6b77d
Merge pull request #189 from phibeck/calc_density_correction_qe
Calc_density_correction with Quantum Espresso
2021-11-04 15:40:10 -04:00
phibeck
48da44eda2 Adapt sumk_dft for charge self-consistency with Quantum Espresso 2021-11-04 15:18:15 -04:00
Alexander Hampel
8fb173ef5a
Merge pull request #185 from jkarp314/vectorize_omega
Vectorize omega when calculating spectral function
2021-10-14 08:12:30 -04:00
Jonathan Karp
3b9a9dab9c vectorize loop over frequencies in spaghettis 2021-10-13 17:37:33 -04:00
Jonathan Karp
baec3b2f31 vectorize loop over frequency in dos functions and add tests 2021-10-13 14:09:48 -04:00
Alexander Hampel
da260535d2 fix package information in doc installation and some broken links 2021-09-30 12:17:50 -04:00
Alexander Hampel
c0242118b0
Merge pull request #180 from phibeck/w90
- Documentation update of the w90 interface
- fix bloch basis version of w90 converter
2021-09-29 10:00:49 -04:00
phibeck
2d6f66cbb8 Update Documentation of W90 Converter 2021-09-28 14:32:30 -04:00
phibeck
17ac9209e3 Bugfix if using bloch_basis = True and multiple inequivalent shells 2021-09-28 14:32:29 -04:00
Alexander Hampel
ec1b336f75
Update AUTHORS.txt 2021-09-24 15:55:33 -04:00
Alexander Hampel
03a85c94fa bump version up to 3.1 from app4triqs 2021-09-17 15:55:46 -04:00
Alexander Hampel
772120979a add logos for Flatiron and Simons Foundation 2021-09-17 15:53:45 -04:00
Nils Wentzell
4064207dd0 [cmake] Require triqs3.1+ in debian package dependencies 2021-09-17 15:33:19 -04:00
Nils Wentzell
35fc17f807 [cmake] Bump required TRIQS Version to 3.1 2021-09-17 15:27:58 -04:00
Nils Wentzell
0725799054 [cmake] Bump app4triqs version number to 3.1.0 2021-09-17 15:27:42 -04:00
Alexander Hampel
29c7c337b1 merge latest app4trqs skeleton changes 2021-09-17 14:24:22 -04:00
hschnait
b924f85fde Bugfixes in blockstructure.py for the case of #corr_shells != #ineq_shells 2021-08-31 08:01:12 +02:00
Nils Wentzell
e2332d4de6 [doc] Make sure to install ttf, woff2 and eot files 2021-08-18 16:45:44 -04:00
Alexander Hampel
17eee7a13d final version of the new rtd design update 2021-08-18 16:29:33 -04:00
Alexander Hampel
a06301304f change to read the docs sphinx theme 2021-08-18 16:29:33 -04:00
Alexander Hampel
f66848f303 fix Vasp INCAR for NiO example 2021-08-16 12:58:22 -04:00
Alexander Hampel
a1b5421864 fix for python binary, c order for arrays, and NiO tutorial 2021-08-16 12:51:55 -04:00
Alexander Hampel
d5401cb4c0
Merge pull request #173 from thenoursehorse/plovasp-kweight-fix
Normalization of kwghts in plovasp
2021-06-23 08:33:01 -04:00
H. L. Nourse
75a7749180 fixed normalization of kwghts to allow symmetries - very tunnel visioned and haven't checked anything else 2021-06-22 14:44:17 +10:00
Dylan Simon
4a74b446a2 [jenkins] set OMP_NUM_THREADS 2021-06-15 10:13:55 -04:00
Nils Wentzell
84d45485f9 [ghactions] Install libomp in Ubuntu setup 2021-06-11 09:25:32 -04:00
Hermann Schnait
db8a7e543e Bugfix in block_structure.py
In the (rare) case that one has multiple shells with different number of orbitals (e.g. p-d-systems) the old code crashed when converting GFs from the second shell as matrix dimensions were not fitting (the tmp matrix was always created for the first shell).
2021-06-09 14:28:46 -04:00
Nils Wentzell
1c6d29d6a3 [cmake] For ANALYZE_SOURCES=ON run cppcheck in c++20 mode 2021-06-07 14:20:10 -04:00
Nils Wentzell
31649d25b2 [cmake] Bump version requirement to 3.12.4 for cxx_std_20 availability 2021-06-07 14:11:19 -04:00
Nils Wentzell
755381be4b Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2021-06-03 15:03:37 -04:00
Dylan Simon
a27e231c4d [jenkins] increase build parallelism to -j4 2021-06-03 12:18:33 -04:00
Dylan Simon
1a63d0854c [jenkins] more explicit node allocation 2021-06-03 00:59:04 -04:00
Dylan Simon
8cc1949be0 [jenkins] add sanitize platform build 2021-05-28 13:11:47 -04:00
Nils Wentzell
89e1163f21 [cmake] Remove usage of linktime optimizations 2021-05-27 17:50:59 -04:00
Nils Wentzell
3c5196722f [jenkins] Bump osx gcc version to 11 2021-05-27 17:48:41 -04:00
Nils Wentzell
d902a04b67 [jenkins] Remove centos-gcc build 2021-05-27 17:48:41 -04:00
Nils Wentzell
dad5c8df94 [ghactions] Build on osx 11 (big sur) 2021-05-27 17:04:11 -04:00
Nils Wentzell
5db2431989 [ghactions] Generate VERBOSE build log on compilation failure 2021-05-27 16:16:36 -04:00
Nils Wentzell
429e625d09 [ghactions] Bump ubuntu builds to clang12 and osx builds to gcc11 2021-05-27 15:45:41 -04:00
Nils Wentzell
33b548eb59 Switch Build_Deps default from IfNotFound to Always 2021-05-27 15:30:27 -04:00
Nils Wentzell
6a8d838b20 from_L_G_R requires a Green function with data layed out in C-order 2021-05-26 17:59:50 -04:00
Nils Wentzell
b69baf140e Use nda over TRIQS_RUNTIME_ERROR in dos_tetra3d 2021-05-26 17:59:50 -04:00
Nils Wentzell
3648fd74e8 Automated porting to triqs + meshes + nda 2021-05-26 17:59:50 -04:00
Alexander Hampel
342aa363d9 fixed tests to work with dev version of triqs 2021-05-26 17:59:50 -04:00
Alexander Hampel
9b22859553 added helper function to flatten gf_struct objects for new triqs version 2021-05-26 17:59:50 -04:00
Alexander Hampel
fae1217fa4 switched lapack target from triqs to nda 2021-05-26 17:59:50 -04:00
Sophie Beck
3122ab2a83
Updates of Wannier90Converter: (#169)
Added:

substantial speed-up using MPI for Fourier transform
option to add a local spin-orbit term to t2g local Hamiltonian.
writing dft_fermi_energy to group 'dft_misc_input'
writing kpt_basis to group 'dft_input' if bloch_basis=True
writing kpts_cart to group 'dft_misc_input' if bloch_basis=True
Minor bugfixes:

bug can be caused by rounding of outer window limits if bloch_basis and disentangle =True, made error message clearer
2021-05-06 08:37:15 -04:00
merkelm
0a71b29096
Added parameter kpts_to_write to SumkDFT.calc_density_correction (#170)
Default behavior unchanged. If parameter kpts_to_write is given and if dm_type=='vasp', only the selected k points are written to the density correction GAMMA file.
Can be used for running Vasp with symmetries, where Vasp requires only the density correction from the irreducible Brillouin zone.

* For density correction in vasp, added option to select kpoints
* Made docstring of calc_density_correction clearer
2021-05-05 11:55:40 -04:00
Dylan Simon
4e1cdfe4e2 [jenkins] update osx python path for 3.9 2021-03-01 12:26:42 -05:00
Jonathan Karp
6fc01806d0 update SVO tutorial for dft tools 3
I changed the expression for gf_struct so that it works with dft_tools 3.

While I was at it, I took out the definition of 'l' since it's not used
2021-02-25 13:55:03 -05:00
Dylan Simon
ad0853b6bc Revert "[jenkins] try setting ansiColor as a build property"
This reverts commit 2a9b29741e.
2021-02-17 15:48:52 -05:00
Dylan Simon
2a9b29741e [jenkins] try setting ansiColor as a build property 2021-02-17 15:43:40 -05:00
Dylan Simon
ab32b3fb51 [jenkins] try adding ansiColor support 2021-02-17 14:28:20 -05:00
Nils Wentzell
064a3c85f9 [jenkins] For failed compilation on OSX, follow up with a serial VERBOSE=1 build 2021-02-10 10:45:35 -05:00
Nils Wentzell
07ddcb3c40 [cmake] For Build_Documentation=ON make sure PythonSupport is enabled 2021-02-09 16:39:07 -05:00
Alexander Hampel
5ac27b8f2e
Update guide on Vasp src changes for converter
The information on changes for the Vasp converter for CSC calculations in Vasp was not complete (#164 )
2021-02-08 08:04:15 -05:00
Alexander Hampel
92e24a9ada
Revision of Wannier90Converter:
1) write the Hamiltonian in Bloch space for charge self-consistent calculations, and 2) spin-orbit coupling

if bloch_basis = True:
* if "seedname_u.dat" (and in case of disentanglement "seedname_u_dis.dat")
  present, write hopping in Bloch basis
* "proj_mat" transforming from Bloch to orbital space
* diagonal hoppings are directly read from "seedname.eig"
* fermi weights and band_window of Wannier Hamiltonian are read from DFT
  output and "seedname.nnkp", written into new subgroup "dft_misc_input"
* automatic calculation of "density_required"
* implemented for Quantum Espresso (read from "seedname.nscf.out" if
  verbosity = 'high') and VASP (read from "OUTCAR"/"LOCPROJ")

* spin-orbit coupling SO = 1 implemented
* substitute k_mesh and bz_weights with kpts and kpt_weights,
  respectively (previous names kept for compatibility)
* updated tests
2021-02-05 18:08:46 -05:00
sobeck
aeaebb04ae Revision of Wannier90Converter: 1) write the Hamiltonian in Bloch space
for charge self-consistent calculations, and 2) spin-orbit coupling

if bloch_basis = True:
* if "seedname_u.dat" (and in case of disentanglement "seedname_u_dis.dat")
  present, write hopping in Bloch basis
* "proj_mat" transforming from Bloch to orbital space
* diagonal hoppings are directly read from "seedname.eig"
* fermi weights and band_window of Wannier Hamiltonian are read from DFT
  output and "seedname.nnkp", written into new subgroup "dft_misc_input"
* automatic calculation of "density_required"
* implemented for Quantum Espresso (read from "seedname.nscf.out" if
  verbosity = 'high') and VASP (read from "OUTCAR"/"LOCPROJ")

* spin-orbit coupling SO = 1 implemented
* substitute k_mesh and bz_weights with kpts and kpt_weights,
  respectively (previous names kept for compatibility)
* updated tests
2021-02-05 14:41:59 -05:00
Nils Wentzell
2d7818a85f Add scipy to requirements.txt 2021-02-05 12:09:10 -05:00
Nils Wentzell
3973147669 Add numpy to requirements.txt 2021-02-05 12:06:47 -05:00
Nils Wentzell
2fdced8d63 Add mako to requirements.txt 2021-02-05 11:49:46 -05:00
Nils Wentzell
60b1a247ce [gh-actions] Specify FC env variable during build 2021-02-03 12:24:06 -05:00
Nils Wentzell
6dccb363de Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2021-02-03 11:03:08 -05:00
Nils Wentzell
d0c0bc1cde [cmake] Clean up IPO section in CMakeLists.txt 2021-02-03 11:02:56 -05:00
Nils Wentzell
57e9896b9a [cmake] Restore compatibility against cmake version 3.9.6 2021-02-03 11:00:07 -05:00
Nils Wentzell
1baca5f156 [gh-actions] Install gfortran for OSX builds 2021-02-03 09:19:12 -05:00
Nils Wentzell
16bf47b9cc [cmake] Globally disable compiler extensions, minor improvements in CMakeLists.txt 2021-02-01 15:02:57 -05:00
Nils Wentzell
73aa51608e [cmake] In extract_flags.cmake inspect INTERFACE_COMPILE_FEATURES and add -std=.. flags accordingly 2021-02-01 09:42:03 -05:00
Nils Wentzell
efad2fe6ef [cmake] Use googletest master branch (live-at-head) instead of release-1.10.0 2021-01-22 15:39:11 -05:00
Nils Wentzell
f247db58d8 [cmake] Enable Linktime optimizations when available, bump cmake requirement to 3.9.6 2021-01-22 14:53:04 -05:00
Nils Wentzell
6bd1e51c4e [cmake] Provide an alias PROJECT_NAME::module_name for each module 2021-01-22 14:49:50 -05:00
Nils Wentzell
74cf0207dc Do not warn about c++20 extensions when using clang 2021-01-22 14:49:22 -05:00
Nils Wentzell
2b28ef836c [ghactions] Be sure to apt-get update before apt-get install 2021-01-22 14:40:20 -05:00
Alexander Hampel
4d618d36da
Merge pull request #159 from AlynJ/elkcon_bands
elk_bands_update [Doc]
2021-01-20 15:36:17 -05:00
Alyn James
c5c2f6daed elk_bands_update 2021-01-20 12:54:10 +00:00
Hermann Schnait
c02a8585a5 triqs3 bugfix in doc
Brackets for print-statement were missing
2021-01-14 09:16:18 -05:00
Alexander Hampel
e33eec8c7e
Merge pull request #154 from 70akaline/unstable
Fix bugs in website tutorial
2020-11-27 10:37:45 -05:00
70akaline
7634752eb1
symm_deg_gf var name update
The variable name is not `orb`, but `ish` at the current version

symm_deg_gf var name change

`symm_deg_gf` variable change

method `symm_deg_gf` have changed its variable `orb` to `ish`, that's fooling this method change
2020-11-26 14:10:10 +00:00
70akaline
c70e1aa483
wrong order of orbital setting and set Coulomb mat
Construct Coulomb matrix needs prior to defining the orbital
2020-11-26 14:05:34 +00:00
Alexander Hampel
93cf096932 changed fermi weights from np array complex to float in accordance with h5 structure 2020-11-24 16:35:27 -05:00
Alexander Hampel
fc2ce66238 corrections to additional h5 structure format 2020-11-24 16:03:32 -05:00
Alexander Hampel
160dc9d9ae
Merge pull request #152 from materialstheory/unstable
sum_k.calc_mu exposes dichotomy parameter max_loops
2020-10-30 17:29:52 -04:00
Nils Wentzell
4521842a07 Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2020-10-30 16:13:51 -04:00
Nils Wentzell
d4fba7b4ce [gh-actions] Install numpy scipy and mpi4py through pip3 instead of brew 2020-10-30 15:15:17 -04:00
Nils Wentzell
2446cc5843 [gh-actions] Fix broken llvm brew install command 2020-10-30 14:41:28 -04:00
Nils Wentzell
4d88bddd0b [gh-actions] Do not stop all builds if one of them fails 2020-10-30 14:40:39 -04:00
Nils Wentzell
32df9c4c5f [cmake] Set VERSION property for project library using major and minor version numbers 2020-10-30 14:39:40 -04:00
Nils Wentzell
547a7e3211 Ignore build* directories in .dockerignore 2020-10-30 14:37:34 -04:00
mmerkel
1fa2376a99 sum_k.calc_mu exposes dichotomy parameter max_loops
Default behavior unchanged
2020-10-30 18:58:57 +01:00
Alexander Hampel
b0b2a64286 removed unused debug print commands 2020-10-12 07:52:19 -04:00
Nils Wentzell
4525076ed6 Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2020-10-09 09:28:38 -04:00
Nils Wentzell
f5ebef3af8 Adjust triqsvars.sh location in github actions and conda build scripts 2020-10-09 09:25:37 -04:00
Alexander Hampel
6b393bf710
fix wrong link to image in svo tutorial 2020-10-09 08:51:16 -04:00
AlynJ
ad8c4e75fe
Elk converter (#151)
Adding Elk-TRIQS interface (first iteration) 

This interface reads in Elk's ground-state files / projectors generated by a specific Elk interface code version (https://github.com/AlynJ/Elk_interface-TRIQS). The interface can perform charge-self consistent DFT+DMFT calculations using the aforementioned Elk code version, including spin orbit-coupling. Hence, this is the first open source interfaced DFT code to triqs with FCSC support. 

The commit includes detailed documentation and tutorials on how to use this interface. Moreover, further new post-processing routines are added for Fermi surface plots and spectral functions (A(w)) from the elk inputs.

The interface was tested by A. James and A. Hampel. However, this is the first iteration of the interface and should be used with care. Please report all bugs.

List of changes:
---------------
- sumk.py: added cacluation of charge density correction for elk (dm_type='elk').
- sumk_dft_tools.py: added new post-processing functions to calculate the Fermi surface and A(w) from the Elk inputs.
- documentation and tutorial files amended for this interface.
- added python tests for the Elk converter.
2020-10-09 08:35:28 -04:00
Alexander Hampel
966ebabd79 fix for malformed cmake options table 2020-10-05 18:19:20 -04:00
Nils Wentzell
69c16ec212 Fix location of triqsvars.sh in gh actions build workflow 2020-09-30 10:35:11 -04:00
Alexander Hampel
384a45adae added note about compiler comp between triqs and dft codes 2020-09-28 14:48:06 -04:00
Nils Wentzell
d76a28c80a [cmake] Install app4triqsvars.sh into subdirectory of share only for non-system install prefix 2020-09-23 12:11:12 -04:00
Nils Wentzell
5cf590e440 [cmake] Set @PROJECT_NAME@_MODULE_DIR in config.cmake file when PythonSupport enabled 2020-09-21 09:37:31 -04:00
Nils Wentzell
d5816335f9 Merge remote-tracking branch 'app4triqs-remote/unstable' into unstable 2020-09-10 13:04:30 -04:00
Dylan Simon
556937134e Merge remote-tracking branch 'app4triqs/unstable' into unstable 2020-09-10 11:57:06 -04:00
Nils Wentzell
76cb6414f6 [cmake] Properly suppress comma subscript warning on both clang and gcc 2020-09-10 10:11:41 -04:00
Dylan Simon
b849c4383d Merge branch '3.0.x' into unstable 2020-09-10 10:02:27 -04:00
Dylan Simon
7c8d2ff37d [jenkins] update osx to python3.8 2020-09-09 19:32:24 -04:00
Dylan Simon
87637f8d68 [jenkins] switch to gcc-10 on osx 2020-09-09 19:03:28 -04:00
Nils Wentzell
5dbd12f165 [cmake] Use FindGit.cmake in external_dependency.cmake, Improve error message on clone failure 2020-09-09 15:51:00 -04:00
Nils Wentzell
14d30a1a14 [cmake] Do not warn about unkown warning options 2020-09-09 12:03:55 -04:00
Alexander Hampel
bdb901d34d
update link to dft_tools github in sidebar
The link in the sidebar of the github logo to the dft_tools repo was wrong
2020-08-26 11:19:48 +02:00
Alexander Hampel
d61ce6eaae fix for bug in wannier90 converter
* the Fermi level given in the inp file was ignored
* added a new line reporting which energy is subtracted from mu
2020-08-25 08:22:45 -04:00
sobeck
6a104622d1 renamed w90 reference h5 archive 2020-08-17 19:31:32 +02:00
sobeck
765bb6b3cb added new test in w90_convert.py for rot_mat_type='hloc_diag' 2020-08-17 19:31:32 +02:00
sobeck
393753dc96 typo in wannier90.py 2020-08-17 19:31:32 +02:00
mmerkel
c6385b16d4 Bug fix: changed use_rotations from bool to int 2020-08-17 19:31:32 +02:00
mmerkel
52d2159c18 Small bugfixes 2020-08-17 19:31:32 +02:00
mmerkel
4ebfd15803 Added Gabriele's additional checks 2020-08-17 19:31:32 +02:00
mmerkel
19a2e55183 Added choice of different bases: hloc_diag, wannier (already implemented previously), none 2020-08-17 19:31:32 +02:00
mmerkel
aacb8847ac Clean-up: float comparison tolerances and few minor things 2020-08-17 19:31:32 +02:00
Nils Wentzell
9878d38a53 Merge remote-tracking branch 'app4triqs-remote/3.0.x' into unstable 2020-08-14 12:40:06 -04:00
Nils Wentzell
056c421871 Fit tail explicitly in analyse_block_structure_from_gf2.py 2020-08-13 17:17:07 -04:00
Nils Wentzell
caf5da4a3a Fix in easybuild template, check for static lib by default 2020-08-13 09:28:47 -04:00
Nils Wentzell
df285d3fb8 Merge remote-tracking branch 'app4triqs-remote/3.0.x' into unstable 2020-08-10 11:19:42 -04:00
Nils Wentzell
57a08de155 [doc] Revert to cloudflare mathjax url 2020-08-10 11:13:14 -04:00
Nils Wentzell
a15569f18b [doc] No need to store agogo sphinx theme 2020-08-10 11:13:14 -04:00
Nils Wentzell
d72b245d56 [cmake] Disable warnings about use of comma operator in subscript operator 2020-08-10 11:13:14 -04:00
Nils Wentzell
bcaf78501b Minor adjustments in easybuild template 2020-08-10 11:13:10 -04:00
Nils Wentzell
8c54de18d9 Fix mistake in naming if easybuild script 2020-08-10 09:55:31 -04:00
Nils Wentzell
cb4f4711cb [doc] Fix sidebar version number 2020-08-08 21:19:37 -04:00
Nils Wentzell
0e3c3a48a5 Fix osx build environment in github actions workflow 2020-08-08 20:47:23 -04:00
Nils Wentzell
de8b2bd95e Merge remote-tracking branch 'app4triqs-remote/3.0.x' into unstable 2020-08-08 16:37:03 -04:00
Nils Wentzell
e31cbd0f76 [doc] Update status badge for GH Actions 2020-08-08 15:24:13 -04:00
Nils Wentzell
23568264b5 Replace travis.yml by github workflow 2020-08-08 15:19:54 -04:00
Nils Wentzell
182550a831 [cmake] Make sure imported targets are always global, some copyright header adjustments 2020-08-07 10:53:16 -04:00
Nils Wentzell
abdc51ca94 Add template easybuild script 2020-08-06 13:44:09 -04:00
Nils Wentzell
7047ac8373 Add template for conda packaging 2020-08-06 13:44:02 -04:00
Alexander Hampel
b3763ffb0f typo fix in ChangeLog 2020-08-06 09:40:44 +02:00
Manuel Zingl
3a78f18cfc dmftproj: add option to specify band indices
This adds another option and a mode flag in dmftproj:
 * third value in window line defines now the mode
 * new option to provide an energy window where all
   bands which are within the window (at least at one k-point)
   are taken into account for the projectors.
 * updates to documention to reflects those changes
2020-08-04 17:48:06 +02:00
Alexander Hampel
1323ccbe65 fix for rst file 2020-08-04 10:58:04 +02:00
Alexander Hampel
378f743b09 Update for hdf5 structure reference
- added missing corr to inequiv information
- added a Vasp specific section and added missing information
2020-08-04 10:51:01 +02:00
Nils Wentzell
eb68c32562 Update changelog for app4triqs 3.0.0 release 2020-08-03 15:39:20 -04:00
Nils Wentzell
43720b8f8f [cmake] Use find_package over find_dependency in config.cmake.in to improve cmake version compatibility 2020-08-03 15:39:20 -04:00
Alexander Hampel
5d406b22d9 complete ChangeLog with missing commits from BSrotations branch 2020-08-03 18:53:49 +02:00
Dylan Simon
1eabf19570 Revert "[jenkins] inject test failure to test email"
This reverts commit ff8124ea24.
2020-08-03 11:32:27 -04:00
Dylan Simon
ff8124ea24 [jenkins] inject test failure to test email 2020-08-03 11:25:11 -04:00
Dylan Simon
56483b2d7d [jenkins] send email on test failure too 2020-08-03 11:24:17 -04:00
Alexander Hampel
af8cde628e small adjustments to Vasp converter (closes #146)
* adding kpts_basis, kpts, and kpt_weights to h5 dft_input
* read these properties as optional arguments in Sumk_dft.py
* change accordingly the ref h5 files for vasp converter test
* soon all converters are demanted to store those properties
* bz_weights should then be replaced by kpt_weights
* closes PR #146
2020-08-03 12:39:34 +02:00
Alexander Hampel
79a72fdd98 fixes CMakeLists from previous commit for running vasp tests 2020-08-03 12:25:08 +02:00
Alexander Hampel
7ce4316bbc fixed py tests for vasp converter not running, fixed test imports, rm plocar_io test (not used) 2020-08-03 12:17:16 +02:00
Nils Wentzell
e15e3232f6 [doc] Some cleaning / resorting in 3.0.0 changelog 2020-07-31 09:38:01 -04:00
Alexander Hampel
79df43d255 first draft for 3.0 changelog 2020-07-31 12:55:58 +02:00
Alexander Hampel
a158fec7eb small fix to read_inp_from_h5 function of Sumk
split things_to_read into req and optional properties. Only throw error
show warning if req parameters are missing.
2020-07-31 11:52:42 +02:00
Nils Wentzell
9c23827e01 [doc] Add missing theme images 2020-07-27 15:25:32 -04:00
Nils Wentzell
5a9fc1118b [cmake] In extract_flags.cmake, protect extraction of -L/usr/lib and fix filtering -I/usr/include 2020-07-14 18:29:39 -04:00
Nils Wentzell
e2f4e9988e [cmake] Extend extract_flags.cmake to treat compiler-specific generator expressions properly 2020-07-14 18:29:12 -04:00
Nils Wentzell
c04128fa0d [cmake] Protect against flags -I/usr/include in extract_flags.cmake 2020-07-08 11:25:57 -04:00
Nils Wentzell
15e4c6d635 [cmake] Provide information on INSTALL_PREFIX in config.cmake files 2020-06-24 10:13:32 -04:00
Nils Wentzell
6aff3f1a39 [cmake] Default to -DBuild_Deps=IfNotFound, adjust install instructions 2020-06-24 10:13:32 -04:00
Nils Wentzell
dd33a61cc6 [cmake] When searching dependency sources, check both current dir and CMAKE_SOURCE_DIR/deps 2020-06-24 08:57:44 -04:00
Alexander Hampel
491bf30795
Merge branch 'py3' into unstable
update unstable branch with python 3 compatibility and apps4triqs compatibility.
2020-06-23 15:42:31 +02:00
Nils Wentzell
e9d06414af Merge remote-tracking branch 'app4triqs-remote/unstable' into py3 2020-06-23 09:23:50 -04:00
Alexander Hampel
9d94c78cba Merge branch 'unstable' into py3
merge latest commit de163cce03 for
enhanced warning for set_Sigma if ReFreqMesh is too small into py3
2020-06-23 11:24:08 +02:00
Alexander Hampel
de163cce03
Merge pull request #144 from jkarp314/unstable
warning for set_Sigma if ReFreqMesh is too small
2020-06-23 11:22:45 +02:00
Alexander Hampel
a1209f8a53 renamed converters from app_converter.py to app.py
* adapted all occurences of the converter script file names including
  the doc files
* fixed one failing test: Py_basis_transformation.py
2020-06-23 11:13:00 +02:00
Alexander Hampel
f27399758e Merge branch 'unstable' into py3
merged unstable into py3

* include the major changes of a94f8ed942
  of blockstructure.py
* adapted all code to python 3
* fixed all tests
2020-06-23 10:53:52 +02:00
Nils Wentzell
81096e417e [cmake] Properly set PATH environment for c++2rst custom command 2020-06-18 17:10:15 -04:00
Nils Wentzell
853ebf2d6a [cmake] No longer add '-Og' for debug builds 2020-06-18 13:58:55 -04:00
Dylan Simon
fe53a65b5f [jenkins] align Dockerfile to triqs, too 2020-06-15 10:35:10 -04:00
Dylan Simon
c99d08cbc0 [jenkins] more alignment with triqs 2020-06-15 10:27:45 -04:00
Dylan Simon
c2a4685719 [jenkins] bring into closer alignment with triqs 2020-06-15 10:20:40 -04:00
Jonathan Karp
46ecd2cd3e look at the mesh of each shell of Sigma_imp, not just the first shell 2020-06-11 20:31:31 -04:00
Jonathan Karp
88802b859c Merge branch 'unstable' of https://github.com/jkarp314/dft_tools into unstable 2020-06-11 18:15:54 -04:00
Jonathan Karp
2f0f458eb6 add function to find min and max of band energy, and add warning to set_Sigma if its mesh is smaller than the energy bounds 2020-06-11 18:13:16 -04:00
Nils Wentzell
272ac793a3 Merge remote-tracking branch 'app4triqs-remote/py3' into py3 2020-06-10 18:32:13 -04:00
Nils Wentzell
74aefcb1dc [cmake] Make sure to install python modules into their proper subdirectories 2020-06-10 18:30:49 -04:00
Nils Wentzell
9b1a3c0e7e [cmake] Make sure to install python files into their proper subdirectories 2020-06-10 18:30:10 -04:00
Nils Wentzell
d957772905 Merge remote-tracking branch 'app4triqs-remote/py3' into py3 2020-06-10 18:04:59 -04:00
Nils Wentzell
5156e45b5b [cmake] Make sure to use namespaced targets in c++ test dir 2020-06-10 17:25:03 -04:00
Nils Wentzell
354f1420c1 [doc] Minor fix in install instructions 2020-06-10 16:47:19 -04:00
Nils Wentzell
612f9b8076 [doc] Use https over http in intersphinx_mapping 2020-06-10 16:46:58 -04:00
Nils Wentzell
b6cedfb0df [cmake] Provide a namespaced alias to the PROJECT_NAME_warnings target 2020-06-10 16:46:16 -04:00
Nils Wentzell
09ed5c40ad Merge remote-tracking branch 'app4triqs-remote/py3' into py3 2020-06-10 13:38:21 -04:00
Nils Wentzell
30773dd24d Merge commit app4triqs skeleton commit 909a772 2020-06-10 13:32:22 -04:00
Nils Wentzell
a0697652a2 [jenkins] Revert notification email list after app4triqs merge 2020-06-10 13:31:46 -04:00
Dylan Simon
eb29e0f192 [jenkins] correct jenkins project name 2020-06-10 12:55:28 -04:00
Nils Wentzell
97476c1a1f Replace remaing occurances of SrVO3.h5 with SrVO3.ref.h5 2020-06-10 12:48:43 -04:00
Alexander Hampel
f4112b3cca removed SrVO3 now SrVO3.ref.h5 and changed the test 2020-06-10 18:17:16 +02:00
Alexander Hampel
8e9fbc5dc0 add missing deps dir after apps4triqs merge 2020-06-10 18:01:36 +02:00
Alexander Hampel
11d394fd5b synchronize dfttools with app4triqs structure
* moved the plovasp C++ code to c++/triqs_dft_tools/converters/vasp
* added global header triqs_dft_tools/triqs_dft_tools.hpp
* python dir based on single cmakelist file
* registered C++ tests for plovasp
* corrected imports for py3 tests for plovasp
* corrected block order in sigma_from_file and srvo3_Gloc
* exchanged ref files for sigma_from_file, srvo3_Gloc, SrVO3.ref.h5
* moved vasp converter bash scripts from dir shells to bin dir
2020-06-10 17:45:53 +02:00
Nils Wentzell
acd88f1a62 [cmake] Make sure to generate 'make VERBOSE=1' output on build failure 2020-06-09 10:40:37 -04:00
Nils Wentzell
4139230849 [doc] Update url in intersphinx_mapping for python 2020-06-08 15:36:27 -04:00
Nils Wentzell
e059d403c1 [cmake] Generalize desc file detection to allow for modules in subdirectories 2020-06-08 14:49:39 -04:00
Nils Wentzell
c98b36140a [doc] Update autorun to latest version, default to utf8 encoding 2020-06-08 14:49:06 -04:00
Manuel Zingl
0724d9d50e
Merge pull request #143 from jkarp314/unstable
optionally give Fermi energy in Wannier90 converter
2020-06-04 22:43:18 -04:00
Nils Wentzell
746710ea48 [cmake] explicitly link cpp2py modules against triqs_py library 2020-06-04 11:47:23 -04:00
jkarp314
e62839f10f
Update conv_W90.rst 2020-06-03 20:12:13 -04:00
jkarp314
e10ed91e3d
Update conv_W90.rst 2020-06-03 12:39:37 -04:00
jkarp314
0c4c793a3d
Update LaVO3_w90.inp 2020-06-03 12:35:15 -04:00
Jonathan Karp
37e0cb83d4 unit test for the Fermi energy in the wannier90 converter 2020-05-31 21:04:35 -04:00
Jonathan Karp
aa8c631c27 made fermi_energy an attribute of the converter 2020-05-31 21:04:15 -04:00
jkarp314
4cc530a129 Update wannier90_converter.py
Can specify DFT Fermi energy in the inp file and it's subtracted from the r = 0 term when reading the hr file.
2020-05-31 21:03:48 -04:00
Nils Wentzell
909a772205 [cmake] Disable setting c++ standard using target_compile_features 2020-05-28 11:50:35 -04:00
Nils Wentzell
fbe3f2fa0a [cmake] Prefer the use of PROJECT_NAME in most CMakeLists.txt files 2020-05-28 11:20:01 -04:00
Nils Wentzell
96b305fe8e [doc] Add sphinx.ext.githubpages to conf.py.in 2020-05-28 10:58:07 -04:00
Nils Wentzell
278dc7ef44 [cmake] In external_project, print dependency location if found in system 2020-05-28 10:56:57 -04:00
Nils Wentzell
610f4a2430 [cmake] Be sure to set cache variables in app4triqs-config.cmake 2020-05-28 09:06:46 -04:00
Nils Wentzell
89d6b2d392 [cmake] Fix Problem with VERSION requirement in external_dependency function 2020-05-28 09:06:46 -04:00
Dylan Simon
852066938a Update triqs python module name 2020-05-27 20:16:37 -04:00
Nils Wentzell
97c5cad66e [py3] Run port_to_triqs3 script 2020-05-27 11:30:24 -04:00
Nils Wentzell
21532641a2 [cmake] FIX keyword usage in target_link_libraries command for cpp2py modules 2020-05-27 08:00:47 -04:00
Dylan Simon
06c3c821d3 [jenkins] run tests separately and mark failures unstable 2020-05-19 19:19:19 -04:00
Dylan Simon
d3fc0d26bf [cmake] move gtest last (so cpp2py python wins) 2020-05-19 17:11:16 -04:00
Dylan Simon
ab12e2f966 Merge branch 'py3' into unstable 2020-05-19 14:39:54 -04:00
Dylan Simon
116df6ef67 [jenkins] initial py3 changes 2020-05-16 13:04:43 -04:00
Nils Wentzell
aea8d18739 [cmake] In extract_flags allow extraction of BUILD_INTERFACE flags 2020-05-15 14:43:08 -04:00
Nils Wentzell
dbed8f20d5 [cmake] Properly set PYTHONPATH for cpp2rst custom_command 2020-05-15 12:09:22 -04:00
Nils Wentzell
5982c49615 [cmake] Use PROJECT_SOURCE_DIR over CMAKE_SOURCE_DIR 2020-05-15 10:50:13 -04:00
Nils Wentzell
6e4598ce07 [cmake] Add PROJECT_NAME prefix to targets in doc dir to avoid naming conflicts 2020-05-13 16:06:27 -04:00
Nils Wentzell
9b76ce9c4c [cmake] Cpp2py should be a BUILD_ALWAYS dependency 2020-05-13 15:42:02 -04:00
Nils Wentzell
35f0e35b0b [cmake] Set target property POSITION_INDEPENDENT_CODE=ON for library 2020-05-13 15:41:24 -04:00
Markus Aichhorn
a94f8ed942
Merge pull request #138 from TRIQS/BSrotations
BlockStructure and rotations
2020-05-13 12:17:15 +02:00
Nils Wentzell
64facf1c3b [cmake] Minor formatting changes 2020-05-08 10:00:14 -04:00
Nils Wentzell
a631b46d14 [cmake] Documentation build no longer requires triqs to be build with doc 2020-05-07 17:50:56 -04:00
Nils Wentzell
be63b6ce24 [cmake] Set global property APP4TRIQS_FOUND to TRUE in app4triqs-config.cmake 2020-05-07 17:36:53 -04:00
Nils Wentzell
422ac1c0ad [cmake] Make sure to require proper triqs verison in deb pkg 2020-05-07 17:36:53 -04:00
Nils Wentzell
daaf502102 [cmake] Provide target alias app4triqs::app4triqs_c -> app4triqs_c for use as subproject 2020-05-07 17:36:53 -04:00
Nils Wentzell
c57c6d734a [cmake] Adjust CMAKE_PREFIX_PATH in module file template 2020-05-07 17:36:53 -04:00
Philipp Dumitrescu
055e7519ba add PythonSupport; change Doc build control flow
* change in Build_Documentation control flow
* don’t Build_Documentation of deps if EXCLUDE_FROM_ALL
* export new APP4TRIQS_WITH_PYTHON_SUPPORT variable in config.cmake
2020-05-07 17:35:43 -04:00
Alexander Hampel
f3dfd1bc6a
added Wien2k doc link 2020-05-07 13:49:41 +02:00
Alexander Hampel
0552cf2057
Update doc/guide/blockstructure.rst 2020-05-07 13:28:22 +02:00
aichhorn
0ce04d34a7 finished SOC tutorial 2020-05-05 10:29:13 +02:00
Nils Wentzell
d2114bd227 [cmake] Improve external_dependency command line output with end config notification 2020-05-01 14:42:21 -04:00
Nils Wentzell
0ebc5a3f73 [cmake] Add a warning if ASAN/UBSAN is used without Build_Deps=Always 2020-05-01 14:42:12 -04:00
Nils Wentzell
0394f7fae2 [cmake] ASAN / UBSAN should note be exported 2020-05-01 14:28:19 -04:00
aichhorn
4b09b97ce4 Included block_structure.convert_operator() in doc and non-SOC tutorial 2020-04-30 12:47:03 +02:00
Nils Wentzell
c06d4b79a5 [cmake] Small cleanings in messages printed by external_denendency function 2020-04-29 17:57:16 -04:00
Nils Wentzell
8206a43651 [cmake] Make sure testing options propagate to subprojects without EXCLUDE_FROM_ALL 2020-04-29 17:56:17 -04:00
Nils Wentzell
5c1ec4c67d [cmake] FIX target_link_libraries and target_compile_options command for python modules 2020-04-29 16:17:06 -04:00
Nils Wentzell
2fca5cde85 [cmake] Add copyright headers for share/cmake/extract_flags.cmake and deps/external_dependency.cmake 2020-04-29 15:57:00 -04:00
Nils Wentzell
760c1d2efe [cmake] Change Cpp2Py dependency tag from py3 to master 2020-04-29 15:38:45 -04:00
Nils Wentzell
0ad5d09fa8 [cmake] Minor fix in extract_flags.cmake file 2020-04-29 15:31:54 -04:00
Nils Wentzell
6d4289e024 [cmake] rename project_warnings to project specific target, to not export it 2020-04-29 15:31:36 -04:00
Nils Wentzell
136a39dc42 [cmake] Bump Version number of app4triqs and triqs to 3.0.0 2020-04-29 15:30:54 -04:00
Nils Wentzell
38ab493368 [cmake] Cpp2py should be a build-only dependency in deps dir 2020-04-29 15:30:19 -04:00
Nils Wentzell
795ab5c671 [cmake] Add useful comments for dependency targets to config.cmake.in file 2020-04-29 10:23:37 -04:00
Nils Wentzell
764cdf35eb [cmake] In environment vars file add install prefix to CMAKE_PREFIX_PATH without suffix 2020-04-29 10:22:48 -04:00
Nils Wentzell
effc981878 [cmake] In external_dependency function be sure to search deps also in INSTALL_PREFIX 2020-04-29 10:20:49 -04:00
hschnait
37ccb46a8c Add convert_operator method to block_structure + Tests 2020-04-29 16:15:14 +02:00
Nils Wentzell
a4bfce94b2 [cmake] Improve error message for external_dependency function 2020-04-28 17:19:13 -04:00
Nils Wentzell
a14bf3975b [cmake] Add option BUILD_ALWAYS to function external_dependency for force build 2020-04-28 17:18:25 -04:00
Nils Wentzell
984a89e569 [cmake] Bump version requirement to 3.3.2, set CMP0057 2020-04-28 16:34:00 -04:00
Nils Wentzell
d9f8e1e0bf [cmake] Use GIT_TAG instead of TAG for external_dependency function 2020-04-28 16:25:28 -04:00
Nils Wentzell
cce7b5cd2f [cmake] Change Build_Deps option to take either Never/Always/IfNotFound, cleaning
- Use Global Properties to check if a package has been found.
  This information should not go in the cmake cache
2020-04-28 16:23:30 -04:00
Nils Wentzell
8c407831c8 [cmake] Improve command line output for dependency configuration 2020-04-28 10:51:06 -04:00
Nils Wentzell
a619870f92 Minor refactoring in external_dependency.cmake 2020-04-27 15:50:35 -04:00
aichhorn
85d4664d96 started SOC tutorial 2020-04-27 16:22:11 +02:00
Nils Wentzell
c99ee1820e [cmake] Handle dependencies with external_dependency(...) function + doc 2020-04-24 17:52:27 -04:00
Nils Wentzell
1ff66fd1f3 [cmake] Minor cleanings 2020-04-24 17:51:19 -04:00
Nils Wentzell
3f71381f1b [cmake] Be sure fill INTERFACE_INCLUDE_DIRECTORIES for installed library targets 2020-04-24 17:50:26 -04:00
Nils Wentzell
1959a60d15 [cmake] Make sure deps/download.sh clones only if dirs do not exist yet 2020-04-22 15:11:37 -04:00
Nils Wentzell
ebe9add3c7 [cmake] Add gitignore file to deps directory 2020-04-22 15:07:33 -04:00
Nils Wentzell
4120eb5f99 [cmake] Add BUILD_SHARED_LIBS option, continue to build static by default 2020-04-22 15:06:15 -04:00
Nils Wentzell
ed5812988f [cmake] Improve cmake status messages if we are a subproject 2020-04-22 15:05:37 -04:00
Nils Wentzell
b9d934554c [cmake] Manage dependencies in a seperate deps subdirectory 2020-04-22 15:04:30 -04:00
Nils Wentzell
2736682002 [cmake] Remove googletest subtree 2020-04-22 14:56:53 -04:00
Alexander Hampel
d9e5a4d3aa added printout of complex part of local Hamiltonian in the Vasp converter 2020-04-17 02:20:23 -07:00
Alexander Hampel
bb7419f586 fix for the sigma_from_file test, commit 05fd3fe3bdf45cf21a021cb204449050057d1435 revealed that the test never worked correctly 2020-04-16 12:22:33 -04:00
Alexander Hampel
62c810d8d6 Merge branch 'py3' of github.com:TRIQS/dft_tools into py3 2020-04-15 11:29:03 -04:00
Alexander Hampel
508f6b393c changed ref file for block structure test, since the order in dicts is not guaranteed the test failed as the order in py3 changed 2020-04-15 11:28:51 -04:00
Nils Wentzell
d9fa71fbec Fix additional integer division to use floordiv 2020-04-14 11:21:33 -04:00
Nils Wentzell
4698f9db6e [py3] Run 2to3 on all ipython notebooks 2020-04-09 14:47:51 -04:00
Nils Wentzell
d3f68310a6 [cmake] Use target_link_libraries with keyword for cpp2py modules 2020-04-08 17:41:18 -04:00
Nils Wentzell
961215ccac Adjust to nda/h5 changes in triqs pytriqs.archive -> h5
-pytriqs.archive.hdf_archive_schemes -> h5.formats
2020-04-08 17:41:18 -04:00
Nils Wentzell
6cc6cd8b7a Do not use deprecated set_from_inverse_fourier 2020-04-08 17:41:18 -04:00
Nils Wentzell
45999d1edc [cmake] Properly use TRIQS_PYTHON_EXECUTABLE for testing 2020-04-08 17:41:18 -04:00
Nils Wentzell
b2a447d07d Relative imports should only be used within modules 2020-04-08 17:41:18 -04:00
Nils Wentzell
b2a5e93c1f [py3] Fix tests based on ordering in dictionaries 2020-04-08 17:41:14 -04:00
Nils Wentzell
e2a1534272 [py3] properly cast strings to float 2020-04-08 17:41:14 -04:00
Nils Wentzell
392c94d4c3 [py3] set is now a builtin type 2020-04-08 17:41:14 -04:00
Nils Wentzell
b1d9229e83 [py3] Use free function next(..) for generator expressions 2020-04-08 17:41:14 -04:00
Nils Wentzell
6d5e04f006 [py3] Use isinstance for proper type checking 2020-04-08 17:41:14 -04:00
Nils Wentzell
484e10ef1f [py3] Be sure to properly use floor division in various places 2020-04-08 17:41:06 -04:00
Nils Wentzell
2b673f7926 [py3] In Python3 xrange was replaced by range 2020-04-08 16:14:01 -04:00
Nils Wentzell
0598b5f0a4 [py3] In python3 zip is identical to itertools.izip 2020-04-08 16:13:51 -04:00
Nils Wentzell
97d4e0b402 [py3] Run 2to3 -w -n **/*.py **/*.py.in 2020-04-08 16:13:42 -04:00
aichhorn
c1fdfd1d8f Added Tutorial fro basis rotations: Sr2MgOsO6 w/o SOC 2020-04-07 20:50:37 +02:00
Nils Wentzell
2d4b9c6298 [cmake] Use PYTHON_EXECUTABLE over PYTHON_INTERPRETER to be consistent with gtest, pybind .. 2020-04-03 16:22:09 -04:00
Nils Wentzell
b70084789d [cmake] Make sure to properly use target_link_libraries with cpp2py modules 2020-04-03 16:21:45 -04:00
Nils Wentzell
ed1e683b69 Port py files to python3 2020-04-03 16:21:07 -04:00
Nils Wentzell
68cac838cc Adjust hdf5 usage to changes in triqs/nda 2020-04-03 16:20:03 -04:00
Markus Aichhorn
8e8ce2b67b
Merge pull request #135 from the-hampel/unstable
Fixing a bug in the vasp converter for multiple sites per unit cell
2020-04-02 12:49:35 +02:00
Alexander Hampel
d9a8271b4e updated test h5 file for LNO converter test, because of fixed bug 2020-04-01 12:03:07 -04:00
Alexander Hampel
0e05d0687f fixed a index bug that produced empty projectors for a unit cells with multiple shells 2020-04-01 11:13:28 -04:00
Alexander Hampel
bf8bfbe59b Merge branch 'unstable' of github.com:the-hampel/dft_tools into unstable 2020-04-01 11:09:11 -04:00
hschnait
ec2184259e Correct description of Transformation matrix 2020-03-31 15:54:16 +02:00
aichhorn
5f2782980e worked on the sr2mgoso6 tutorial 2020-03-31 09:43:05 +02:00
aichhorn
d6977d8bee cleaned up files in Sr2MgOsO6 doc 2020-03-30 15:55:02 +02:00
aichhorn
a77844ea1a First draft of the Sr2MgOsO6 w/o SOC doc 2020-03-30 15:46:54 +02:00
aichhorn
a3f792386e updated SOC doc 2020-03-30 13:24:14 +02:00
aichhorn
d54f157e17 changed default in calculate_diagonalisation_matrix to calculate in
solver structure
2020-03-27 23:45:35 +01:00
aichhorn
3d649f0db5 finalised doc on automatic basis rotations 2020-03-27 23:40:06 +01:00
Alexander Hampel
c92e814211 added missing info for marking equivalent sites 2020-03-27 18:00:32 -04:00
Alexander Hampel
8b84af8d25 Merge branch 'unstable' of github.com:the-hampel/dft_tools into unstable 2020-03-27 17:47:07 -04:00
Alexander Hampel
e84406b7cf added missing info for marking equivalent sites 2020-03-27 17:46:36 -04:00
aichhorn
ae5720f75b added the basic BlockStructure documentation 2020-03-27 11:58:25 +01:00
Alexander Hampel
a4020297b1 fixed a slicing bug for the calculation of the target density in the VASP converter, which selected 1 band less in the correlated window than required. 2020-03-24 12:50:09 -04:00
Nils Wentzell
321bf87e8a [doc] Fix crosslinking with triqs and cthyb website 2020-03-23 17:10:45 -04:00
Nils Wentzell
490bdd92af Minor changelog corrections 2020-03-23 17:05:07 -04:00
Nils Wentzell
4ae585ac8b Add section on Anaconda packages to install page, Update Changelog for 2.2.1 2020-03-23 17:00:36 -04:00
Nils Wentzell
afa9acb957
Merge pull request #133 from Wentzell/PR_LICENSE_FILE
Add License and Authors file
2020-03-23 16:41:08 -04:00
Nils Wentzell
8f663edee6 Add Hermann Schnait to dft_tools Authors 2020-03-23 16:12:11 -04:00
Nils Wentzell
6c814ab967 Minor spellfix in Authors list 2020-03-23 16:11:57 -04:00
Nils Wentzell
ec332a2195 Add Alexander Hampel and Malte Schueler as Authors 2020-03-23 16:10:15 -04:00
Nils Wentzell
9fb3d3dc82 Add top-level LICENSE.txt, a copy of GPLv3 and a list of Authors 2020-03-23 16:05:38 -04:00
Nils Wentzell
64f4cd2d60 [jenkins] Specify FC=gfortran-9 consistently with app4triqs 2020-03-10 15:22:09 -04:00
aichhorn
00194a4617 Bugfix in calculate_density_matrix for purely imaginary off-diagonals 2020-02-26 14:38:32 +01:00
aichhorn
3c998adb71 [doc] First draft of the blockstructure documentation 2020-02-26 14:06:01 +01:00
aichhorn
8e28518a31 small bugfix with capital letters in BasisRotation 2020-02-24 15:59:28 +01:00
aichhorn
ad0f2b54b9 Reshuffled doc on SOC and Basisrotations 2020-02-24 15:42:28 +01:00
Alexander Hampel
8c574f9abd added missing info for marking equivalent sites 2020-02-20 09:31:29 -05:00
aichhorn
568e74464f updated README.txt 2020-02-18 16:50:52 +01:00
aichhorn
1f2c0d3230 Updated ChangeLog.md 2020-02-18 16:30:03 +01:00
aichhorn
b647762349 Merge branch 'merge_vasp2dmft' into unstable 2020-02-17 15:19:58 +01:00
aichhorn
17592fe769 Revert "Extended the documentation for the VASP interface, with more precise statements about the actual implementation."
This reverts commit 6cedb8aaaa.
2020-02-17 15:19:30 +01:00
Alexander Hampel
1d0dbf3985
Merge pull request #129 from malte-schueler/merge_vasp2dmft
Merge vasp2dmft
2020-02-14 15:56:19 -05:00
Nils Wentzell
6a61fe0740 [Jenkins] Specify fortran compiler also for osx clang builds 2020-02-12 09:43:15 -05:00
Dylan Simon
8784480829 [jenkins] osx-gcc: switch to gcc 9 2020-02-11 17:00:50 -05:00
Dylan Simon
0982a5f898 [jenkins] osx-gcc: switch to gcc 9 2020-02-11 14:08:10 -05:00
Alexander Hampel
25b76e567e implemented changes requested by @opeil 2020-01-30 14:12:07 -05:00
Dylan Simon
483dc46b2a [jenkins] remove stray quote in last 2020-01-28 11:38:56 -05:00
Dylan Simon
eab9a23c4f [jenkins] use lower-case docker name; auto-detect doc dir 2020-01-28 11:33:55 -05:00
Dylan Simon
3111d800b5 [jenkins] osx-gcc: use a consistent gfortran
but what should clang be using?
2020-01-23 18:32:32 -05:00
Nils Wentzell
a167933b34 [cmake] Do not warn about unkown attributes with gcc, add warnings to AppleClang 2020-01-17 10:21:52 -05:00
Nils Wentzell
e47bc7ecb0 [jenkins] Make sure to set proper default APPNAME in Dockerfile 2020-01-17 09:45:55 -05:00
Nils Wentzell
deb1696d77 [jenkins] Make sure to use triqs unstable branch by default 2020-01-17 09:40:57 -05:00
Dylan Simon
5c760037b7 [jenkins] stage publication results in tmpdir
Currently they're polluting the main build dir and not getting cleaned
up for some reason
2020-01-14 15:49:38 -05:00
Alexander Hampel
cf6789fd97 changes to VASP CSC calculations in doc. 2020-01-03 11:01:08 +01:00
Malte Schueler
13252201e3 minor improvments in plovasp documentation 2019-12-20 10:51:58 +01:00
Nils Wentzell
bef6368d89 Explicitly use python2 in replace_and_rename script 2019-12-16 10:59:04 -05:00
Nils Wentzell
357c4b81ba [cmake] Use PROJECT_BINARY_DIR over CMAKE_BINARY_DIR 2019-12-16 10:54:50 -05:00
Nils Wentzell
815e9adee8 Fix in dos_tetra_weights_3d: return array<..> instead of array_view<..>
-In triqs version 2.2 array_views no longer own the memory they point to
 This means that array variables that are local to a function should always
 be returned as arrray and never as an array_view
2019-12-05 16:53:06 -05:00
Alexander Hampel
fae8887f4f Final small correction to Tutorials. 2019-12-05 11:15:52 -05:00
Alexander Hampel
c591fe351e Removing examples from source code directories. 2019-12-05 11:14:09 -05:00
Alexander Hampel
18abc77e33 SVO tutorial finalized, added remarks on VASP version in VASP interface guide, added CSC guide, small typo corrections in other files 2019-12-04 19:19:22 -05:00
Alexander Hampel
e26444201a Updated reference documentation for PLOVASP classes and functions. 2019-12-04 12:32:00 -05:00
Alexander Hampel
4d50e41135 First part of revamping the VASP interface documentation. Rewrote the interface with VASP guid. Removed the unused doc/vasp/* files. Start for SVO VASP tutorial as ipynb 2019-12-03 19:29:09 -05:00
Nils Wentzell
7b8b71e984 [cmake] Fix various issues occuring when using a skeleton based app as a subproject 2019-12-02 17:53:17 -05:00
Nils Wentzell
7b91cfbbb3 [doc] Fix sphinx target dependencies for the case of no CPP2PY modules 2019-12-02 15:16:13 -05:00
Malte Schüler
4b8a284a98 efermi is now read from LOCPROJ if DOSCAR does not contain it yet (e.g., for csc calculations) 2019-11-29 10:33:13 +01:00
Malte Schüler
ce6ff62af4 fixed tests for reading e-fermi from DOSCAR. Clean up of plovasp (prints from bugfixing 2019-11-25 09:53:05 +01:00
Malte Schüler
4fdf238472 E-Fermi is read from DOSCAR not from LOCPROJ 2019-11-25 07:52:40 +01:00
Malte Schüler
6b11183f4d fixed tests for incorporating kpts 2019-11-21 21:34:37 +01:00
Nils Wentzell
09b0a68b26 [cmake] Fix cppcheck invocation, add --force to cppcheck options 2019-11-21 11:54:10 -05:00
Nils Wentzell
919639bd27 [cmake] Find libasan and libubsan only if the targets are not already defined by the parent project 2019-11-18 14:04:29 -05:00
Alexander Hampel
6cedb8aaaa Extended the documentation for the VASP interface, with more precise statements about the actual implementation. 2019-11-05 11:40:23 -05:00
Nils Wentzell
64bbc3ce48 Use python instead of bash for the replace and rename operation 2019-10-31 18:19:01 -04:00
Nils Wentzell
b7dafbd2e6 Use PROJECT_VERSION over APP4TRIQS_VERSION 2019-10-28 18:23:15 -04:00
Philipp D
c03634fd2f bug fix for Darwin replace_and_rename.sh 2019-10-24 14:34:27 -04:00
Nils Wentzell
9a3ab9327c [travis] Switch to bionic travis image, clean dependencies 2019-10-20 17:22:04 -04:00
Nils Wentzell
c78b3eeab7 [doc] Add doc/cpp2rst_generated to gitignore 2019-10-11 14:54:16 -04:00
Nils Wentzell
0388421428 Add .gitignore for compile_commands.json 2019-10-10 17:29:54 -04:00
Nils Wentzell
5768a7f748 [cmake] Only use Wshadow=local for gcc 2019-10-10 15:59:39 -04:00
Nils Wentzell
09c40e741a [cmake] Make regex in extract_flags.cmake more generic 2019-10-09 16:24:13 -04:00
Nils Wentzell
60b68690ec Add documentation to python module 2019-10-09 16:23:25 -04:00
Nils Wentzell
7859505fea [doc] Remove non-existant tag from doc example 2019-10-09 16:23:02 -04:00
Nils Wentzell
e4063bf4d0 [cmake] Prioritize -isystem over -I in extract_flags macro, Minor fix for empty list of inc_dirs 2019-09-26 09:49:34 -04:00
Nils Wentzell
a26bfae4d1 [cmake] Bump cppcheck c++ standard to c++17 2019-09-24 17:50:38 -04:00
Nils Wentzell
9f5aa8578c [cmake] Provide extract_flags macro in share/cmake directory, simplify creation of docs_cpp2rst target 2019-09-24 15:17:47 -04:00
Nils Wentzell
10fd7f19a0 Add additional arguments to c++2py module generation call 2019-09-24 14:50:54 -04:00
Nils Wentzell
5daab99fa3 [readme] Add documentation file adjustments to the getting started list 2019-09-24 09:51:32 -04:00
Nils Wentzell
cc81dffa4a [cmake] Minor corrections 2019-09-18 14:23:14 -04:00
Nils Wentzell
eefa265359 [doc] Include a markdown cheat sheet in the feature request issue template 2019-09-17 14:04:27 -04:00
Nils Wentzell
bdee25bb1b [doc] Clean issue templates and make them more concise 2019-09-17 14:00:03 -04:00
Nils Wentzell
df33cb6ffd [cmake] Clean c++/app4triqs/CMakeLists.txt after recent additions to triqs Findsanitizer.cmake 2019-09-16 14:39:27 -04:00
Malte Schüler
7a6450b6fa implemented multiple ncsf VASP cycles 2019-09-16 10:59:46 +02:00
Nils Wentzell
30f32f8dec [cmake] Update cppcheck language standard 2019-09-13 17:51:16 -04:00
Nils Wentzell
24f5268394 Minor clang-tidy fix in app4triqs.hpp 2019-09-13 17:10:35 -04:00
Nils Wentzell
d48811bf13 [clang-tidy] Disable modernize-use-trailing-return-type 2019-09-13 17:09:53 -04:00
Nils Wentzell
31433b69fb [cmake] Build gtest from test/c++/gtest and use gtest_main target 2019-09-06 16:52:59 -04:00
Nils Wentzell
da55635d5c Include gtest as a git subtree in test/c++/gtest 2019-09-06 16:12:18 -04:00
Nils Wentzell
f5b936317d Squashed 'test/c++/gtest/' content from commit 3f05f651
git-subtree-dir: test/c++/gtest
git-subtree-split: 3f05f651ae3621db58468153e32016bc1397800b
2019-09-06 16:12:03 -04:00
Nils Wentzell
7ab1e6af22 Add C to Project Languages 2019-09-06 15:27:55 -04:00
Nils Wentzell
a69a449a43 Move setup files into separate bash scripts and adjust README
* Treat Linux and Darwin differently
2019-09-05 16:30:29 -04:00
Nils Wentzell
bdf91fa925 [app4triqs] Include cpp2rst_generated/contents in toctree 2019-09-04 17:37:50 -04:00
Nils Wentzell
28d600f149 [app4triqs] Rename files and Python module from toto to app4triqs
-Automatically detect any wrap generator files
-rename tests to basic/Py_Basic
2019-09-04 17:37:50 -04:00
Nils Wentzell
445e15d153 [app4triqs] Improved README 2019-09-04 17:37:42 -04:00
Nils Wentzell
5cb8bbf042 [cmake] Add -Wno-gcc-compat to project_warnings target 2019-09-04 16:17:51 -04:00
Nils Wentzell
36a21ee819 [jenkins] Change permissions for application sources in Dockerfile 2019-08-28 11:20:16 -04:00
Dylan Simon
058e39a6c2 [jenkins] Put a mutex around packaging repo updates
"correct" fix for race failures, though could use separate labeled
resources for each repo
2019-08-27 17:37:02 -04:00
Nils Wentzell
5148de2c29 Disable gcc in travis builds due to ld problem on xenial 2019-08-27 15:54:56 -04:00
Nils Wentzell
f28f0e68a4 [doc] Add cpp2rst and example output generation to doc building 2019-08-27 15:43:37 -04:00
Nils Wentzell
66f270e741 App4triqs changelog 2019-08-27 15:42:39 -04:00
Nils Wentzell
3c94a87ca6 Update README file with more detailed instructions 2019-08-27 15:39:03 -04:00
Dylan Simon
180d062846 [jenkins] Don't trigger PR builds on upstream changes 2019-08-20 16:01:55 -04:00
Nils Wentzell
c87aceed37 [cmake] Generate list of all tests through GLOB_RECURSE by default 2019-08-20 14:32:21 -04:00
Nils Wentzell
cd758dd639 [doc] Add triqs-link to welcome page 2019-08-19 18:25:15 -04:00
Nils Wentzell
ce19003682 [doc] Update triqs links in conf.py.in 2019-08-19 18:10:26 -04:00
Manuel
35584a841c Add test for calculate_diagonalization_matrix 2019-08-15 20:18:40 -04:00
Manuel
796e05ea64 Rewrite calculate_diagonalization_matrix 2019-08-12 19:23:27 -04:00
Manuel
46d9229722 Beautify check density imag part 2019-08-12 16:28:49 -04:00
Nils Wentzell
a2767f16c8 [cmake] Exported targets should live in project namespace 2019-08-06 11:32:06 -04:00
Nils Wentzell
4f863dc2a5 [cmake] Install all modules by default 2019-08-06 11:14:57 -04:00
Nils Wentzell
3b1b412b4e Correction to previous commit, run c++ tests in proper test directory 2019-08-02 14:24:45 -04:00
Dylan Simon
81346f5e4d [jenkins] Make linux builds use requirements.txt 2019-07-31 12:13:28 -04:00
Dylan Simon
907827562b [jenkins] try to exclude large git packs from build 2019-07-31 12:13:08 -04:00
Nils Wentzell
63109a445b [cmake] Generalize test/c++/CMakeLists.txt file to allow subdirectories and globbing 2019-07-31 11:08:23 -04:00
Dylan Simon
e5a4cfb47e Add requirements.txt for python package dependencies 2019-07-29 14:42:20 -04:00
Dylan Simon
b5278079de [jenkins] remove myself from emails 2019-07-26 15:04:01 -04:00
Dylan Simon
7aaffab7e6 [jenkins] Preserve all installs by default
as triqs does already
2019-07-26 14:01:22 -04:00
Markus Aichhorn
ac1f55f3de
Merge pull request #119 from hschnait/2.1.x-withBSrotations
Basis-Transformations in BlockStructure
2019-07-22 15:00:34 +02:00
Markus Aichhorn
6111461b64
Merge pull request #118 from malte-schueler/merge_vasp2dmft
Merge vasp2dmft functionalities into plovasp
2019-07-19 14:26:05 +02:00
Malte Schüler
d61b55f0a4 uncompleted work on csc NiO tutorial 2019-07-19 13:33:11 +02:00
Hermann Schnait
b9a20200ca Merge branch 'gernotsandmychanges' into HEAD 2019-07-18 14:27:13 +02:00
Hermann Schnait
e7cddf3e7e Bugfix in calculate_diagonalization_matrix for more than one deg shell 2019-07-18 14:16:38 +02:00
Hermann Schnait
e40f315989 Implement calculate_diagonalization_matrix method into SK 2019-07-18 14:16:37 +02:00
Hermann Schnait
8016152c5e Documentation for basis rotations 2019-07-18 14:16:37 +02:00
Hermann Schnait
9bc4643fdf Update unit tests and bugfixes in BlockStructure 2019-07-18 14:15:43 +02:00
Hermann Schnait
bd228de768 Add adapt_deg_shells method and call it in map_gf_struct 2019-07-18 14:15:42 +02:00
Hermann Schnait
f695ccac7a Ignore imaginary part of the density when calculating mu 2019-07-18 14:15:42 +02:00
Hermann Schnait
810b315c92 Fixing TransBasis 2019-07-18 14:15:42 +02:00
Hermann Schnait
d66950a043 Remove show_warning again as it is not necessary anymore 2019-07-18 14:15:37 +02:00
Hermann Schnait
a44f3d36f4 Reworked Diagonalization function to ignore 'picked out' obitals (e.g. egs) 2019-07-18 14:15:37 +02:00
Hermann Schnait
6623a39739 Display transformation warnings only for relevant (solver) blocks 2019-07-18 14:15:37 +02:00
Hermann Schnait
32356a06ba Calculate diagonalization in solver blocks 2019-07-18 14:15:36 +02:00
Hermann Schnait
159ee1166e Thread show_warnings through to extract_gloc in SK 2019-07-18 14:15:36 +02:00
Hermann Schnait
187499b00f Bugfixes in block_structure 2019-07-18 14:15:36 +02:00
Hermann Schnait
ba79a7f708 Modified map_gf_struct to remove degshells + update test case 2019-07-18 14:15:35 +02:00
Hermann Schnait
3d0adafad2 Modified test-reference files to changed degshells when picking gf-struct 2019-07-18 14:15:35 +02:00
Hermann Schnait
743ff09cac Changed 'orb' parameter to 'ish' for consistency 2019-07-18 14:15:35 +02:00
Hermann Ulrich Schnait
51275c772d Bugfix in Blockstructure Test 2019-07-18 14:15:34 +02:00
Gernot J. Kraberger
1705e5268f blockstructure: adapt deg_shells in pick 2019-07-18 13:56:54 +02:00
Gernot J. Kraberger
8e4c923d21 [block_structure] create_matrix etc. 2019-07-18 13:56:54 +02:00
Gernot J. Kraberger
f0b1599379 SumkDFT: transform in calc_dc 2019-07-18 13:56:53 +02:00
Gernot J. Kraberger
8130d6b9fc block_structure: pick_gf_struct_sumk with transformation
plus little bug fixes
2019-07-18 13:56:53 +02:00
Gernot J. Kraberger
6a889fab8c block_structure: convert_gf with transformation 2019-07-18 13:56:52 +02:00
Gernot J. Kraberger
ff40e8e0f0 [doc] block_structure: small fixes 2019-07-18 13:56:52 +02:00
Gernot J. Kraberger
e9bfb3ed2c block_structure: effective_transformation_solver 2019-07-18 13:56:51 +02:00
Gernot J. Kraberger
bc78560ee1 block_structure: add corr_to_inequiv 2019-07-18 13:56:51 +02:00
Gernot J. Kraberger
2d48119876 block_structure: effective_transformation_sumk 2019-07-18 13:56:50 +02:00
Gernot J. Kraberger
5fd74f73b7 start with Sr2RuO4 guide 2019-07-18 13:56:49 +02:00
Gernot J. Kraberger
31cb7a0ea4 block_structure: prepare for transformation
this includes some TODOs that need to be fixed
2019-07-18 13:56:49 +02:00
Nils Wentzell
8d906ed6cc [cmake] Use PROJECT_GIT_HASH instead to store git hash and adjust dependent files accordingly 2019-07-16 11:54:32 -04:00
Nils Wentzell
99df95f853 [travis] Switch to gcc and clang version 8, clean dependency list 2019-07-16 11:29:51 -04:00
Nils Wentzell
45dc6e1b3c [travis] Build against sanitized version of triqs 2019-07-16 11:28:45 -04:00
Nils Wentzell
bb3eb8ecad [cmake] Install svg figures together with documentation 2019-07-16 11:26:38 -04:00
Malte Schüler
8f184fc963 tests for plovasp's H(k) and complement. Further work on NiO tutorial 2019-07-12 16:04:10 +02:00
Malte Schüler
90b331c5a8 fixed bug in band selection and output to .pg files. ewindow is not read by vasp_converter anymore. 2019-07-08 10:27:17 +02:00
Malte Schüler
a882ffa575 work in NiO tutorial 2019-07-08 09:55:22 +02:00
Malte Schüler
1eecf80b66 added VaspConverter to reference manual 2019-07-03 13:06:50 +02:00
Malte Schüler
42a729678a Merge branch 'merge_vasp2dmft' of https://github.com/malte-schueler/dft_tools into merge_vasp2dmft 2019-07-03 12:31:43 +02:00
Malte Schüler
2069d251a0 fixed bug with n_orbitals for H(k) 2019-07-03 11:16:30 +02:00
Malte Schüler
1ea40bbccc trivial commit for testing 2019-07-03 08:12:18 +02:00
Malte Schüler
1fc15390d6 plovasp: implemented csc for hk format 2019-07-02 14:06:12 +02:00
Malte Schüler
8f5722a98e changed vasp_converter test such that hdf5 files include proj_or_hk flag 2019-07-02 11:10:08 +02:00
Malte Schüler
2dda711aed plovasp: fixed some bugs for multiple ions per shell 2019-07-02 11:00:21 +02:00
Malte Schüler
d2263ae3d5 removed corr again from test files for backward compatibility 2019-07-01 11:36:56 +02:00
Malte Schüler
23e15abb66 removed corr and ion_list from shell in h5 2019-07-01 11:34:34 +02:00
Malte Schüler
251e3c16f3 added 'corr' flag to tests of converter 2019-07-01 11:29:00 +02:00
Malte Schüler
e9fd33dffb plovasp: vasp_converter can now deal with H(k) and uncorrelated shells. Removed correleated shells and irrep from H(k) header. 2019-07-01 10:51:33 +02:00
Malte Schüler
3666518bdf added corr flag to vasp_converter 2019-06-28 15:14:12 +02:00
Malte Schüler
1dd7552529 plovasp: added documentation and tests 2019-06-28 14:47:15 +02:00
Malte Schüler
29cfe8f711 plovasp: documentation and cleaning 2019-06-27 16:26:22 +02:00
Malte Schüler
96a6891f64 plovasp: first working version of H(k) and complement 2019-06-27 15:21:07 +02:00
Malte Schüler
90de1f3ab6 plovasp: added new input flags. Implemented band selection. Finished implementing corr. 2019-06-27 09:05:04 +02:00
Philipp D
c3114e313a [cmake] streamline top-level cmake
* enforces major.minor version check against triqs
* adds header boilerplate
* minor cleaning
2019-06-26 13:56:56 -04:00
Nils Wentzell
d02eff9ce3 [cmake] Consistently use PROJECT_SOURCE_DIR over CMAKE_SOURCE_DIR 2019-06-26 11:35:52 -04:00
Nils Wentzell
b0bb95d61e [cmake] Use PROJECT_VERSION as defined through project(..) over APP4TRIQS_VERSION 2019-06-26 11:35:20 -04:00
Nils Wentzell
24f49da39c [cmake] Do not enable compiler warnings globally but instead through an interface target 2019-06-26 11:06:12 -04:00
Nils Wentzell
162bf1a482 [travis] Build triqs in debug mode, build only with two cores 2019-06-26 10:55:03 -04:00
Nils Wentzell
555084f149 Update links in README.md 2019-06-11 17:19:54 +02:00
Nils Wentzell
53e4f257e8 [travis] Add build-passing status image to README 2019-06-05 11:29:17 -04:00
Nils Wentzell
eca87051cb [travis] Fix llvm setup in .travis file, enable clang build 2019-06-05 10:56:50 -04:00
Nils Wentzell
93856f9440 Minor rewording in readme 2019-06-05 10:52:43 -04:00
Nils Wentzell
3676be09db Add issue templates for bug and feature request 2019-05-22 17:25:28 -04:00
Nils Wentzell
5fda45520c [doc] Keep toctree (depth2) in index.rst 2019-05-22 16:50:43 -04:00
Dylan Simon
9501814975 [jenkins] skip empty packaging commits
No use in doing an extra rebuild
2019-05-02 13:42:36 -04:00
Dylan Simon
81c1a4aa14 [jenkins] allow packaging module to be triqs_*
Use triqs_PKG if it exists, otherwise PKG
2019-04-29 14:51:15 -04:00
Dylan Simon
debb784431 [jenkins] Rename docker repo to packaging 2019-04-29 11:55:14 -04:00
Nils Wentzell
c492078f77 [doc] Major cleaning of doc targets and CMakeLists.txt 2019-04-26 12:40:44 -04:00
Nils Wentzell
c387828bd2 [cmake] Important path/variable fixes in cmake-generated files 2019-04-26 10:24:46 -04:00
Nils Wentzell
219bd830a5 [doc] Minor cleanings of app4triqs doc examples 2019-04-26 10:23:58 -04:00
Nils Wentzell
1d2e845f66 [doc] Disable copy of rst-files to binary dir 2019-04-26 10:20:06 -04:00
Nils Wentzell
aff1c3fdec Update License file initially copied from triqs project 2019-04-26 10:00:58 -04:00
Olivier Parcollet
038b41bd47 minor 2019-04-25 15:48:58 -04:00
Nils Wentzell
f9415b7385 Minor Corrections to PR #3 2019-04-25 14:26:36 -04:00
Hugo U. R. Strand
8529bc164a [doc] add contents.rst and documentation.rst
The upper doc link was broken, it expected a documentation.rst to exist.
Small polish of text.
2019-04-25 13:56:12 -04:00
Hugo U. R. Strand
171dbcdecf [doc] install and first page + github logo 2019-04-25 13:56:12 -04:00
Nils Wentzell
a113230ffe [cmake] Avoid use of list(FILTER ..) to restore cmake version 3.0.2 compatibility 2019-04-25 13:54:23 -04:00
Nils Wentzell
e03eb002cf [cmake] docs_sphinx target should depend on generated module due to autodoc usage, Fix #2 2019-04-25 13:53:33 -04:00
Nils Wentzell
e329acfa06 Remove warning about unused variable 2019-04-25 13:52:22 -04:00
Dylan Simon
984ead7f5d [jenkins] only update docker submodule if it exists 2019-04-24 14:08:48 -04:00
Olivier Parcollet
7811ee514e
Enable doc building on Jenkins 2019-04-23 16:53:50 -04:00
Olivier Parcollet
65029e3aee
Merge pull request #1 from HugoStrand/dev_autodoc
[autodoc] adding python autodoc of c++ wrapped python module
2019-04-23 16:49:11 -04:00
Olivier Parcollet
e375861950
Merge branch 'unstable' into dev_autodoc 2019-04-23 16:48:49 -04:00
Olivier Parcollet
e055902496 Make doc a bit more complex 2019-04-23 16:44:00 -04:00
Hugo U. R. Strand
60671ba75b [autodoc] adding python autodoc of c++ wrapped python module 2019-04-23 14:14:34 -04:00
Nils Wentzell
815b397333 Add back manual adjustments to toto_module_desc.py 2019-04-23 12:58:11 -04:00
Nils Wentzell
6289a96236 Regenerate python module after latest cpp2py adjustments 2019-04-23 11:57:54 -04:00
Nils Wentzell
9315b02800 We should be using the triqs::gtest target for linking 2019-04-22 11:25:20 -04:00
Nils Wentzell
87a67e8d06 [cmake] Add -Wextra compiler warnings globally 2019-04-22 11:24:53 -04:00
Nils Wentzell
bb518a3e4c [doc] Small fix in conf.py.in 2019-04-16 18:11:20 -04:00
Nils Wentzell
f4ba085165 Add missing logos to docs 2019-04-16 18:11:20 -04:00
Dylan Simon
6177707c73 [jenkins] check branch name in simpler way
that works
2019-04-16 17:41:46 -04:00
Nils Wentzell
d64b27495e Bump cpp2py version requirement 2019-04-16 16:56:44 -04:00
Nils Wentzell
9e606ab9ca [cmake] Bump Version number and triqs requirement to 2.2(dev) 2019-04-16 16:32:44 -04:00
Dylan Simon
0f8cf50cd4 [jenkins] always update submodules on unstable/master
not just for tagged commits like release branches
2019-04-16 15:43:03 -04:00
Nils Wentzell
00b940dc17 [doc] Synchronize install page with qmc solvers 2019-04-16 15:04:04 -04:00
Nils Wentzell
57c5c8a892 [cmake] Remove remainders of separate cpp2py install (now included with triqs) 2019-04-16 11:17:17 -04:00
Nils Wentzell
66164ed8a4 Bump cmake version requirement 2019-04-15 16:45:59 -04:00
Nils Wentzell
b1ba2d4d68 Update README to account for alternate rename commands 2019-04-15 16:45:21 -04:00
Nils Wentzell
7f29a3f624 Additional docs and cleaning in XXX-config.cmake.in file 2019-04-15 16:45:21 -04:00
Nils Wentzell
ff9536bf91 [cmake] Fix in specification of working directory for python tests 2019-04-12 18:06:44 -04:00
Nils Wentzell
095409d879 Major cleaning, Synchronize project structure with qmc codes 2019-04-12 16:36:03 -04:00
Nils Wentzell
4d2ba07226 Make generation of generated docs optional through docs_cpp2rst target 2019-04-02 11:13:11 -04:00
Nils Wentzell
da10fdeb55 [cmake] Define version numbers explicitly 2019-03-05 15:19:57 -05:00
Nils Wentzell
50c1ce40a5 [jenkins] Adjust email adressses for jenkins reports 2019-02-21 11:00:59 -05:00
Nils Wentzell
412c0c5b73 [jenkins] Build deb packages only for tagged releases 2019-01-28 15:04:30 -05:00
Nils Wentzell
9d1a19b26f [deb] Remove explicit cpp2py package dependency (deduced from triqs) 2019-01-22 10:21:19 -05:00
Dylan Simon
29b5018018 [jenkins] try a more robust git push 2018-12-04 13:50:12 -05:00
Dylan Simon
a42838a8db [jenkins] Add CTEST_OUTPUT_ON_FAILURE=1 2018-11-29 14:20:35 -05:00
Nils Wentzell
16fe4b2eab Minor correction to 759bb9d 2018-11-29 10:46:57 -05:00
Nils Wentzell
0335e53adf Adjust cmake-related install dirs to more standard directories 2018-11-28 13:02:26 -05:00
Nils Wentzell
837c886e60 [cmake] Minor fix in Findlibasan_rt.cmake 2018-11-26 18:33:03 -05:00
Nils Wentzell
aef818bc28 add float-cast-overflow and float-divide-by-zero to ubsan checks 2018-11-26 12:04:35 -05:00
Nils Wentzell
9e442be0e0 Always export compile commands to json file 2018-11-26 12:03:54 -05:00
Nils Wentzell
002642f97c Change standard install path of cmake files 2018-11-21 16:59:19 -05:00
Nils Wentzell
759bb9da1d Fix the sanitizers for MacOs 2018-11-21 16:52:55 -05:00
Nils Wentzell
46cbea69d9 [cmake] Enable CMP0074, adjust if(obj) statements 2018-11-20 17:53:10 -05:00
Nils Wentzell
24d619b8be [cmake] Add Debug flags, Update Triqs version, optional tests 2018-10-11 17:17:53 -04:00
Nils Wentzell
9f03870f26 [cmake] Use CPLUS_INCLUDE_PATH over CPATH to favor -isystem includes 2018-10-11 17:17:12 -04:00
Gernot J. Kraberger
9076baf9d6 sumk_dft: split transform_to_sumk_blocks from put_Sigma
this is done in a backward-compatible manner
2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
d8a2693123 block_structure: introduce space parameter
in methods convert_gf, create_gf, check_gf
2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
ef979199af sumk_dft: split transform_to_solver_blocks from extract_G_loc
this is done in a backward-compatible manner
2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
d0f0c20865 change isinstance for new TRIQS
this fixes test analyse_block_structure_from_gf
2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
f0de5c62b5 block_structure: add gf_struct_***_list and _dict
now sumk is given in the list format and
solver is given in the dict format
2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
2b490d1485 block_structure: convert_gf: add G_out, let G_struct be sumk 2018-10-08 21:29:49 +02:00
Gernot J. Kraberger
6c908e9c6e block_structure: add check_gf method 2018-10-08 21:29:49 +02:00
Nils Wentzell
e95982c906 Merge branch 'unstable' 2018-09-17 15:01:06 -04:00
Nils Wentzell
548993e1d0 [doc] Update website logos 2018-09-17 15:00:54 -04:00
Nils Wentzell
afe06474ff [cmake] Fix python environment for doc generation 2018-09-17 15:00:40 -04:00
Dylan Simon
de2792361e jenkins: fix typo in email alert 2018-09-17 13:41:37 -04:00
Nils Wentzell
73642c01a0 [doc] Update website logos 2018-09-12 11:29:47 -04:00
Nils Wentzell
af8f3ad824 Minor fixes and adjustments 2018-08-30 18:07:35 -04:00
Dylan Simon
331bbc8068 [jenkins] move docs to separate gh-pages repo 2018-06-22 11:15:27 -04:00
Dylan Simon
6d2a788ed3 [jenkins] Support brew installed in other places 2018-06-08 10:40:39 -04:00
Dylan Simon
ab43c9762d Merge branch 'unstable' of github:TRIQS/app4triqs into unstable 2018-06-04 13:39:55 -04:00
Nils Wentzell
81ed3a9696 [doc] Fix a few doc warnings 2018-06-03 22:32:24 -04:00
Nils Wentzell
4a7ffbdf92 [doc] Fix few doc problems, add changelog 2018-06-03 22:28:55 -04:00
Nils Wentzell
04d7aef339 [deb] Adjust dependency generation 2018-06-03 13:45:57 -04:00
Dylan Simon
2cbaac664f Add .dockerignore
Without .git, for all the good it does
2018-06-01 11:12:35 -04:00
Dylan Simon
7c8f5569ca [cpack] Switch to autogenerated shlib and deps 2018-06-01 11:10:49 -04:00
Nils Wentzell
35a48aad80 [cmake] Adjust fallback version 2018-06-01 16:51:49 +02:00
Nils Wentzell
2cd1a9384f [cmake] app4triqs version detection via git, some cleaning in conf.py.in 2018-06-01 09:38:03 -04:00
Nils Wentzell
7f0e6283f0 grep app4triqs version from latest annotated git tag 2018-05-27 02:06:48 +02:00
Dylan Simon
0fb5342c6b [cmake] deb pkg works with libgcc1 1:6
The default on xenial
2018-05-21 16:04:25 -04:00
Dylan Simon
51345aff2d [cmake] Add BUILD_DEBIAN_PACKAGE option and rules 2018-05-14 15:26:28 -04:00
Nils Wentzell
6be41fb47a [cmake] Prepend UBSan options to Env 2018-04-24 23:59:32 +02:00
Nils Wentzell
6aa4eee0f4 [cmake] Fixing usage of ubsan with Minimal RT, some cleaning
- Use UBsan Minimal RT if found
- Prioritize gcc-7 directories over older
- Set UBSan options for c++/python tests
2018-04-24 23:34:14 +02:00
Nils Wentzell
82b10c1983 [travis] avoid apt-get install failure, add ubsan options 2018-04-24 22:34:41 +02:00
Dylan Simon
e8a14a3406 [jenkins] Remove unnecessary CPP2RST_INCLUDE flags
Fixed by cpp2py build in triqs efd7b0f7d855a0b5ae260d0fd7a6031cec068072
2018-04-10 12:01:37 -04:00
Dylan Simon
364c99d292 [jenkins] expand LLVM arg
Doesn't propagate from parent image
2018-04-06 11:55:25 -04:00
Dylan Simon
27cfe25967 [jenkins] Use CPP2RST_INCLUDE_COMMAND instead 2018-04-06 11:43:10 -04:00
Dylan Simon
3174a27c70 [jenkins] Add CPP2RST_INCLUDE_DIRS hack for docs 2018-04-06 11:37:30 -04:00
Dylan Simon
907f469bab [jenkins] Remove hard-coded app name from Dockerfile 2018-04-06 11:29:06 -04:00
Dylan Simon
51368b1d66 [jenkins] more comments and explanation 2018-04-06 11:27:06 -04:00
Nils Wentzell
c6a0079b89 travis update to llvm7 and xenial 2018-04-06 15:10:42 +02:00
Nils Wentzell
ee1e563c82 Lowering cmake version requirement, removing fPIC global flag 2018-04-06 14:36:32 +02:00
Nils Wentzell
d8f6932888 Make static analyzers optional 2018-04-06 14:36:07 +02:00
Nils Wentzell
afd3ae12f2 updating README with instructions 2018-03-28 11:00:54 +02:00
Nils Wentzell
ed918caf40 remove cpp2py header include 2018-03-27 13:55:04 +02:00
Dylan Simon
172b2da58f [jenkins] don't allow empty docker updates
just fail and ignore
2018-03-26 16:30:04 -04:00
Nils Wentzell
f65e5bfbad Further cleanining, switching to static library
-Disable LINTing in test macros with comment // NOLINT
-Enable static analyzers for c++ tests
-Switch app4triqs_c to static library
 Dynamic was pickung up previously installed libapp4triqs_c.so in tests
 Also there is no need to be dynamic for applications
-Fix previous change in HeaderFilterRegex:
 'app4triqs/c++' was blocking all headers for clang-tidy checks.
 'app4triqs' works well, but we cannot install any other headers into
 app4triqs folder structure.
 We thus had to create INSTALL_DIR in travis.yml
2018-03-26 00:31:39 +02:00
Nils Wentzell
e3c4366d54 Enable all compiler warnings, Include Triqs headers as SYSTEM, fix linker for sanitizers 2018-03-25 20:15:49 +02:00
Nils Wentzell
f0b49145da Disable clang build and stronger restriction on clang tidy headers 2018-03-25 19:38:25 +02:00
Nils Wentzell
78ff2fb178 check clang travis build 2018-03-25 19:22:14 +02:00
Nils Wentzell
f2d7e84bdd Major update and Cleaning
-consistent indends in all cmake files
-add static analyzer checks with both cppcheck and clang-tidy
-add dynamic analyzer checks with Address Sanitizer and option ASAN
-add dynamic analyzer checks with Undefined Behavior Sanitizer and option UBSAN
-Further Cleaning and Comments
2018-03-25 19:21:18 +02:00
Dylan Simon
616479d883 [jenkins] Use persistent osx triqs install; cleanup
Should now match dft_tools and soon cthyb
2018-03-23 15:30:28 -04:00
Nils Wentzell
6bf4afd316 Adding cmake config files to install targets, Major cleaning 2018-03-23 16:59:38 +01:00
Nils Wentzell
2b76c51f12 First draft of the triqs application skeleton 2018-03-22 18:16:10 +01:00
Nils Wentzell
dcce274810
Initial commit 2018-03-22 15:33:59 +01:00
498 changed files with 33828 additions and 35166 deletions

2
.clang-tidy Normal file
View File

@ -0,0 +1,2 @@
Checks: '-*,modernize-*,cppcoreguidelines-*,-modernize-use-trailing-return-type'
HeaderFilterRegex: 'triqs_dft_tools'

View File

@ -1,2 +1,5 @@
.travis.yml
Dockerfile
Jenkinsfile
.git/objects/pack
build*

View File

@ -32,7 +32,7 @@ Please provide the application version that you used.
You can get this information from copy and pasting the output of
```bash
python -c "from app4triqs.version import *; show_version(); show_git_hash();"
python -c "from triqs_dft_tools.version import *; show_version(); show_git_hash();"
```
from the command line. Also, please include the OS you are running and its version.

98
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,98 @@
name: build
on:
push:
branches: [ unstable ]
pull_request:
branches: [ unstable ]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-20.04, cc: gcc-10, cxx: g++-10}
- {os: ubuntu-20.04, cc: clang-13, cxx: clang++-13}
- {os: macos-11, cc: gcc-11, cxx: g++-11}
- {os: macos-11, cc: /usr/local/opt/llvm/bin/clang, cxx: /usr/local/opt/llvm/bin/clang++}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: >
sudo apt-get update &&
sudo apt-get install lsb-release wget software-properties-common &&
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && sudo chmod +x /tmp/llvm.sh && sudo /tmp/llvm.sh 13 &&
sudo apt-get install
clang-13
g++-10
gfortran-10
hdf5-tools
libblas-dev
libboost-dev
libclang-13-dev
libc++-13-dev
libc++abi-13-dev
libomp-13-dev
libfftw3-dev
libgfortran5
libgmp-dev
libhdf5-dev
liblapack-dev
libopenmpi-dev
openmpi-bin
openmpi-common
openmpi-doc
python3-clang-13
python3-dev
python3-mako
python3-matplotlib
python3-mpi4py
python3-numpy
python3-pip
python3-scipy
python3-sphinx
python3-nbsphinx
- name: Install homebrew dependencies
if: matrix.os == 'macos-11'
run: |
brew install gcc@11 llvm boost fftw hdf5 open-mpi openblas
pip3 install mako numpy scipy mpi4py
pip3 install -r requirements.txt
- name: Build & Install TRIQS
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
git clone https://github.com/TRIQS/triqs --branch unstable
mkdir triqs/build && cd triqs/build
cmake .. -DBuild_Tests=OFF -DCMAKE_INSTALL_PREFIX=$HOME/install
make -j1 install VERBOSE=1
cd ../
- name: Build dft_tools
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
FC: gfortran-10
LIBRARY_PATH: /usr/local/opt/llvm/lib
run: |
source $HOME/install/share/triqs/triqsvars.sh
mkdir build && cd build && cmake ..
make -j2 || make -j1 VERBOSE=1
- name: Test app4triqs
env:
DYLD_FALLBACK_LIBRARY_PATH: /usr/local/opt/llvm/lib
run: |
source $HOME/install/share/triqs/triqsvars.sh
cd build
ctest -j2 --output-on-failure

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
compile_commands.json
doc/cpp2rst_generated

View File

@ -1,47 +0,0 @@
language: cpp
sudo: required
dist: trusty
compiler:
- gcc
# - clang
before_install:
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main' -y
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated g++-7 clang-5.0
- export LIBRARY_PATH=/usr/lib/llvm-5.0/lib:$LIBRARY_PATH
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
- sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-5.0
- sudo apt-get install -y --allow-unauthenticated libboost-all-dev cmake git libgfortran3 gfortran openmpi-bin openmpi-common openmpi-doc libopenmpi-dev libblas-dev liblapack-dev libfftw3-dev libgmp-dev hdf5-tools libhdf5-serial-dev python-h5py python-dev python-numpy python-scipy python-jinja2 python-virtualenv python-matplotlib python-tornado python-zmq python-mpi4py python-mako clang-format-5.0 libclang-5.0-dev python-clang-5.0 python-sphinx libjs-mathjax valgrind libnfft3-dev
install: true
script:
# ===== Set up Cpp2Py
- git clone https://github.com/triqs/cpp2py
- mkdir cpp2py/build && cd cpp2py/build
- git checkout master
- cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/${CXX} -DPYTHON_INTERPRETER=/usr/bin/python -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/root_install
- make -j8 install
- cd $TRAVIS_BUILD_DIR
- source root_install/share/cpp2pyvars.sh
# ===== Set up TRIQS
- git clone https://github.com/TRIQS/triqs --branch $TRAVIS_BRANCH
- mkdir triqs/build && cd triqs/build
- cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/${CXX} -DBuild_Tests=OFF -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/root_install -DCMAKE_BUILD_TYPE=Debug
- make -j8 install
- cd $TRAVIS_BUILD_DIR
- source root_install/share/triqsvars.sh
# ===== Set up dft_tools and Test using fsanitize=address
- mkdir build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=/usr/bin/${CXX} -DCMAKE_CXX_FLAGS='-fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold'
- make -j8
- export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-5.0/bin/llvm-symbolizer
- export ASAN_OPTIONS=symbolize=1:detect_leaks=0
- export CTEST_OUTPUT_ON_FAILURE=1
- if [ "$CXX" = g++ ]; then export LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so; elif [ "$CXX" = clang++ ]; then export LD_PRELOAD=/usr/lib/llvm-5.0/lib/clang/5.0.1/lib/linux/libclang_rt.asan-x86_64.so; fi
- cd test && ctest

16
AUTHORS.txt Normal file
View File

@ -0,0 +1,16 @@
Markus Aichhorn
Sophie Beck
Michel Ferrero
Alexander Hampel
Alyn James
Jonathan Karp
Gernot Kraberger
Max Merkel
Olivier Parcollet
Oleg Peil
Leonid Poyurovskiy
Hermann Schnait
Malte Schueler
Dylan Simon
Nils Wentzell
Manuel Zingl

View File

@ -1,105 +1,178 @@
# Start configuration
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(triqs_dft_tools C CXX Fortran)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
# ##############################################################################
#
# triqs_dft_tools - An example application using triqs and cpp2py
#
# Copyright (C) ...
#
# triqs_dft_tools is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# triqs_dft_tools is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# triqs_dft_tools (in the file COPYING.txt in this directory). If not, see
# <http://www.gnu.org/licenses/>.
#
# ##############################################################################
cmake_minimum_required(VERSION 3.12.4 FATAL_ERROR)
cmake_policy(VERSION 3.12.4)
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
# ############
# Define Project
project(triqs_dft_tools VERSION 3.1.0 LANGUAGES C CXX Fortran)
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
# ############
# Load TRIQS and CPP2PY
find_package(TRIQS 3.1 REQUIRED)
# Get the git hash & print status
triqs_get_git_hash_of_source_dir(PROJECT_GIT_HASH)
message(STATUS "${PROJECT_NAME} version : ${PROJECT_VERSION}")
message(STATUS "${PROJECT_NAME} Git hash: ${PROJECT_GIT_HASH}")
# Enforce Consistent Versioning
if(NOT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} VERSION_EQUAL ${TRIQS_VERSION_MAJOR}.${TRIQS_VERSION_MINOR})
message(FATAL_ERROR "The ${PROJECT_NAME} version ${PROJECT_VERSION} is not compatible with TRIQS version ${TRIQS_VERSION}.")
endif()
# Default Install directory to TRIQS_ROOT if not given or invalid.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
endif()
if(NOT IS_SUBPROJECT)
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
endif()
set(${PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the ${PROJECT_NAME} Project")
# Make additional Find Modules available
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake/Modules)
# ############
# CMake Options
# Default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif()
message( STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
# Use shared libraries
set(BUILD_SHARED_LIBS ON)
# Load TRIQS and Cpp2Py
find_package(TRIQS 2.2 REQUIRED)
find_package(Cpp2Py 1.6 REQUIRED)
if (NOT ${TRIQS_WITH_PYTHON_SUPPORT})
MESSAGE(FATAL_ERROR "dft_tools require Python support in TRIQS")
if(NOT IS_SUBPROJECT)
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
endif()
# Default Install directory to TRIQS_ROOT if not given. Checks an absolute name is given.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
message(STATUS " No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
# Python Support
option(PythonSupport "Build with Python support" ON)
if(PythonSupport AND NOT TRIQS_WITH_PYTHON_SUPPORT)
message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF")
endif()
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} -------------")
# Define the dft_tools version numbers and get the git hash
set(DFT_TOOLS_VERSION_MAJOR 2)
set(DFT_TOOLS_VERSION_MINOR 2)
set(DFT_TOOLS_VERSION_PATCH 0)
set(DFT_TOOLS_VERSION ${DFT_TOOLS_VERSION_MAJOR}.${DFT_TOOLS_VERSION_MINOR}.${DFT_TOOLS_VERSION_PATCH})
triqs_get_git_hash_of_source_dir(DFT_TOOLS_GIT_HASH)
message(STATUS "Dft_tools version : ${DFT_TOOLS_VERSION}")
message(STATUS "Git hash: ${DFT_TOOLS_GIT_HASH}")
# Documentation
option(Build_Documentation "Build documentation" OFF)
if(Build_Documentation AND NOT PythonSupport)
message(FATAL_ERROR "Build_Documentation=ON requires PythonSupport to be enabled")
endif()
# Testing
option(Build_Tests "Build tests" ON)
if(Build_Tests)
enable_testing()
endif()
# Build static libraries by default
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# ############
# Global Compilation Settings
# Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Disable compiler extensions
set(CMAKE_CXX_EXTENSIONS OFF)
# Provide additional debugging information for Debug builds
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
# Create an Interface target for compiler warnings
add_library(${PROJECT_NAME}_warnings INTERFACE)
target_compile_options(${PROJECT_NAME}_warnings
INTERFACE
-Wall
-Wextra
-Wpedantic
-Wno-sign-compare
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
$<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:Clang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:Clang>:-Wshadow>
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++20-extensions>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-c++20-extensions>
)
# #############
# Build Project
# Find / Build dependencies
add_subdirectory(deps)
# Build and install the library
add_subdirectory(c++/${PROJECT_NAME})
# add here stuff for the Fortran part in DFTTools
add_subdirectory(fortran/dmftproj)
# Add the compiling options (-D... ) for C++
message(STATUS "TRIQS : Adding compilation flags detected by the library (C++11/14, libc++, etc...) ")
add_subdirectory(c++)
add_subdirectory(python python/triqs_dft_tools)
add_subdirectory(shells)
#------------------------
# tests
#------------------------
option(TEST_COVERAGE "Analyze the coverage of tests" OFF)
# perform tests with coverage info
if (${TEST_COVERAGE})
# we try to locate the coverage program
find_program(PYTHON_COVERAGE python-coverage)
find_program(PYTHON_COVERAGE coverage)
if(NOT PYTHON_COVERAGE)
message(FATAL_ERROR "Program coverage (or python-coverage) not found.\nEither set PYTHON_COVERAGE explicitly or disable TEST_COVERAGE!\nYou need to install the python package coverage, e.g. with\n pip install coverage\nor with\n apt install python-coverage")
endif()
message(STATUS "Setting up test coverage")
add_custom_target(coverage ${PYTHON_COVERAGE} combine --append .coverage plovasp/.coverage || true COMMAND ${PYTHON_COVERAGE} html COMMAND echo "Open ${CMAKE_BINARY_DIR}/test/htmlcov/index.html in browser!" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test)
# Tests
if(Build_Tests)
add_subdirectory(test)
endif()
enable_testing()
option(Build_Tests "Build the tests of the library " ON)
if (Build_Tests)
message(STATUS "-------- Preparing tests -------------")
add_subdirectory(test)
# Python
if(PythonSupport)
add_subdirectory(python/${PROJECT_NAME})
endif()
#------------------------
# Documentation
#------------------------
option(Build_Documentation "Build documentation" OFF)
if(${Build_Documentation})
if(NOT ${TRIQS_WITH_DOCUMENTATION})
message("Error: TRIQS library has not been compiled with its documentation")
endif()
# Docs
if(Build_Documentation)
add_subdirectory(doc)
endif()
#--------------------------------------------------------
# Packaging
#--------------------------------------------------------
# dfttols vasp interface bash scripts
add_subdirectory(bin)
# Additional configuration files
add_subdirectory(share)
# #############
# Debian Package
option(BUILD_DEBIAN_PACKAGE "Build a deb package" OFF)
if(BUILD_DEBIAN_PACKAGE)
if(BUILD_DEBIAN_PACKAGE AND NOT IS_SUBPROJECT)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging")
endif()
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_VERSION ${DFT_TOOLS_VERSION})
SET(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/dft_tools")
EXECUTE_PROCESS(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.2)")
SET(CPACK_DEBIAN_PACKAGE_CONFLICTS "dft_tools")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
INCLUDE(CPack)
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/${PROJECT_NAME}")
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 3.1)")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
include(CPack)
endif()

674
COPYING.txt Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

1
ChangeLog.md Symbolic link
View File

@ -0,0 +1 @@
doc/ChangeLog.md

View File

@ -1,12 +1,16 @@
# See ../triqs/packaging for other options
FROM flatironinstitute/triqs:master-ubuntu-clang
FROM flatironinstitute/triqs:unstable-ubuntu-clang
ARG APPNAME=triqs_dft_tools
ARG APPNAME
COPY . $SRC/$APPNAME
COPY requirements.txt /src/$APPNAME/requirements.txt
RUN pip3 install -r /src/$APPNAME/requirements.txt
COPY --chown=build . $SRC/$APPNAME
WORKDIR $BUILD/$APPNAME
RUN chown build .
USER build
ARG BUILD_DOC=0
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 && make test CTEST_OUTPUT_ON_FAILURE=1
ARG BUILD_ID
ARG CMAKE_ARGS
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} $CMAKE_ARGS && make -j4 || make -j1 VERBOSE=1
USER root
RUN make install

80
Jenkinsfile vendored
View File

@ -1,5 +1,6 @@
def projectName = "dft_tools" /* set to app/repo name */
def dockerName = projectName.toLowerCase();
/* which platform to build documentation on */
def documentationPlatform = "ubuntu-clang"
/* depend on triqs upstream branch/project */
@ -24,12 +25,12 @@ def platforms = [:]
/****************** linux builds (in docker) */
/* Each platform must have a cooresponding Dockerfile.PLATFORM in triqs/packaging */
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "sanitize"]
/* .each is currently broken in jenkins */
for (int i = 0; i < dockerPlatforms.size(); i++) {
def platform = dockerPlatforms[i]
platforms[platform] = { -> node('docker') {
stage(platform) { timeout(time: 1, unit: 'HOURS') {
platforms[platform] = { -> node('linux && docker && triqs') {
stage(platform) { timeout(time: 1, unit: 'HOURS') { ansiColor('xterm') {
checkout scm
/* construct a Dockerfile for this base */
sh """
@ -37,73 +38,98 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
mv -f Dockerfile.jenkins Dockerfile
"""
/* build and tag */
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_DOC=${platform==documentationPlatform} .")
def args = ''
if (platform == documentationPlatform)
args = '-DBuild_Documentation=1'
else if (platform == "sanitize")
args = '-DASAN=ON -DUBSAN=ON'
def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_ID=${env.BUILD_TAG} --build-arg CMAKE_ARGS='${args}' .")
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
img.inside() {
sh "make -C \$BUILD/${projectName} test CTEST_OUTPUT_ON_FAILURE=1"
}
}
if (!keepInstall) {
sh "docker rmi --no-prune ${img.imageName()}"
}
} }
} } }
} }
}
/****************** osx builds (on host) */
def osxPlatforms = [
["gcc", ['CC=gcc-7', 'CXX=g++-7']],
["clang", ['CC=$BREW/opt/llvm/bin/clang', 'CXX=$BREW/opt/llvm/bin/clang++', 'CXXFLAGS=-I$BREW/opt/llvm/include', 'LDFLAGS=-L$BREW/opt/llvm/lib']]
["gcc", ['CC=gcc-11', 'CXX=g++-11', 'FC=gfortran-11']],
["clang", ['CC=$BREW/opt/llvm/bin/clang', 'CXX=$BREW/opt/llvm/bin/clang++', 'FC=gfortran-11', 'CXXFLAGS=-I$BREW/opt/llvm/include', 'LDFLAGS=-L$BREW/opt/llvm/lib']]
]
for (int i = 0; i < osxPlatforms.size(); i++) {
def platformEnv = osxPlatforms[i]
def platform = platformEnv[0]
platforms["osx-$platform"] = { -> node('osx && triqs') {
stage("osx-$platform") { timeout(time: 1, unit: 'HOURS') {
stage("osx-$platform") { timeout(time: 1, unit: 'HOURS') { ansiColor('xterm') {
def srcDir = pwd()
def tmpDir = pwd(tmp:true)
def buildDir = "$tmpDir/build"
/* install real branches in a fixed predictable place so apps can find them */
def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install"
def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}"
def venv = triqsDir
dir(installDir) {
deleteDir()
}
checkout scm
def hdf5 = "${env.BREW}/opt/hdf5@1.10"
dir(buildDir) { withEnv(platformEnv[1].collect { it.replace('\$BREW', env.BREW) } + [
"PATH=$triqsDir/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin",
"CPLUS_INCLUDE_PATH=$triqsDir/include:${env.BREW}/include",
"LIBRARY_PATH=$triqsDir/lib:${env.BREW}/lib",
"CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) {
"PATH=$venv/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin",
"HDF5_ROOT=$hdf5",
"C_INCLUDE_PATH=$hdf5/include:${env.BREW}/include",
"CPLUS_INCLUDE_PATH=$venv/include:$hdf5/include:${env.BREW}/include",
"LIBRARY_PATH=$venv/lib:$hdf5/lib:${env.BREW}/lib",
"LD_LIBRARY_PATH=$hdf5/lib",
"PYTHONPATH=$installDir/lib/python3.9/site-packages",
"CMAKE_PREFIX_PATH=$venv/lib/cmake/triqs",
"OMP_NUM_THREADS=2"]) {
deleteDir()
/* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */
sh "pip install -r $srcDir/requirements.txt"
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
sh "make -j3"
try {
sh "pip3 install -U -r $srcDir/requirements.txt"
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir -DBuild_Deps=Always"
sh "make -j2 || make -j1 VERBOSE=1"
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { try {
sh "make test CTEST_OUTPUT_ON_FAILURE=1"
} catch (exc) {
archiveArtifacts(artifacts: 'Testing/Temporary/LastTest.log')
throw exc
}
} }
sh "make install"
} }
} }
} } }
} }
}
/****************** wrap-up */
def error = null
try {
parallel platforms
if (keepInstall) { node("docker") {
if (keepInstall) { node('linux && docker && triqs') {
/* Publish results */
stage("publish") { timeout(time: 5, unit: 'MINUTES') {
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
def release = env.BRANCH_NAME == "master" || env.BRANCH_NAME == "unstable" || sh(returnStdout: true, script: "git describe --exact-match HEAD || true").trim()
def workDir = pwd()
def workDir = pwd(tmp:true)
lock('triqs_publish') {
/* Update documention on gh-pages branch */
dir("$workDir/gh-pages") {
def subdir = "${projectName}/${env.BRANCH_NAME}"
git(url: "ssh://git@github.com/TRIQS/TRIQS.github.io.git", branch: "master", credentialsId: "ssh", changelog: false)
sh "rm -rf ${subdir}"
docker.image("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${documentationPlatform}").inside() {
sh "cp -rp \$INSTALL/share/doc/triqs_${projectName} ${subdir}"
docker.image("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${documentationPlatform}").inside() {
sh """#!/bin/bash -ex
base=\$INSTALL/share/doc
dir="${projectName}"
[[ -d \$base/triqs_\$dir ]] && dir=triqs_\$dir || [[ -d \$base/\$dir ]]
cp -rp \$base/\$dir ${subdir}
"""
}
sh "git add -A ${subdir}"
sh """
@ -131,13 +157,13 @@ try {
} }
} }
} catch (err) {
error = err
} finally {
/* send email on build failure (declarative pipeline's post section would work better) */
if (env.BRANCH_NAME != "jenkins") emailext(
if ((error != null || currentBuild.currentResult != 'SUCCESS') && env.BRANCH_NAME != "jenkins") emailext(
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED
$err
Check console output at \$BUILD_URL to view full results.
Building \$BRANCH_NAME for \$CAUSE
@ -149,11 +175,11 @@ Changes:
End of build log:
\${BUILD_LOG,maxLines=60}
""",
to: 'mzingl@flatironinstitute.org, hstrand@flatironinstitute.org, nwentzell@flatironinstitute.org, dsimon@flatironinstitute.org',
to: 'ahampel@flatironinstitute.org, nwentzell@flatironinstitute.org, dsimon@flatironinstitute.org',
recipientProviders: [
[$class: 'DevelopersRecipientProvider'],
],
replyTo: '$DEFAULT_REPLYTO'
)
throw err
if (error != null) throw error
}

17
LICENSE.txt Normal file
View File

@ -0,0 +1,17 @@
TRIQS: a Toolbox for Research in Interacting Quantum Systems
Copyright (C) 2013-2020 The Authors (c.f. AUTHORS.txt)
Copyright (C) 2018-2020 The Simons Foundation
TRIQS is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TRIQS (in the file COPYING.txt in this directory). If not, see
<http://www.gnu.org/licenses/>.

View File

@ -1,15 +1,15 @@
Wien2TRIQS interface to Wien2k
Copyright (C) 2011-2013, M. Aichhorn, L. Pourovskii, V. Vildosola and C. Martins
DFT_Tools - A TRIQS application for ab initio calculations
Copyright (C) 2011-2019: M. Aichhorn, L. Pourovskii, V. Vildosola and C. Martins
Copyright (C) 2020-2022: The Simons Foundation
1. Documentation
You will find the documentation of this application under
<https://triqs.github.io/dft_tools/>.
You will find the documentation of this application under [triqs.github.io/dft_tools](https://triqs.github.io/dft_tools/).
2. Installation
The installation steps are described in
<https://triqs.github.io/dft_tools/2.1.x/install.html>
The installation steps are described in [triqs.github.io/dft_tools/latest/install](https://triqs.github.io/dft_tools/latest/install.html)
3. Version

View File

@ -1,9 +1,13 @@
configure_file(plovasp.bash.in plovasp)
configure_file(plovasp.in plovasp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plovasp DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
configure_file(vasp_dmft.bash.in vasp_dmft)
configure_file(vasp_dmft.in vasp_dmft)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vasp_dmft DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
configure_file(init_dmftpr.in init_dmftpr)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/init_dmftpr DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

124
bin/init_dmftpr.in Executable file
View File

@ -0,0 +1,124 @@
#!/usr/bin/env python
import glob, sys, os
from numpy import array
def write_indmftpr():
"""
Usage: init_dmftpr
**case.struct file is required for this script.**
An interactive script to generate the input file (case.indmftpr) for
the dmftproj program.
"""
orbitals = {"s" : [1, 0, 0, 0],
"p" : [0, 1, 0, 0],
"d" : [0, 0, 1, 0],
"f" : [0, 0, 0, 1]}
corr_orbitals = {"s" : [2, 0, 0, 0],
"p" : [0, 2, 0, 0],
"d" : [0, 0, 2, 0],
"f" : [0, 0, 0, 2]}
dirname = os.getcwd().rpartition('/')[2]
if os.path.isfile(dirname + ".indmftpr"):
found = input("Previous {}.indmftpr detected! Continue? (y/n)\n".format(dirname))
if found == "n": sys.exit(0)
with open(dirname + ".indmftpr", "w") as out:
print("Preparing dmftproj input file : {}\n".format(dirname + ".indmftpr"))
if not os.path.isfile(dirname + ".struct"): print("Could not identify a case.struct file!"); sys.exit(-1);
struct = open(glob.glob("*.struct")[0], "r").readlines()
species = [line.split()[0] for line in struct if "NPT" in line]
num_atoms = len(species)
print("number of atoms = {} ({})\n".format(str(num_atoms), " ".join(species)))
out.write(str(num_atoms)+"\n")
mult = [line.split("=")[1].split()[0] for line in struct if "MULT" in line ]
out.write(" ".join(mult)+"\n")
out.write("3\n")
for atom in range(num_atoms):
while True: # input choice of spherical harmonics for atom
sph_harm=input("What flavor of spherical harmonics do you want to use for ATOM {} ({})? (cubic/complex/fromfile)\n".format(atom+1, species[atom]))
if sph_harm in ["cubic", "complex", "fromfile"]:
out.write(sph_harm+"\n")
if sph_harm == "fromfile":
filename=input("name of file defining the basis?\n")
if len(filename) < 25: # name of file must be less than 25 characters
out.write(filename)
else:
print("{} is too long!".format(filename))
rename=input("Rename the file to: \n")
if os.path.isfile(filename):
os.rename(filename, rename)
out.write(rename+"\n")
else:
print("{} could not be found in the current directory!".format(filename))
sys.exit(1)
break
else:
print("Did not recognize that input. Try again.")
corr=input("Do you want to treat ATOM {} ({}) as correlated (y/n)?\n".format(atom+1, species[atom]))
if corr == "y":
proj=input("Specify the correlated orbital? (d,f)\n")
while True:
non_corr=input("projectors for non-correlated orbitals? (type h for help)\n")
if non_corr == "h":
print("indicate orbital projectors using (s, p, d, or f). For multiple, combine them (sp, pd, spd, etc.)")
elif len(non_corr) > 0 and proj in non_corr:
print("Error: User can not choose orbital {} as both correlated and uncorrelated!".format(proj))
else:
projectors=array([0, 0, 0, 0])
projectors += array(corr_orbitals[proj])
if len(non_corr) > 0:
for p in non_corr: projectors += array(orbitals[p])
out.write(" ".join(list(map(str, projectors)))+"\n")
break
to_write = "0 0 0 0\n"
if proj == "d":
irrep=input("Split this orbital into it's irreps? (t2g/eg/n)\n")
if irrep == "t2g":
to_write = "0 0 2 0\n01\n"
elif irrep == "eg":
to_write = "0 0 2 0\n10\n"
soc=input("Do you want to include soc? (y/n)\n")
if soc == "y":
if proj=="d" and ( irrep == "t2g" or irrep == "eg" ):
print("Warning: For SOC, dmftproj will use the entire d-shell. Using entire d-shell!")
out.write("0 0 0 0\n")
out.write("1\n")
else:
out.write(to_write)
out.write("1\n")
else:
out.write(to_write)
out.write("0\n")
else: # still identify the projectors
while True:
proj=input("Specify the projectors that you would like to include? (type h for help)\n")
if proj == "h":
print("indicate orbital projectors using (s, p, d, or f). For multiple, combine them (sp, pd, spd, etc.)")
else:
projectors = array([0, 0, 0, 0], dtype=int)
for p in proj: projectors += array(orbitals[p], dtype=int)
out.write(" ".join(list(map(str, projectors)))+"\n")
out.write("0 0 0 0\n")
break
while True:
window=input("Specify the projection window around eF (default unit is Ry, specify eV with -X.XX X.XX eV)\n")
if float(window.split()[0]) < 0 and float(window.split()[1]) > 0:
try:
eV2Ry=1.0/13.60566
if window.split()[2] == "ev" or window.split()[2] == "eV" or window.split()[2] == "Ev":
out.write("{0:0.2f} {1:0.2f}".format(float(window.split()[0])*eV2Ry, float(window.split()[1])*eV2Ry))
except:
out.write(window)
break
else:
print("The energy window ({}) does not contain the Fermi energy!".format(window))
print("initialize {} file ok!".format(dirname + ".indmftpr"))
if __name__ == "__main__":
write_indmftpr()

4
bin/plovasp.in Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
@TRIQS_PYTHON_EXECUTABLE@ -m triqs_dft_tools.converters.plovasp.converter $@

126
bin/vasp_dmft.in Executable file
View File

@ -0,0 +1,126 @@
#!/bin/bash
MPIRUN_CMD=mpirun
show_help()
{
echo "
Usage: vasp_dmft [-n <number of cores>] -i <number of iterations> -j <number of VASP iterations with fixed charge density> [-v <VASP version>] [-p <path to VASP directory>] [<dmft_script.py>]
If the number of cores is not specified it is set to 1 by default.
Set the number of times the dmft solver is called with -i <number of iterations>
Set the number of VASP iteration with a fixed charge density update
inbetween the dmft runs with -j <number of VASP iterations with fixed charge density>
Set the version of VASP by -v standard(default)/no_gamma_write to
specify if VASP writes the GAMMA file or not.
If the path to VASP directory is not specified it must be provided by a
variable VASP_DIR.
<dmft_script.py> must provide an importable function 'dmft_cycle()'
which is invoked once per DFT+DMFT iteration. If the script name is
omitted the default name 'csc_dmft.py' is used.
"
}
while getopts ":n:i:j:v:p:h" opt; do
case $opt in
n)
# echo "Option: Ncpu, argument: $OPTARG"
if [ -n "$OPTARG" ]; then
NPROC=$OPTARG
# echo "Number of cores: $NPROC"
fi
;;
i)
# echo "Option: Niter"
if [ -n "$OPTARG" ]; then
NITER=$OPTARG
# echo "Number of iterations: $NITER"
fi
;;
j)
# echo "Option: Ndftiter"
if [ -n "$OPTARG" ]; then
NDFTITER=$OPTARG
# echo "Number of iterations with fixed density: $NDFTITER"
fi
;;
p)
if [ -n "$OPTARG" ]; then
VASP_DIR=$OPTARG
fi
;;
v)
if [ -n "$OPTARG" ]; then
VASP_VERSION=$OPTARG
# echo "Version of VASP (writing GAMMA file (standard) or not (no_gamma_write): $VASP_VERSION"
fi
;;
h)
show_help
exit 1
;;
:)
echo " Error: Option -$OPTARG requires an argument" >&2
show_help
exit 1
;;
\?)
echo " Error: Invalid option -$OPTARG" >&2
esac
done
if [ -z "$NITER" ]; then
echo " Error: Number of iterations must be specified with option -i" >&2
show_help
exit 1
fi
if [ -z "$VASP_DIR" ]; then
echo " Error: A path to VASP directory must be given either with option -p or by setting variable VASP_DIR" >&2
show_help
exit 1
fi
if [ -z "$NPROC" ]; then
echo " Number of cores not specified, setting to 1"
NPROC=1
fi
if [ -z "$NDFTITER" ]; then
echo " Number of VASP iterations without updating density not specified, setting to 1"
NDFTITER=1
fi
if [ -z "$VASP_VERSION" ]; then
echo " VASP version not specified, setting to standard"
VASP_VERSION="standard"
fi
shift $((OPTIND-1))
if [ -z "$1" ]; then
DMFT_SCRIPT=csc_dmft.py
else
DMFT_SCRIPT=$1
fi
echo " Number of cores: $NPROC"
echo " Number of iterations: $NITER"
echo " Number of iterations with fixed density: $NDFTITER"
echo " VASP version: $VASP_VERSION"
echo " Script name: $DMFT_SCRIPT"
rm -f vasp.lock
stdbuf -o 0 $MPIRUN_CMD -np $NPROC "$VASP_DIR" &
$MPIRUN_CMD -np $NPROC @TRIQS_PYTHON_EXECUTABLE@ -m triqs_dft_tools.converters.plovasp.sc_dmft $(jobs -p) $NITER $NDFTITER $DMFT_SCRIPT 'plo.cfg' $VASP_VERSION || kill %1

View File

@ -1,5 +0,0 @@
makefile
Makefile
*.so
*.o
*.pyc

View File

@ -1,7 +0,0 @@
add_library(atm_c dos_tetra3d.hpp dos_tetra3d.cpp argsort.hpp argsort.cpp)
target_link_libraries(atm_c triqs)
target_compile_options(atm_c PRIVATE -std=c++17)
install(TARGETS atm_c DESTINATION lib)
add_subdirectory(test)

View File

@ -1,13 +0,0 @@
enable_testing()
FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
FOREACH( TestName1 ${TestList} )
STRING(REPLACE ".cpp" "" TestName ${TestName1})
add_executable( ${TestName} ${TestName}.cpp )
target_link_libraries( ${TestName} atm_c triqs)
triqs_set_rpath_for_target( ${TestName} )
add_test(NAME ${TestName} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${t})
ENDFOREACH( TestName1 ${TestList} )

View File

@ -0,0 +1,84 @@
file(GLOB_RECURSE sources *.cpp)
add_library(${PROJECT_NAME}_c ${sources})
add_library(${PROJECT_NAME}::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c)
# Link against triqs and enable warnings
target_link_libraries(${PROJECT_NAME}_c PUBLIC triqs PRIVATE $<BUILD_INTERFACE:${PROJECT_NAME}_warnings>)
# Configure target and compilation
set_target_properties(${PROJECT_NAME}_c PROPERTIES
POSITION_INDEPENDENT_CODE ON
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
target_include_directories(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/c++>)
target_include_directories(${PROJECT_NAME}_c SYSTEM INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
target_compile_definitions(${PROJECT_NAME}_c PUBLIC
TRIQS_DFT_TOOLS_GIT_HASH=${PROJECT_GIT_HASH}
TRIQS_GIT_HASH=${TRIQS_GIT_HASH}
$<$<CONFIG:Debug>:TRIQS_DFT_TOOLS_DEBUG>
$<$<CONFIG:Debug>:TRIQS_DEBUG>
$<$<CONFIG:Debug>:TRIQS_ARRAYS_ENFORCE_BOUNDCHECK>
)
# Install library and headers
install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
# ========= Static Analyzer Checks ==========
option(ANALYZE_SOURCES OFF "Run static analyzer checks if found (clang-tidy, cppcheck)")
if(ANALYZE_SOURCES)
# Locate static analyzer tools
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
# Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE)
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
set_target_properties(${PROJECT_NAME}_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
else()
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
endif()
# Run cppcheck if found
if(CPPCHECK_EXECUTABLE)
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
add_custom_command(
TARGET ${PROJECT_NAME}_c
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,style,performance,portability
--std=c++20
--template=gcc
--verbose
--force
--quiet
${sources}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
else()
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
endif()
endif()
# ========= Dynamic Analyzer Checks ==========
option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer")
option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer")
if(ASAN)
if(NOT TARGET asan)
find_package(sanitizer REQUIRED "asan")
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:asan>)
endif()
if(UBSAN)
if(NOT TARGET ubsan)
find_package(sanitizer REQUIRED "ubsan")
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:ubsan>)
endif()

View File

@ -0,0 +1,3 @@
#pragma once
#include "./vasp/argsort.hpp"
#include "./vasp/dos_tetra3d.hpp"

View File

@ -18,7 +18,7 @@
* TRIQS. If not, see <http://www.gnu.org/licenses/>.
*
*******************************************************************************/
#include <triqs/arrays.hpp>
#include <nda/nda.hpp>
#include <iostream>
#include <complex>
@ -28,8 +28,8 @@
//#define __TETRA_DEBUG
#define __TETRA_ARRAY_VIEW
using triqs::arrays::array;
using triqs::arrays::array_view;
using nda::array;
using nda::array_view;
/***************************************************
@ -79,12 +79,12 @@ array<double, 2> dos_tetra_weights_3d(array<double, 1> eigk, double en, array<lo
int ntet; /// Number of tetrahedra
// Auxiliary variables and loop indices
if (first_dim(itt) != NUM_TET_CORNERS + 1)
if (itt.shape()[0] != NUM_TET_CORNERS + 1)
{
TRIQS_RUNTIME_ERROR << " The first dimension of 'itt' must be equal to 5";
NDA_RUNTIME_ERROR << " The first dimension of 'itt' must be equal to 5";
}
ntet = second_dim(itt);
ntet = itt.shape()[1];
array<double, 2> cti(NUM_TET_CORNERS, ntet); // Corner weights to be returned

View File

@ -20,18 +20,16 @@
*******************************************************************************/
#pragma once
#include <triqs/arrays.hpp>
#include <nda/nda.hpp>
using triqs::arrays::array;
using triqs::arrays::array_view;
/// DOS of a band by analytical tetrahedron method
///
/// Returns corner weights for all tetrahedra for a given band and real energy.
array<double, 2>
dos_tetra_weights_3d(array_view<double, 1> eigk, /// Band energies for each k-point
nda::array<double, 2>
dos_tetra_weights_3d(nda::array_view<double, 1> eigk, /// Band energies for each k-point
double en, /// Energy at which DOS weights are to be calculated
array_view<long, 2> itt /// Tetrahedra defined by k-point indices
nda::array_view<long, 2> itt /// Tetrahedra defined by k-point indices
);
//array<double, 2>
//dos_tetra_weights_3d(array<double, 1> eigk, /// Band energies for each k-point

View File

@ -0,0 +1,3 @@
#pragma once
#include "./converters/vasp.hpp"

View File

@ -1,8 +0,0 @@
def application_pytriqs_import(name,*args,**kwargs):
if name.startswith('@package_name@'):
name = name[len('@package_name@')+1:]
return builtin_import(name,*args,**kwargs)
import __builtin__
__builtin__.__import__, builtin_import = application_pytriqs_import, __builtin__.__import__

1
deps/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

67
deps/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,67 @@
include(external_dependency.cmake)
# Add your dependencies with the function
#
# external_dependency(name
# [VERSION <version-number>]
# [GIT_REPO <url>]
# [GIT_TAG <tag>]
# [BUILD_ALWAYS]
# [EXCLUDE_FROM_ALL]
# )
#
# Resolve the dependency using the following steps in order.
# If a step was successful, skip the remaining ones.
#
# 1. Use find_package(name [<version-number>])
# to locate the package in the system.
# Skip this step if Build_Deps option is set.
# 2. Try to find a directory containing the sources
# at ${CMAKE_CURRENT_SOURCE_DIR}/name and
# ${CMAKE_SOURCE_DIR}/deps/name. If found
# build it as a cmake sub-project.
# 3. If GIT_REPO is provided, git clone the sources,
# and build them as a cmake sub-project.
#
# Addtional options:
#
# GIT_TAG - Use this keyword to specify the git-tag, branch or commit hash
#
# BUILD_ALWAYS - If set, this dependency will always be built from source
# and will never be searched in the system.
#
# EXCLUDE_FROM_ALL - If set, targets of the dependency cmake subproject
# will not be included in the ALL target of the project.
# In particular the dependency will not be installed.
if(NOT DEFINED Build_Deps)
set(Build_Deps "Always" CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
else()
set(Build_Deps_Opts "Never" "Always" "IfNotFound")
if(NOT ${Build_Deps} IN_LIST Build_Deps_Opts)
message(FATAL_ERROR "Build_Deps option should be either 'Never', 'Always' or 'IfNotFound'")
endif()
set(Build_Deps ${Build_Deps} CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
if(NOT IS_SUBPROJECT AND NOT Build_Deps STREQUAL "Always" AND (ASAN OR UBSAN))
message(WARNING "For builds with llvm sanitizers (ASAN/UBSAN) it is recommended to use -DBuild_Deps=Always to avoid false positives.")
endif()
endif()
# -- Cpp2Py --
if(PythonSupport OR Build_Documentation)
external_dependency(Cpp2Py
GIT_REPO https://github.com/TRIQS/cpp2py
VERSION 2.0
GIT_TAG master
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)
endif()
# -- GTest --
external_dependency(GTest
GIT_REPO https://github.com/google/googletest
GIT_TAG main
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)

95
deps/external_dependency.cmake vendored Normal file
View File

@ -0,0 +1,95 @@
# Copyright (c) 2020 Simons Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You may obtain a copy of the License at
# https://www.gnu.org/licenses/gpl-3.0.txt
# Consider ROOT env variables in find_package
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Make sure that imported targets are always global
get_property(IMPORTED_ALWAYS_GLOBAL GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL)
if(NOT IMPORTED_ALWAYS_GLOBAL)
function(add_library)
set(_args ${ARGN})
if ("${_args}" MATCHES ";IMPORTED")
list(APPEND _args GLOBAL)
endif()
_add_library(${_args})
endfunction()
set_property(GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL TRUE)
endif()
# Define External Dependency Function
function(external_dependency)
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;BUILD_ALWAYS" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
# -- Was dependency already found?
get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
if(${ARGV0}_FOUND)
message(STATUS "Dependency ${ARGV0} was already resolved.")
return()
endif()
# -- Try to find package in system.
if(NOT ARG_BUILD_ALWAYS AND NOT Build_Deps STREQUAL "Always")
find_package(${ARGV0} ${ARG_VERSION} QUIET HINTS ${CMAKE_INSTALL_PREFIX})
if(${ARGV0}_FOUND)
message(STATUS "Found dependency ${ARGV0} in system ${${ARGV0}_ROOT}")
return()
elseif(Build_Deps STREQUAL "Never")
message(FATAL_ERROR "Could not find dependency ${ARGV0} in system. Please install the dependency manually or use -DBuild_Deps=IfNotFound during cmake configuration to automatically build all dependencies that are not found.")
endif()
endif()
# -- Build package from source
message(STATUS " =============== Configuring Dependency ${ARGV0} =============== ")
if(ARG_EXCLUDE_FROM_ALL)
set(subdir_opts EXCLUDE_FROM_ALL)
set(Build_Tests OFF)
set(Build_Documentation OFF)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0})
message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
add_subdirectory(${ARGV0} ${subdir_opts})
elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/deps/${ARGV0})
message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_SOURCE_DIR}/deps/${ARGV0}")
add_subdirectory(${ARGV0} ${subdir_opts})
elseif(ARG_GIT_REPO)
set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0})
set(src_dir ${bin_dir}_src)
if(NOT IS_DIRECTORY ${src_dir})
if(ARG_GIT_TAG)
set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false)
endif()
if(NOT GIT_EXECUTABLE)
find_package(Git REQUIRED)
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir}
RESULT_VARIABLE clone_failed
ERROR_VARIABLE clone_error
)
if(clone_failed)
message(FATAL_ERROR "Failed to clone sources for dependency ${ARGV0}.\n ${clone_error}")
endif()
endif()
add_subdirectory(${src_dir} ${bin_dir} ${subdir_opts})
else()
message(FATAL_ERROR "Could not find or build dependency ${ARGV0}")
endif()
message(STATUS " =============== End ${ARGV0} Configuration =============== ")
set_property(GLOBAL PROPERTY ${ARGV0}_FOUND TRUE)
endfunction()

View File

@ -1,23 +1,81 @@
# generate the conf.py
# Generate the sphinx config file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
# -----------------------------------------------------------------------------
# Create an optional target that allows us to regenerate the C++ doc with c++2rst
# -----------------------------------------------------------------------------
add_custom_target(${PROJECT_NAME}_docs_cpp2rst)
include(${PROJECT_SOURCE_DIR}/share/cmake/extract_flags.cmake)
extract_flags(${PROJECT_NAME}_c BUILD_INTERFACE)
separate_arguments(${PROJECT_NAME}_c_CXXFLAGS)
macro(generate_docs header_file)
add_custom_command(
TARGET ${PROJECT_NAME}_docs_cpp2rst
COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
COMMAND
PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH}
PATH=${CPP2PY_BINARY_DIR}/bin:${CPP2PY_ROOT}/bin:$ENV{PATH}
c++2rst
${header_file}
-N ${PROJECT_NAME}
--output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
-I${PROJECT_SOURCE_DIR}/c++
--cxxflags="${${PROJECT_NAME}_c_CXXFLAGS}"
)
endmacro(generate_docs)
generate_docs(${PROJECT_SOURCE_DIR}/c++/${PROJECT_NAME}/${PROJECT_NAME}.hpp)
# --------------------------------------------------------
# Build & Run the C++ doc examples and capture the output
# --------------------------------------------------------
add_custom_target(${PROJECT_NAME}_docs_example_output)
file(GLOB_RECURSE ExampleList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(example ${ExampleList})
get_filename_component(f ${example} NAME_WE)
get_filename_component(d ${example} DIRECTORY)
add_executable(${PROJECT_NAME}_doc_${f} EXCLUDE_FROM_ALL ${example})
set_property(TARGET ${PROJECT_NAME}_doc_${f} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${d})
target_link_libraries(${PROJECT_NAME}_doc_${f} triqs)
add_custom_command(TARGET ${PROJECT_NAME}_doc_${f}
COMMAND ${PROJECT_NAME}_doc_${f} > ${CMAKE_CURRENT_SOURCE_DIR}/${d}/${f}.output 2>/dev/null
WORKING_DIRECTORY ${d}
)
add_dependencies(${PROJECT_NAME}_docs_example_output ${PROJECT_NAME}_doc_${f})
endforeach()
# ---------------------------------
# Top Sphinx target
# ---------------------------------
# Sources
file(GLOB_RECURSE sources *.rst)
if(NOT DEFINED SPHINXBUILD_EXECUTABLE)
find_package(Sphinx)
endif()
# create documentation target
set(sphinx_top ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
add_custom_command(OUTPUT ${sphinx_top} DEPENDS ${sources}
COMMAND ${TRIQS_SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html)
add_custom_target(doc_sphinx ALL DEPENDS ${sphinx_top} ${CMAKE_CURRENT_BINARY_DIR})
# Sphinx has internal caching, always run it
add_custom_target(${PROJECT_NAME}_docs_sphinx ALL)
add_custom_command(
TARGET ${PROJECT_NAME}_docs_sphinx
COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -j auto -c . -b html ${CMAKE_CURRENT_SOURCE_DIR} html
)
option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF)
if(NOT Sphinx_Only)
# Autodoc usage requires the python modules to be built first
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
if(CPP2PY_MODULES_LIST)
add_dependencies(${PROJECT_NAME}_docs_sphinx ${CPP2PY_MODULES_LIST})
endif()
# Generation of C++ Api and Example Outputs
add_dependencies(${PROJECT_NAME}_docs_sphinx ${PROJECT_NAME}_docs_cpp2rst ${PROJECT_NAME}_docs_example_output)
endif()
# ---------------------------------
# Install
# ---------------------------------
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/triqs_dft_tools
FILES_MATCHING
REGEX "\\.(html|pdf|png|gif|jpg|js|xsl|css|py|txt|inv|bib)$"
PATTERN "_*"
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/${PROJECT_NAME}
FILES_MATCHING
REGEX "\\.(html|pdf|png|gif|jpg|svg|js|xsl|css|py|txt|inv|bib|ttf|woff2|eot)$"
PATTERN "_*"
)

View File

@ -1,5 +1,142 @@
Version 2.2.x
-------------
(changelog)=
# Changelog
## Version 3.1.0
DFTTools Version 3.1.0 is a release that
* is compatible with TRIQS 3.1.x
* includes a major update for the Wannier90 converter (see below for details)
* updates sumk_dft to allow for charge self-consistent DFT+DMFT calculations with Quantum Espresso (dm_type = 'qe')
* adds a indmftpr helper script to prepare the case.indmftpr file for the dmftproj program
* uses the latest [app4triqs/3.1.x](https://github.com/TRIQS/app4triqs) skeleton
### Wannier90 Converter
* allow for charge self-consistent DFT+DMFT calculations
* spin-orbit coupling implemented
* option to add a local spin-orbit term to t2g local Hamiltonian (for now just for a single impurity. Fixed in next version)
* additional choices and added checks for different bases (rot_mat): hloc_diag, wannier (already implemented previously), none
* code restructured, more tests
* MPI speedup of the Fourier transform
* added new test in w90_convert.py for rot_mat_type='hloc_diag'
* update documentation of W90 Converter
* bugfix: This fix makes the function find_rot_mat() safer to use in case there are errors in finding the correct mapping. The converter will now abort if the agreement in mapping is below a user-definable threshold.
### Change in gf_struct
* In line with TRIQS 3.1.x, the form of the Green's function's structure (`gf_struct`) has been modified (see [triqs changelog](https://triqs.github.io/triqs/latest/ChangeLog.html#change-in-gf-struct-objects) for more information)
* Instead of `gf_struct = [("up", [0, 1]), ("down", [0, 1])]`, the new convention uses `gf_struct = [("up", 2), ("down", 2)]`
* This modifies the form of `gf_struct_solver` (and `sumk`) in `block_structure` and `SumkDFT` as well.
* Backwards-compatibility with old, stored `block_structure` objects is given, however a warning is issued.
* A helper-function `triqs.gf.block_gf.fix_gf_struct_type(gf_struct_old)` is provided in triqs to manually bring `gf_struct`s to the new form.
### Documentation
* change to read the docs sphinx theme
* clean up various doc files
* use autosummary to build reference documentation
* update Vasp tutorials
* update Wannier90 documentation to reflect new features
### Cmake
* require triqs3.1+ in debian package dependencies
* bump required TRIQS Version to 3.1
### Other changes
* bugfix for analyse_block_structure in sumk_dft
* bugfix in blockstructure module for the case of #corr_shells != #ineq_shells
* fix float comparison tolerances and few minor things in tests
* Vasp Converter: fixed normalization of kwghts to allow symmetries
* bugfix in Elk converter when creating the symmetry matrices of low symmetry systems with multiple equivalent atoms
* vectorize various loops in dfttools
* fix various from_L_G_R calls that require now data layed out in C-order
* use nda over TRIQS_RUNTIME_ERROR in dos_tetra3d
* changed fermi weights from np array complex to float in accordance with h5 structure
* expose parameter max_loops in sum_k.calc_mu dichotomy
Thanks to all commit-contributors (in alphabetical order): Sophie Beck, Alexander Hampel, Alyn James, Jonathan Karp, Harry LaBollita, Max Merkel, H. L. Nourse, Hermann Schnait, Nils Wentzell, @70akaline
## Version 3.0.0
DFTTools Version 3.0.0 is a major release that
* is compatible with TRIQS versions 3.0.x
* introduces compatibility with Python 3 (Python 2 is no longer supported)
* is now aligned with the general [app4triqs](https://github.com/TRIQS/app4triqs) application skeleton
* brings a major rework of the VASP interface, including thorough documentation, tutorials, a new Hamiltonian mode, the option to select bands instead of an energy window, and many small bugfixes.
* brings a major update of the block structure functionalities especially for SOC calculations, with detailed documentation and tutorials. Allows more control over the block structure coming from DFT, cutting out certain orbitals or throwing away off-diagonal elements when preparing input for the solver.
* New option in dmftproj to select the projection window using band indices instead of energie
### Restructuring
To be aligned with other applications for TRIQS, various files and folders had to be moved to new locations. The c++, fortran and python parts all are now in separate folders. The converter files have been more logically split into their own folders and name spaces. For example the Vasp converter is now located under `python/triqs_dft_tools/converters/vasp.py`. Especially the test folder structure was adapted to fit to the app4triqs skeleton, which separate folders for C++ and python tests.
### Dependency Management
We are managing the interdependencies of the various library components of triqs now using cmake.
Per default cmake will pull those dependencies from their corresponding
GitHub repositories, build them, and install these components together
with TRIQS, unless they are found in your system.
This behavior can be altered using the additional cmake options
* `-DBuild_Deps="Always"` - Always build dependencies, do not try to find them
* `-DBuild_Deps="Never"` - Never build dependencies, but find them instead
during the configuration step. See also the TRIQS documentation for more detailed instructions.
### Other Changes:
* Run port_to_triqs3 script
* Port py files to python3
* Update triqs python module name
* synchronize dfttools with app4triqs structure
* rename all h5 test archives according to test_name.ref.h5
* Changed 'orb' parameter to 'ish' for consistency in function summ_deg_gf in file sumk_dft.py
* small fix to read_inp_from_h5 function of Sumk
* renamed converters from app_converter.py to app.py
* look at the mesh of each shell of Sigma_imp, not just the first shell
* add function to find min and max of band energy, and add warning to set_Sigma if its mesh is smaller than the energy bounds
* warning for set_Sigma if ReFreqMesh is too small
* fixed a index bug that produced empty projectors for a unit cells with multiple shells in the VASP converter
* fixed a slicing bug for the calculation of the target density in the VASP converter, which selected 1 band less in the correlated window than required.
* added printout of complex part of local Hamiltonian in the Vasp converter
* doc on automatic basis rotations
* Bugfix in calculate_density_matrix for purely imaginary off-diagonals
* revamping the VASP interface documentation. Rewrote the interface with VASP guide. Removed the unused in doc/vasp. Start for SVO VASP tutorial as ipynb
* changed ref file for block structure test, since the order in dicts is not guaranteed the test failed as the order in py3 changed
* Vasp Converter: efermi is now read from LOCPROJ if DOSCAR does not contain it yet
* E-Fermi is read from DOSCAR not from LOCPROJ
* Added Tutorial for basis rotations: Sr2MgOsO6 w/o SOC
* Vasp converter add kpts and kpts_basis to h5
* many adjustments to Block structure and rotations including option to throw away certain parts of BlockGf
* implemented multiple ncsf VASP cycles
* Ignore imaginary part of the density when calculating mu
* Adjust hdf5 usage to changes in triqs
* Calculate diagonalization in solver blocks
* Do not use deprecated set_from_inverse_fourier
* add SOC tutorial
* add Block structure tutorial
* adding detailed Vasp tutorial
* Vasp converter now supports Hamiltonian mode
* Move setup files into separate bash scripts and adjust README
* Update README file with more detailed instructions
Thanks to all commit-contributors (in alphabetical order):
Markus Aichhorn, Alexander Hampel, Gernot Kraberger, Oleg Peil, Hermann Schnait, Malte Schueler, Nils Wentzell, Manuel Zingl
## Version 2.2.1
DFTTools Version 2.2.1 makes the application available
through the Anaconda package manager. We adjust
the install pages of the documentation accordingly.
We provide a more detailed description of the changes below.
* Add a section on the Anaconda package to the install page
* Add a LICENSE and AUTHORS file to the repository
## Version 2.2.0
* Ensure that the chemical potential calculations results in a real number
* Fix a bug in reading Wien2k optics files in SO/SP cases
@ -9,13 +146,12 @@ Version 2.2.x
This is to a large extend a compatibility release against TRIQS version 2.2.0
Thanks to all commit-contributors (in alphabetical order):
Markus Aichhorn, Dylan Simon, Erik van Loon, Nils Wentzell, Manuel Zingl
Markus Aichhorn, Dylan Simon, Erik van Loon, Nils Wentzell, Manuel Zingl
Version 2.1.x (changes since 1.4)
---------------------------------
## Version 2.1.x (changes since 1.4)
* Added Debian Packaging
* Added Debian Packaging
* Compatibility changes for TRIQS 2.1.x
* Jenkins adjustments
* Add option to measure python test coverage
@ -30,4 +166,4 @@ Version 2.1.x (changes since 1.4)
Thanks to all commit-contributors (in alphabetical order):
Markus Aichhorn, Gernot J. Kraberger, Olivier Parcollet, Oleg Peil, Hiroshi Shinaoka, Dylan Simon, Hugo U. R. Strand, Nils Wentzell, Manuel Zingl
Thanks to all user for reporting issues and suggesting improvements.
Thanks to all user for reporting issues and suggesting improvements.

5
doc/_static/css/custom.css vendored Normal file
View File

@ -0,0 +1,5 @@
@import url("theme.css");
.wy-nav-content {
max-width: 70em;
}

BIN
doc/_static/logo_flatiron.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
doc/_static/logo_simons.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,29 @@
{{ fullname | escape | underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}
.. autosummary::
:toctree:
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}
.. autosummary::
:toctree:
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,68 @@
{{ name | escape | underline}}
.. automodule:: {{ fullname }}
{% block functions %}
{% if functions %}
.. rubric:: Functions
.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes
.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}
.. autosummary::
:toctree:
:template: autosummary_class_template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}
.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block modules %}
{% if modules %}
.. rubric:: Modules
.. autosummary::
:toctree:
:template: autosummary_module_template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

View File

@ -1,3 +1,8 @@
.. _about:
About
******
License
=======
@ -17,7 +22,7 @@ of full charge self-consistency [#dft_tools2]_, necessary for total energy
calculations. The package at hand is fully implemented as an application
based on the TRIQS library [#dft_tools3]_.
**Developers**: M. Aichhorn, L. Pourovskii, P.Seth, V. Vildosola, M. Zingl, O. E. Peil, X. Deng, J. Mravlje, G. Kraberger, C. Martins, M. Ferrero, O. Parcollet
**Developers**: M. Aichhorn, L. Pourovskii, A. Hampel, P.Seth, V. Vildosola, M. Zingl, O. E. Peil, X. Deng, J. Mravlje, G. Kraberger, A. James, C. Martins, M. Ferrero, O. Parcollet
**Related papers**:

View File

@ -1,8 +0,0 @@
.. _changelog:
Changelog
=========
This document describes the main changes in DFTTools.
.. include:: ChangeLog.md

View File

@ -3,41 +3,134 @@
# TRIQS documentation build configuration file
import sys
sys.path.insert(0, "@TRIQS_SPHINXEXT_PATH@/numpydoc")
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext")
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext/numpydoc")
sys.path.insert(0, "@CMAKE_BINARY_DIR@/python")
# exclude these folders from scanning by sphinx
exclude_patterns = ['_templates']
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.githubpages',
'sphinx_autorun',
'nbsphinx',
'myst_parser',
'matplotlib.sphinxext.plot_directive',
'nbsphinx',
'IPython.sphinxext.ipython_console_highlighting',
'numpydoc']
myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"substitution",
"tasklist",
]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
source_suffix = '.rst'
project = u'TRIQS DFTTools'
copyright = u'2011-2019'
version = '@DFT_TOOLS_VERSION@'
# Turn on sphinx.ext.autosummary
autosummary_generate = True
autosummary_imported_members=False
mathjax_path = "@TRIQS_MATHJAX_PATH@/MathJax.js?config=default"
templates_path = ['@CMAKE_SOURCE_DIR@/doc/_templates']
project = 'TRIQS DFTTools'
version = '@PROJECT_VERSION@'
copyright = '2011-2021'
mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=default"
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
# this requires the sphinx_rtd_theme to be installed via pip
html_theme = 'sphinx_rtd_theme'
# this loads the custom css file to change the page width
html_style = 'css/custom.css'
#html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/logos/favicon.ico'
#html_logo = '@CMAKE_CURRENT_SOURCE_DIR@/logos/logo.png'
# options for the the rtd theme
html_theme_options = {
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
'style_nav_header_background': '#7E588A',
# Toc options
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}
html_theme = 'triqs'
html_theme_path = ['@TRIQS_THEMES_PATH@']
html_show_sphinx = False
html_context = {'header_title': 'dft tools',
'header_subtitle': 'connecting <a class="triqs" style="font-size: 12px" href="http://triqs.github.io/triqs">TRIQS</a> to DFT packages',
'header_links': [['Install', 'install'],
['Documentation', 'documentation'],
['Tutorials', 'tutorials'],
['Issues', 'issues'],
['About DFTTools', 'about']]}
html_static_path = ['@CMAKE_SOURCE_DIR@/doc/_static']
html_context = {'header_title': 'TRIQS DFTTools'}
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
htmlhelp_basename = 'TRIQSDFTToolsdoc'
htmlhelp_basename = '@PROJECT_NAME@doc'
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('http://triqs.github.io/triqs/master', None), 'triqscthyb': ('https://triqs.github.io/cthyb/master', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)}
# open links in new tab instead of same window
from sphinx.writers.html import HTMLTranslator
from docutils import nodes
from docutils.nodes import Element
class PatchedHTMLTranslator(HTMLTranslator):
def visit_reference(self, node: Element) -> None:
atts = {'class': 'reference'}
if node.get('internal') or 'refuri' not in node:
atts['class'] += ' internal'
else:
atts['class'] += ' external'
# ---------------------------------------------------------
# Customize behavior (open in new tab, secure linking site)
atts['target'] = '_blank'
atts['rel'] = 'noopener noreferrer'
# ---------------------------------------------------------
if 'refuri' in node:
atts['href'] = node['refuri'] or '#'
if self.settings.cloak_email_addresses and atts['href'].startswith('mailto:'):
atts['href'] = self.cloak_mailto(atts['href'])
self.in_mailto = True
else:
assert 'refid' in node, \
'References must have "refuri" or "refid" attribute.'
atts['href'] = '#' + node['refid']
if not isinstance(node.parent, nodes.TextElement):
assert len(node) == 1 and isinstance(node[0], nodes.image)
atts['class'] += ' image-reference'
if 'reftitle' in node:
atts['title'] = node['reftitle']
if 'target' in node:
atts['target'] = node['target']
self.body.append(self.starttag(node, 'a', '', **atts))
if node.get('secnumber'):
self.body.append(('%s' + self.secnumber_suffix) %
'.'.join(map(str, node['secnumber'])))
def setup(app):
app.set_translator('html', PatchedHTMLTranslator)

View File

@ -1,12 +0,0 @@
Table of contents
=================
.. toctree::
:maxdepth: 2
index
install
documentation
issues
changelog
about

View File

@ -9,7 +9,7 @@ Basic notions
-------------
.. toctree::
:maxdepth: 2
:maxdepth: 1
basicnotions/first
basicnotions/dft_dmft
@ -23,6 +23,7 @@ Construction of local orbitals from DFT
:maxdepth: 2
guide/conversion
h5structure
DFT+DMFT
@ -34,11 +35,21 @@ DFT+DMFT
guide/dftdmft_singleshot
guide/dftdmft_selfcons
Advanced Topics
---------------
.. toctree::
:maxdepth: 1
guide/blockstructure
guide/BasisRotation
guide/soc
Postprocessing
--------------
.. toctree::
:maxdepth: 2
:maxdepth: 1
guide/analysis
guide/transport
@ -49,16 +60,18 @@ Reference manual
This is the reference manual for the python routines.
.. toctree::
:maxdepth: 2
.. autosummary::
:recursive:
:toctree: _python_api
:template: autosummary_module_template.rst
block_structure
converters
sumk_dft
sumk_dft_tools
symmetry
trans_basis
reference/h5structure
reference/converters
reference/sumk_dft
reference/sumk_dft_tools
reference/symmetry
reference/transbasis
reference/block_structure
FAQs

View File

@ -0,0 +1,82 @@
.. _basisrotation:
Automatic basis rotations in DFT+DMFT
=====================================
When performing calculations with off-diagonal terms in the hybridisation function or in the local Hamiltonian, one is
often limited by the fermionic sign-problem slowing down the QMC calculations significantly. This can occur for instance if the crystal shows locally rotated or distorted cages, or when spin-orbit coupling is included. The examples for this are included in the :ref:`tutorials` of this documentation.
However, as the fermonic sign in the QMC calculation is no
physical observable, one can try to improve the calculation by rotating
to another basis. While this basis can in principle be chosen arbitrarily,
two choices which have shown good results; name the basis sets that diagonalize the local Hamiltonian or the local density matrix of the
system.
As outlined in section :ref:`blockstructure`, the :class:`BlockStructure` includes all necessary functionalities. While it is possible to manually transform each Green's functions and self energies between the *sumk* and the *solver* basis, this leads to cumbersum code and is discouraged. Instead, in order to facilitate the block-structure manipulations for an actual DFT+DMFT calculation, some of the necessary steps are automatically included automatically. As soon as the
transformation matrix is stored in the :class:`BlockStructure`, the
transformation is automatically performed when using :class:`SumkDFT`'s :meth:`extract_G_loc`,
:meth:`put_Sigma`, and :meth:`calc_dc` (see below).
Setting up the initial solver structure from DFT
------------------------------------------------
Before the actual calculation one has to specify the *solver* basis structure, in which the impurity problem will be tackled. The different available approximation were introduced in section :ref:`blockstructure`. An important feature of DFTTools is that there is an automatic way to determine the entries of the Green's function matrix that are zero by symmetry, when initialising the class::
from triqs_dft_tools.sumk_dft import *
SK = SumkDFT(hdf_file,use_dft_blocks='True')
The flag *use_dft_blocks=True* analysis the local density matrix, determines the zero entries, and sets up a minimal *solver* structure. Alternatively, this step can be achieved by (see the reference manual for options)::
SK.analyse_block_structure()
Finding the transformation matrix
---------------------------------
The SumkDFT class offers a method that can determine transformation matrices to certain new basis. It is called as follows::
SK.calculate_diagonalization_matrix(prop_to_be_diagonal='eal')
Possible option for *prop_to_be_diagonal* are *eal* (diagonalises the local hamiltonian) or *dm* (diagonalises the local density matrix). This routine stores the transformation matrix in the :class:`SK.block_structure` class, such that it can be used to rotate the basis.
Automatic transformation during the DMFT loop
---------------------------------------------
During a DMFT loop one is often switching back and forth between the unrotated basis (Sumk-Space) and the rotated basis that is used by the QMC Solver.
Once the SK.block_structure.transformation property is set as shown above, this is
done automatically, meaning that :class:`SumkDFT`'s :meth:`extract_G_loc`, :meth:`put_Sigma`, and :meth:`calc_dc` are doing the transformations by default::
for it in range(iteration_offset, iteration_offset + n_iterations):
# every GF is in solver space here
S.G0_iw << inverse(S.Sigma_iw + inverse(S.G_iw))
# solve the impurity in solver space -> hopefully better sign
S.solve(h_int = H, **p)
# calc_dc(..., transform = True) by default
SK.calc_dc(S.G_iw.density(), U_interact=U, J_hund=J, orb=0, use_dc_formula=DC_type)
# put_Sigma(..., transform_to_sumk_blocks = True) by default
SK.put_Sigma([S.Sigma_iw])
SK.calc_mu()
# extract_G_loc(..., transform_to_solver_blocks = True) by default
S.G_iw << SK.extract_G_loc()[0]
.. warning::
Before doing the DMFT self-consistency loop, one must not forget to also transform the
interaction Hamiltonian to the diagonal basis!
This can be also be done with a method of the :class:`BlockStructure` class,
namely the :meth:`convert_operator` method. Having set up a Hamiltonian in the *sumk* structure, it can easily
be transformed to the *solver* structure (including rotations of basis, picking of orbitals,
making matrices diagonal, etc) by::
H_solver = SK.block_structure.convert_operator(H_sumk)
We refer to the tutorials on how to set up the Hamiltonian H_sumk in selected cases.
Note that this transformation might generally lead to complex values in the
interaction Hamiltonian. Unless you know better and can make everything real,
you should take care of using the correct version of the TRIQS CTQMC solver.

View File

@ -0,0 +1,21 @@
5 ! Nsort
2 1 1 4 2 ! Mult(Nsort)
3 ! lmax
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
cubic ! choice of angular harmonics
0 0 2 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
0 ! SO flag
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
complex
0 0 0 0
0 0 0 0
-0.088 0.43 ! 0.40 gives warnings, 0.043 gives occ 1.996
0.04301

View File

@ -0,0 +1,72 @@
Sr2MgOsO6 s-o calc. M|| 0.00 0.00 1.00
B 5 87
RELA
10.507954 10.507954 14.968880 90.000000 90.000000 90.000000
ATOM -1: X=0.00000000 Y=0.50000000 Z=0.75000000
MULT= 2 ISPLIT=-2
-1: X=0.50000000 Y=0.00000000 Z=0.75000000
Sr 2+ NPT= 781 R0=.000010000 RMT= 2.50000 Z: 38.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -2: X=0.00000000 Y=0.00000000 Z=0.00000000
MULT= 1 ISPLIT=-2
Os 6+ NPT= 781 R0=.000005000 RMT= 1.94 Z: 76.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -3: X=0.00000000 Y=0.00000000 Z=0.50000000
MULT= 1 ISPLIT=-2
Mg 2+ NPT= 781 R0=.000100000 RMT= 1.89 Z: 12.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -4: X=0.74270000 Y=0.21790000 Z=0.00000000
MULT= 4 ISPLIT= 8
-4: X=0.25730000 Y=0.78210000 Z=0.00000000
-4: X=0.21790000 Y=0.25730000 Z=0.00000000
-4: X=0.78210000 Y=0.74270000 Z=0.00000000
O 2- NPT= 781 R0=.000100000 RMT= 1.58 Z: 8.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -5: X=0.00000000 Y=0.00000000 Z=0.75390000
MULT= 2 ISPLIT=-2
-5: X=0.00000000 Y=0.00000000 Z=0.24610000
O 2- NPT= 781 R0=.000100000 RMT= 1.58 Z: 8.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
8 NUMBER OF SYMMETRY OPERATIONS
0-1 0 0.00000000
1 0 0 0.00000000
0 0-1 0.00000000
1
-1 0 0 0.00000000
0-1 0 0.00000000
0 0-1 0.00000000
2
1 0 0 0.00000000
0 1 0 0.00000000
0 0-1 0.00000000
3
0-1 0 0.00000000
1 0 0 0.00000000
0 0 1 0.00000000
4
0 1 0 0.00000000
-1 0 0 0.00000000
0 0-1 0.00000000
5
-1 0 0 0.00000000
0-1 0 0.00000000
0 0 1 0.00000000
6
1 0 0 0.00000000
0 1 0 0.00000000
0 0 1 0.00000000
7
0 1 0 0.00000000
-1 0 0 0.00000000
0 0 1 0.00000000
8

View File

@ -0,0 +1,21 @@
5 ! Nsort
2 1 1 4 2 ! Mult(Nsort)
3 ! lmax
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
cubic ! choice of angular harmonics
0 0 2 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
1 ! SO flag
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
complex ! choice of angular harmonics
0 0 0 0 ! l included for each sort
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
complex
0 0 0 0
0 0 0 0
-0.088 0.43 ! 0.40 gives warnings, 0.043 gives occ 1.996
0.04301

View File

@ -0,0 +1,17 @@
4 ! Nsort
2 1 2 2 ! Multiplicities
3 ! lmax
complex ! Sr
0 0 0 0
0 0 0 0
cubic ! Ru
0 0 2 0 ! include d-shell as correlated
0 0 0 0 ! there are no irreps with SO
1 ! SO-flag
complex ! O1
0 0 0 0
0 0 0 0
complex ! O2
0 0 0 0
0 0 0 0
-0.7 1.4 ! energy window (Ry)

View File

@ -0,0 +1,96 @@
Sr2RuO4 s-o calc. M|| 0.00 0.00 1.00
B 4 39_I
RELA
7.300012 7.300012 24.044875 90.000000 90.000000 90.000000
ATOM -1: X=0.00000000 Y=0.00000000 Z=0.35240000
MULT= 2 ISPLIT=-2
-1: X=0.00000000 Y=0.00000000 Z=0.64760000
Sr2+ NPT= 781 R0=.000010000 RMT= 2.26000 Z: 38.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -2: X=0.00000000 Y=0.00000000 Z=0.00000000
MULT= 1 ISPLIT=-2
Ru4+ NPT= 781 R0=.000010000 RMT= 1.95000 Z: 44.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -3: X=0.50000000 Y=0.00000000 Z=0.00000000
MULT= 2 ISPLIT= 8
-3: X=0.00000000 Y=0.50000000 Z=0.00000000
O 2- NPT= 781 R0=.000100000 RMT= 1.68000 Z: 8.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -4: X=0.00000000 Y=0.00000000 Z=0.16350000
MULT= 2 ISPLIT=-2
-4: X=0.00000000 Y=0.00000000 Z=0.83650000
O 2- NPT= 781 R0=.000100000 RMT= 1.68000 Z: 8.00000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
16 NUMBER OF SYMMETRY OPERATIONS
0-1 0 0.00000000
1 0 0 0.00000000
0 0-1 0.00000000
1 A 2 so. oper. type orig. index
-1 0 0 0.00000000
0-1 0 0.00000000
0 0-1 0.00000000
2 A 3
1 0 0 0.00000000
0 1 0 0.00000000
0 0-1 0.00000000
3 A 6
0-1 0 0.00000000
1 0 0 0.00000000
0 0 1 0.00000000
4 A 8
0 1 0 0.00000000
-1 0 0 0.00000000
0 0-1 0.00000000
5 A 9
-1 0 0 0.00000000
0-1 0 0.00000000
0 0 1 0.00000000
6 A 11
1 0 0 0.00000000
0 1 0 0.00000000
0 0 1 0.00000000
7 A 14
0 1 0 0.00000000
-1 0 0 0.00000000
0 0 1 0.00000000
8 A 15
1 0 0 0.00000000
0-1 0 0.00000000
0 0-1 0.00000000
9 B 1
0 1 0 0.00000000
1 0 0 0.00000000
0 0-1 0.00000000
10 B 4
0-1 0 0.00000000
-1 0 0 0.00000000
0 0-1 0.00000000
11 B 5
1 0 0 0.00000000
0-1 0 0.00000000
0 0 1 0.00000000
12 B 7
-1 0 0 0.00000000
0 1 0 0.00000000
0 0-1 0.00000000
13 B 10
0 1 0 0.00000000
1 0 0 0.00000000
0 0 1 0.00000000
14 B 12
0-1 0 0.00000000
-1 0 0 0.00000000
0 0 1 0.00000000
15 B 13
-1 0 0 0.00000000
0 1 0 0.00000000
0 0 1 0.00000000
16 B 16

View File

@ -0,0 +1,15 @@
from triqs_dft_tools.converters.wien2k import Wien2kConverter
from triqs_dft_tools import SumkDFTTools
filename = 'Sr2RuO4'
conv = Wien2kConverter(filename = filename,hdf_filename=filename+'.h5')
conv.convert_dft_input()
SK = SumkDFTTools(filename+'.h5')
mesh = (-10.0,10.0,500)
SK.dos_wannier_basis(broadening=(mesh[1]-mesh[0])/float(mesh[2]),
mesh=mesh,
save_to_file=True,
with_Sigma=False,
with_dc=False)

View File

@ -37,7 +37,7 @@ class::
Note that all routines available in :class:`SumkDFT <dft.sumk_dft.SumkDFT>` are also available here.
If required, we have to load and initialise the real-frequency self energy. Most conveniently,
you have your self energy already stored as a real-frequency :class:`BlockGf <pytriqs.gf.BlockGf>` object
you have your self energy already stored as a real-frequency :class:`BlockGf <triqs.gf.BlockGf>` object
in a hdf5 file::
with HDFArchive('case.h5', 'r') as ar:
@ -45,10 +45,10 @@ in a hdf5 file::
You may also have your self energy stored in text files. For this case the :ref:`TRIQS <triqslibs:welcome>` library offers
the function :meth:`read_gf_from_txt`, which is able to load the data from text files of one Green function block
into a real-frequency :class:`ReFreqGf <pytriqs.gf.ReFreqGf>` object. Loading each block separately and
building up a :class:´BlockGf <pytriqs.gf.BlockGf>´ is done with::
into a real-frequency :class:`ReFreqGf <triqs.gf.ReFreqGf>` object. Loading each block separately and
building up a :class:´BlockGf <triqs.gf.BlockGf>´ is done with::
from pytriqs.gf.tools import *
from triqs.gf.tools import *
# get block names
n_list = [n for n,nl in SK.gf_struct_solver[0].iteritems()]
# load sigma for each block - in this example sigma is composed of 1x1 blocks
@ -128,7 +128,7 @@ Momentum resolved spectral function (with real-frequency self energy)
Another quantity of interest is the momentum-resolved spectral function, which can directly be compared to ARPES
experiments. First we have to execute `lapw1`, `lapw2 -almd` and :program:`dmftproj` with the `-band`
option and use the :meth:`convert_bands_input <dft.converters.wien2k_converter.Wien2kConverter.convert_bands_input>`
option and use the :meth:`convert_bands_input <dft.converters.wien2k.Wien2kConverter.convert_bands_input>`
routine, which converts the required files (for a more detailed description see :ref:`conversion`). The spectral function is then calculated by typing::
SK.spaghettis(broadening=0.01,plot_shift=0.0,plot_range=None,ishell=None,save_to_file='Akw_')

View File

@ -0,0 +1,131 @@
.. _blockstructure:
Manipulating the Green's functions block structure
==================================================
The DFTTools package includes the general :class:`BlockStructure <dft.block_structure.BlockStructure>` class for manipulating the blocks of Green's functions (see also the TRIQS documentation on BlockGF). In the following, we will introduce its basic and most commonly used functionalities that might show up in an actual DFT+DMFT calculation, and will illustrate them on a very basic fictitious problem.
The main idea is to have two structures for the Greens functions available. The first one is used in the procedures of the :class:`SumkDFT <dft.sumk_dft.SumkDFT>` to calculate Dysons equations, lattice Greens functions, and so on, and is normally a full matrix. For instance, in a calculation using :math:`t_{2g}` orbitals without spin-orbit-coupling, you have an spin-up block of size 3x3 and a spin-down block of the same size. In the following, wee will refer to this structure as *sumk* structure.
The second structure, called *solver* structure, is the one which is used for the solution of the Anderson impurity problem. As a matter of fact, in particular in combination with quantum Monte Carlo techniques, it is advisable to use as small blocks as possible in order to run into numerical problems. In particular, it should contain information about the symmetry of the local problem.
Creating a block structure and Green's function
-----------------------------------------------
For the purpose of this documentation, we focus on an example of a 3x3 Green's function, consisting of a 1x1 block and a 2x2 block (with off-diagonal coupling). This is reminiscent of a :math:`t_{2g}` manifold. Note that this initialisation is normally done automatically by DFTTools, we do it here manually for demonstration purposes only.
We can create a simple :class:`BlockStructure <dft.block_structure.BlockStructure>` object as follows::
from triqs_dft_tools import BlockStructure
BS = BlockStructure.full_structure([{'up':[0,1,2]}], None)
This creates a block structure with one 3x3 block named *up*. Note that we have not created any Green's function yet; this is just the structure of those objects. If you want to create a Green's function with this structure, you can do (we will if with some content also)::
from triqs.gf import *
GF_sumk = BS.create_gf(space='sumk', beta = 40, n_points = 1000)
GF_sumk['up'][0,0] << iOmega_n - 2.0
GF_sumk['up'][1,1] << iOmega_n + 0.5
GF_sumk['up'][2,2] << iOmega_n + 0.5
GF_sumk['up'][1,2] << 0.1
GF_sumk['up'][2,1] << 0.1
GF_sumk['up'] << inverse(GF_sumk['up'])
Technically, we use the *sumk* block structure for this Green's function. However, at this point, sumk and solver structure are still the same.
A plot of this structure looks like this. Note that there are off-diagonal elements which are exactly zero by construction.
.. image:: images_scripts/BS_GFsumk.png
:width: 600
:align: center
The *solver* structure
----------------------
The method:`BlockStructure.full_structure()` method, as we used it above to create our BlockStructure object, yields - as the name suggests - a full structure, where *sumk* and *solver* structure are identical. Now we want to take advantage of the symmetries of the problem to reduce the *solver* block structure to the relevant matrix elements only. In our case the [0,0] matrix element of the Green's function is completely decoupled from the 2x2 matrix of [1:2,1:2] elements. We simplify the *solver* structure by setting the mapping of each orbital to its target block and orbital::
BS.map_gf_struct_solver([{('up',0):('up_0',0), ('up',1):('up_1',0), ('up',2):('up_1',1)}])
This creates a *solver* structure different from the *sumk* structure. To see the result, let us look at the Green's function in the *solver* structure now::
GF_solver = BS.convert_gf(GF_sumk, space_from='sumk', space_to='solver')
This converts the GF_sumk into GF_solver, which looks like this.
.. image:: images_scripts/BS_GF_up_0.png
:width: 200
:align: center
.. image:: images_scripts/BS_GF_up_1.png
:width: 400
:align: center
As you can see, the Green's function in the *solver* structure now consists of two blocks: one 1x1 block (called *up_0*) and one 2x2 block (called *up_1*). This is no approximation, as the off-diagonal elements between these blocks are exactly zero anyway.
Picking orbitals
----------------
In some cases it might happen that for the projection to localised orbitals a full *d* or *f*-shell has to be used. However, for the Anderson impurity problem, just a subset of the orbitals are needed. This is the case, e.g., when the projection leads to completely empty or full orbitals that you don't want to include in the AIM.
For the example here, the local energy of the *up_0* block (2 eV) is higher than that of the *up_1* block (0.4 and 0.6 eV). Assuming that the chemical potential lies somewhere in the range of the *up_1* block, we might restrict our calculation to only this *up_1* block. The :class:`BlockStructure <dft.block_structure.BlockStructure>` class includes methods to pick a subset or orbitals::
BS.pick_gf_struct_solver([{'up_1':[0,1]}])
GF2 = BS.convert_gf(GF_sumk, space_from='sumk', space_to='solver')
Now the Green's function GF2 consists of only one 2x2 block, called *up_1*, as we have left out the *up_0* block.
Basis rotations
---------------
In cases where the Greens function or the local Hamiltonian shows off diagonal entries in the chosen basis, it is often beneficial to rotate to a different basis. This is of particular interest when using a QMC solver, since off-diagonal contributions lead to a famous fermionic sign problem. The :class:`BlockStructure <dft.block_structure.BlockStructure>` class includes methods to perform such basis rotations.
In our example, the local Hamiltonian is given by
.. math::
\varepsilon_{mm'} = \begin{pmatrix} 2.0 & 0.0 & 0.0 \\0.0 & -0.5 & -0.1\\0.0 & -0.1 & -0.5 \end{pmatrix}
It is easy to check that the following matrix diagonalises this local Hamiltonian:
.. math::
T_{mm'} = \begin{pmatrix} 1.0 & 0.0 & 0.0 \\0.0 & 1/\sqrt{2} & -1/\sqrt{2}\\0.0 & 1/\sqrt{2} & 1/\sqrt{2} \end{pmatrix}
With this unitary matrix, we can do a basis rotation to reduce the size of the off-diagonal matrix elements. Note that the transformation matrix has to be given in the *sumk* basis form (a 3x3 matrix in this case)::
import numpy as np
# Unitary transformation matrix
T = np.array([[1,0,0],[0,1./np.sqrt(2),-1./np.sqrt(2)],[0,1./np.sqrt(2),1./np.sqrt(2)]])
BS.transformation = [T]
GF3 = BS.convert_gf(GF_sumk, space_from='sumk', space_to='solver')
.. image:: images_scripts/BS_GF_up_1_rotated.png
:width: 400
:align: center
As you can see, the offdiagonal elements are reduced to 1e-16 in this basis. Please note that our example is not the most generic case. Normally, due to non-local hybridisation, the off-diagonals can be made smaller, but not exactly zero.
Diagonal approximation
----------------------
As said above, off diagonal contributions lead to some troubles. However,
when you are exactly sure that you know what you are doing, there is functionality to take only the diagonal parts into account in the block structure. Be careful, there is no automatic check whether this approximation is justified or not!
Starting from the rotated basis as done above, we can get rid of the off-diagonals as follows::
BS.approximate_as_diagonal()
GF4 = BS.convert_gf(GF_sumk, space_from='sumk', space_to='solver')
The Green's function GF4 consists now only of two 1x1 blocks, where *up_1* was the [0,0] element of the former 2x2 block, and *up_2* was the [1,1] element:
.. image:: images_scripts/BS_GF_up_1_rotated_diag.png
:width: 200
:align: center
.. image:: images_scripts/BS_GF_up_2_rotated_diag.png
:width: 200
:align: center
In summary, we started with a full 3x3 matrix in the very beginning, and ended with two 1x1 blocks containing the relevant matrix elements for the calculation.

View File

@ -1,30 +1,36 @@
.. _convW90:
Wannier90 Converter
===================
Interface with Wannier90
========================
Using this converter it is possible to convert the output of
`wannier90 <http://wannier.org>`_
Maximally Localized Wannier Functions (MLWF) and create a HDF5 archive
suitable for one-shot DMFT calculations with the
:class:`SumkDFT <dft.sumk_dft.SumkDFT>` class.
This interface allows to convert the output of `wannier90 <http://wannier.org>`_
Maximally Localized Wannier Functions (MLWF) and create a HDF5 archive suitable for DMFT calculations with the
:class:`SumkDFT <dft.sumk_dft.SumkDFT>` class. The tasks are parallelized with MPI.
The user must supply two files in order to run the Wannier90 Converter:
The converter can be run in two different modes, which are specified with the keyword ``bloch_basis`` in the call::
from triqs_dft_tools.converters import Wannier90Converter
Converter = Wannier90Converter(seedname='seedname', bloch_basis=False, rot_mat_type='hloc_diag', add_lambda=None)
Here and in the following, the keyword ``seedname`` should always be intended
as a placeholder for the actual prefix chosen by the user when creating the
input for :program:`wannier90`.
Orbital mode
---------------
In the default mode (``bloch_basis = False``), the Converter writes the Hamiltonian in orbital basis, in which case
the projector functions are trivial identity matrices. The user must supply two files:
#. The file :file:`seedname_hr.dat`, which contains the DFT Hamiltonian
in the MLWF basis calculated through :program:`wannier90` with ``hr_plot = true``
in the MLWF basis calculated through :program:`wannier90` with ``write_hr = true``
(please refer to the :program:`wannier90` documentation).
#. A file named :file:`seedname.inp`, which contains the required
information about the :math:`\mathbf{k}`-point mesh, the electron density,
the correlated shell structure, ... (see below).
Here and in the following, the keyword ``seedname`` should always be intended
as a placeholder for the actual prefix chosen by the user when creating the
input for :program:`wannier90`.
Once these two files are available, one can use the converter as follows::
from triqs_dft_tools.converters import Wannier90Converter
Converter = Wannier90Converter(seedname='seedname')
Converter.convert_dft_input()
The converter input :file:`seedname.inp` is a simple text file with
@ -84,13 +90,57 @@ In our `Pnma`-LaVO\ :sub:`3` example, for instance, we could use::
where the ``x=-1,1,0`` option indicates that the V--O bonds in the octahedra are
rotated by (approximatively) 45 degrees with respect to the axes of the `Pbnm` cell.
The last line of :file:`seedname.inp` is the DFT Fermi energy (in eV), which is subtracted from the onsite
terms in the :file:`seedname_hr.dat` file. This is recommended since some functions in DFTTools implicitly
assume a Fermi energy of 0 eV.
In the orbital mode the Converter supports the addition of a local spin-orbit term, if the Wannier Hamiltonian
describes a t\ :sub:`2g` manifold. Currently, the correct interaction term is only implemented if the default
orbital order of :program:`wannier90` is maintained, i.e. it is assumed to be
:math:`d_{xz,\uparrow}, d_{yz,\uparrow}, d_{xy,\uparrow}, d_{xz,\downarrow}, d_{yz,\downarrow}, d_{xy,\downarrow}`.
The coupling strength can be specified as ``add_lambda = [lambda_x, lambda_y, lambda_z]``,
representative of the orbital coupling terms perpendicular to :math:`[x, y, z]` i.e. :math:`[d_{yz}, d_{xz}, d_{xy}]`,
respectively. Note that it is required to have ``SO=0`` and ``SP=1``.
Band mode
----------------
If ``bloch_basis = True``, the Converter writes the Hamiltonian in the Kohn-Sham basis that was used to construct
the Wannier functions. The projector functions are then given by the transformation from Kohn-Sham to orbital basis.
Note that to do so :program:`wannier90` must be run with ``write_u_matrices = true``. Additionally to the files
described above, the Converter will require the following files:
#. :file:`seedname_u.mat` (and :file:`seedname_u_dis.mat` if disentanglement was used to construct the Wannier functions.) is read to construct the projector functions.
#. :file:`seedname.eig` is read to get the Kohn-Sham band eigenvalues
#. :file:`seedname.nnkp` is read to obtain the band indices of the orbitals selected for the Wannier Hamiltonian
#. :file:`seedname.wout` is read to get the outer energy window to ensure the correct mapping of the disentanglement
Note that in case of disentanglement the user must set the outer energy window (``dis_win_min`` and ``dis_win_max``) explicitly in :program:`wannier90` with an energy
separation of at least :math:`10^{-4}` to the band energies. This means in particular that one should not use the default energy window to avoid subtle bugs.
Additionally, to keep the dimension of the lattice Green's function reasonable, it is recommendable to use the exclude_bands tag for bands completely outside of the energy window.
The Converter currently works with Quantum Espresso and VASP. Additional files are required for each case to obtain
the Fermi weights:
#. :file:`seedname.nscf.out` for Quantum Espresso (the NSCF run must contain the flag ``verbosity = 'high'``)
#. :file:`OUTCAR` and :file:`LOCPROJ` for VASP
Note that in the band mode the user input of the :math:`k`-mesh and the Fermi energy in :file:`seedname.inp` are ignored, since both quantities
are automatically read from the :program:`wannier90` and DFT output. However, the :math:`k`-mesh parameter still has to be specified to comply with the file format.
Rotation matrix
------------------
The converter will analyse the matrix elements of the local Hamiltonian
to find the symmetry matrices `rot_mat` needed for the global-to-local
transformation of the basis set for correlated orbitals
(see section :ref:`hdfstructure`).
The matrices are obtained by finding the unitary transformations that diagonalize
If ``rot_mat_type='hloc_diag'``, the matrices are obtained by finding the unitary transformations that diagonalize
:math:`\langle w_i | H_I(\mathbf{R}=0,0,0) | w_j \rangle`, where :math:`I` runs
over the correlated shells and `i,j` belong to the same shell (more details elsewhere...).
If ``rot_mat_type='wannier'``, the matrix for the first correlated shell per impurity will be identity, defining the reference frame,
while the rotation matrices of all other equivalent shells contain the correct mapping into this reference frame.
If two correlated shells are defined as equivalent in :file:`seedname.inp`,
then the corresponding eigenvalues have to match within a threshold of 10\ :sup:`-5`,
otherwise the converter will produce an error/warning.
@ -98,20 +148,17 @@ If this happens, please carefully check your data in :file:`seedname_hr.dat`.
This method might fail in non-trivial cases (i.e., more than one correlated
shell is present) when there are some degenerate eigenvalues:
so far tests have not shown any issue, but one must be careful in those cases
(the converter will print a warning message).
(the converter will print a warning message and turns off the use of rotation matrices,
which leads to an incorrect mapping between equivalent correlated shells).
Current limitations
----------------------------------------------
The current implementation of the Wannier90 Converter has some limitations:
* Since :program:`wannier90` does not make use of symmetries (symmetry-reduction
of the :math:`\mathbf{k}`-point grid is not possible), the converter always
sets ``symm_op=0`` (see the :ref:`hdfstructure` section).
* No charge self-consistency possible at the moment.
* Calculations with spin-orbit (``SO=1``) are not supported.
* The spin-polarized case (``SP=1``) is not yet tested.
* The post-processing routines in the module
:class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`
were not tested with this converter.
* ``proj_mat_all`` are not used, so there are no projectors onto the
uncorrelated orbitals for now.

203
doc/guide/conv_elk.rst Normal file
View File

@ -0,0 +1,203 @@
.. _convElk:
Interface with Elk
=====================
This is the first iteration of the Elk-TRIQS interface, so certain inputs may change in later updates. The Elk part of the interface is not currently in the main distribution, but it can be found `here <https://github.com/AlynJ/Elk_interface-TRIQS>`_.
We assume that the user has obtained a self-consistent solution of the
Kohn-Sham equations with Elk (a full tutorial can be found here :ref:`Elk SVO tutorial <SrVO3_elk>`). Also, the user needs to be familiar with the main in/output files of Elk, and how to run
the DFT code. Further information about Elk can be found on the `official Elk website <http://elk.sourceforge.net/>`_.
Conversion for the DMFT self-consistency cycle
----------------------------------------------
Once the user has obtained the groundstate calculation, they will have to rerun Elk but with some small changes to the inputs in the elk.in file which will be explained below. The Elk part of the interface calculates and outputs the Wannier projectors. All downfolding related flags are set in the elk input file, and Elk determines automatically by symmetry equivalent sites. The TRIQS Elk converter then reads in these projectors along with the other Elk ascii files which would have been generated in the Elk ground state calculation. This information is then packed into the HDF5 file.
In the following, we use SrVO3 as an example to explain the flags required in the elk.in input file. An example elk.in of SrVO3 is available in the :ref:`SrVO3 tutorial <SrVO3_elk>`:
.. literalinclude:: ../tutorials/svo_elk/elk.in
The projectors are generated in Elk using these alterations in the elk.in file::
task
805
wanproj
1 !1) number of projector species
2 2 3 !2) species number, l value and lm submatrix size
7 8 9 !3) cubic harmonic lm indices
-0.055 0.07 !4) Correlated energy window in Hartrees (this is [-1.5, 1.9] in eV)
The first flag "task" specifies Elk to do the Wannier projector calculation in the Elk input convention. The "wanproj" flag specifies the information needed to generate the desired projectors (the exclamation marks are comment flags in Fortran). Below gives the meaning of each line:
#. The number of different species to generate the projectors for. If the material has multiple atoms of the same species, then the projectors will be generated for all of these atoms. Information about whether these atoms are symmetrically equivalent is written to the PROJ.OUT file. Generating projectors for multiple species requires lines 2) and 3) to be repeated for each projector species.
#. The desired species index (relative to the order of the "atoms" input in elk.in), the l value and the number of wanted lm orbitals for the projectors.
#. The lm indices (in the cubic harmonics by default) where lm = 1 refers to the s orbital, lm = 2,3,4 refers to the p orbitals, lm = 5,6,7,8,9 refers to the d orbitals and finally lm = 10,11,12,13,14,15,16 refers to the f orbitals. In the example above, this specifies that we want the t2g orbitals which has size 3 [last number in line 2)] and the lm indices are 7, 8 and 9 as specified in line 3). If, on the other hand, the user wishes to use all of the d-orbitals then all 5 orbital indices need to be included along with specifying that all 5 orbitals will be used [at the end of line 2)].
#. The correlated energy window (in Hartree) to generate the projectors within.
It should be noted that the indices in line 3) will change if another lm basis is used.
The default is the cubic harmonic basis. The flags in elk.in required to change the spherical harmonic basis are::
cubic
.true.
lmirep
.true.
Above are the default inputs. If both of these flags are set to .false., the projectors will be generated in the complex spherical harmonic basis. It is possible to generate the projectors in Elk's irreducible basis by setting cubic to .false., but this is experimental and the TRIQS side of the interface is
currently unable to convert the projectors in that basis. Finally, these projectors are written to file in the complex spherical harmonic basis.
Also, the input flag called "wanind", when set to .true. in elk.in, enables the user to input the lower and upper band indices (respectively) in line 4) of "wanproj" instead of the correlated energy window energies. An example of the inputs in the elk.in file::
wanind
.true.
wanproj
1 !No. of projector species
2 2 3 !species, l, lm submatrix size
7 8 9 !lm indices
21 25 !correlated energy window band indices.
Note that for magnetic systems (spin uncoupled calculations), only the indices of the majority spin bands are used as inputs. The code calculates the indices for the minority spin automatically.
.. _Elk_files:
The rest of the elk.in file can remain unchanged. This 805 task calculates the projectors which are written into the WANPROJ_L**_S**_A****.OUT file(s). Note that the projectors will be written in the complex spherical harmonic basis. Along with this, the other written file (PROJ.OUT) specficies some information about the projectors (like atom equivalency, lm indices and so on) needed for reading the files into the TRIQS library. The PROJ.OUT file contains comments about its outputs. Here's a list of all of the input files needed for this part of the TRIQS converter:
#. WANPROJ_L**_S**_A****.OUT - file containing the projectors and band window indices.
#. PROJ.OUT - specficies some information about the projectors.
(like atom equivalency, lm indices and so on) needed for reading into the TRIQS library.
#. EIGVAL.OUT - contains the energies and latice vector coordinates for each k-point.
#. EFERMI.OUT - contains the Fermi energy.
#. KPOINTS.OUT - contains the k-point weights and lattice vectors.
#. SYMCRYS.OUT - has the crystal symmetries used for symmetries observables.
#. LATTICE.OUT - has lattice-Cartesian basis transformation matrices.
#. GEOMETRY.OUT - file with the lattice positions of every atom of each species.
Moreover, the Wannier charge density matrix (in WANCHARGE.OUT) and the Wannier spectral function (in WANSF_L**_S**_A****_0*.OUT) are calculated. These files are not used in the interface.
As a side note, there are two other tasks which also generate the Wannier projectors. Task 804 generates the same outputs as 805 except it doesn't calculate the Wannier charge and spectral function. Task 806 outputs the same information as 805, but it generates the projectors (and other k-dependent variables) on a different user defined ngridk mesh. These tasks are parallelized with both OpenMP and MPI.
The Elk outputs are read into the TRIQS library using the following lines::
from triqs_dft_tools.converters.elk import *
Converter = ElkConverter(filename=filename, repacking=True)
Converter.convert_dft_input()
The first two lines import and load the Elk converter module and the last line executes the conversion into the filename.h5 HDF5 file.
Data for post-processing - Correlated Spectral functions
--------------------------------------------------------
In case you want to do post-processing of your data using the module :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`, some more files have to be converted to the HDF5 archive. Some of this has been laid out in :ref:`analysis`, but the Elk specific functions are described in the following sections. Below, we will discuss how to input the information for correlated spectral functions (band structures) and which is then calculated using "spaghettis" in :ref:`analysis`. However, band character band structure plots have not yet been implemented.
In Elk, the elk.in requires the altered flag::
task
820
As well as the wanproj flag (which has be discussed previously) and the plot1d flag (refer to the Elk manual). The new output files of this task required for the interface are:
#. BAND.OUT - the energy eigenvalues along the user specified path.
#. PROJ_WANBAND.OUT - same as PROJ.OUT but for band structure projectors
#. WANPROJ_L**_S**_A****_WANBAND.OUT - same as WANPROJ_L**_S**_A****.OUT
but for band structure projectors.
(The ascii output files which have the new extension of _WANBAND.OUT are specific for this post processing calculation.)
The band structure information is converted into TRIQS by using::
Converter.convert_bands_input()
Spectral function from Elk inputs
---------------------------------
Elk does not calculate the theta projectors for partial DOS calculations. Instead, Elk outputs the band characters into the file BC.OUT when using the elk.in task::
task
803
The contents of BC.OUT need to be converted into the HDF5 file by using the Elk Converter module::
from triqs_dft_tools.converters.elk import *
Converter = ElkConverter(filename=filename, repacking=True)
Converter.dft_band_characters()
Once these have been saved to the HDF5 file (called "filename" here), the spectral function can be calculated with::
SK.elk_dos(broadening=0.0, with_Sigma=True, with_dc=True, pdos=False, nk=None)
This outputs the total spectral function and the partial spectral function if enabled. Most of the user inputs are similar to the "SK.dos_parproj_basis()" module in :ref:`analysis`. The "pdos" flag when "True" enables the partial dos of each lm value to be calculated. It should be noted that these band characters are in Elk's irreducible lm basis and as such, the user has to check the irreducible representation used in Elk. This information can be found in the file ELMIREP.OUT after running task 10 (the DOS calculating task). The "nk" flag enables the calculation of the occupied spectral funciton. Here, nk needs to be the occupation density matrix (calculated from integrating the Green's function on the Matsubara axis) in the Bloch basis. This input needs to be in the same format as the occupation density matrix "deltaN" calculated in the sumk_DFT.calc_density_correction(dm_type='elk') module.
Spectral function Contour Plots (Fermi Surfaces) from Elk inputs
-----------------------------------------------------------------
Here, we will discuss how to plot the Fermi surface contour or any other non-zero omega spectral function contour plot. This is currently tailored for the Elk inputs. From this point, we will refer to these contours as Fermi surfaces. The energy eigenvalues, projectors and so on required for the Fermi surface plot needs to be outputed from Elk. This is done by using::
task
807
in Elk, but unlike the previous Elk interface tasks, the k-mesh grid needs to be specified. This is done like using the same inputs as the Fermi surface calculations in Elk. In Elk, The user needs to specify the "plot3d" input flag used to generate the k-mesh which the interface variables are evaluated on. A simple example is for SrVO3 where plot3d would look something like::
plot3d
0.0 0.0 0.0 !1) origin
1.0 0.0 0.0 !2) vertex 1
0.0 1.0 0.0 !3) vertex 2
0.0 0.0 1.0 !4) vertex 3
32 32 32 !5) k-mesh grid size
Lines 1) to 4) specifies the corners (in lattice coordinates) of the k-grid box and line 5) is the grid size in each direction (see the Elk manual). If the user desires to plot a 2D plane, then the user should define the plane using lines 2) and 3) [relative to line 1)] and define line 4) to be the cross-product of lines 2) and 3) [i.e. the vector in line 4) is normal to the 2D plane]. The outputs will be in terms of the k-dependent quantities in the irreducible Brillouin zone (IBZ). The files needed for the interface are:
#. EIGVAL_FS.OUT - same as EIGVAL.OUT but the output is of the Fermi surface calculation.
#. KPOINT_FS.OUT - same as KPOINT.OUT but the output is of the Fermi surface calculation.
#. PROJ_FS.OUT - same as PROJ.OUT but the output is of the Fermi surface calculation.
#. WANPROJ_L**_S**_A****_FS.OUT - same as WANPROJ_L**_S**_A****.OUT but the output is of the Fermi surface calculation.
#. EFERMI.OUT - contains the Fermi energy.
#. SYMCRYS.OUT - has the crystal symmetries used for symmetries observables.
#. LATTICE.OUT - has lattice-Cartesian basis transformation matrices.
(The ascii output files which have the extension of _FS.OUT are specific for this post processing calculation.)
These outputs are converted to the HDF5 file by::
from triqs_dft_tools.converters.elk import *
Converter = ElkConverter(filename=filename, repacking=True)
Converter.convert_fs_input()
The spectral function for the Fermi surface plots are calculated with::
SK.fs_plot(broadening=0.0, mesh=None, FS=True, plane=True, sym=True, orthvec=None, with_Sigma=True, with_dc=True)
The new flags specify the following:
#. "FS" - determines whether the output will be the Fermi surface and uses the closest omega value to 0.0 in the mesh.
#. "plane" - required to specify whether the Elk input parameters were generated on a k-mesh plane.
#. "sym" - needed if the IBZ will be folded out by using symmetry operations.
#. "orthvec" - (numpy array of length 3) needs to be specified if using "plane" as this input is the orthonormal vector to the 2D plane required for the folding out process.
To give the user a range of output capabilities, This routine can be used in the following ways:
#. If using "with_Sigma", the mesh will be the same as the self-energy. However, by setting FS=False, the user can input a mesh option if they desire the "Fermi surface" plots for each omega value (commensurate with the self-energy mesh) within the input range.
#. If the user is generating the DFT Spectral function plot (i.e. with_Sigma and with_dc both set to False), a mesh needs to be specified if FS=False. This function will output the spectral functions for the input mesh. Otherwise if FS is True, this would return the spectral function at omega=0.0.
The output files will have the form of "Akw_FS_X.dat" (X being either up, down or ud) if FS=True or "Akw_X_omega_Y.dat" (Y being the omega mesh index) otherwise. The latter file will have the omega values within the file (the fourth column). The first three columns of both output file types specifies the cartesian lattice vector (kx, ky, kz) and the last column is the spectral function values.
DFT+DMFT wavefunction dependent quantities
------------------------------------------
The DFT+DMFT wavefunctions and occupations are generated in Elk by diagonalizing the full DFT+DMFT density matrix at each k-point during task 808. These are used to update the electron density which is then used to solve the Kohn-Sham equations once to complete a FCSC DFT+DMFT cycle. It is possible to calculate quantities which are solely dependent on the wavefunctions and occupations by using the aforementioned diagonalized set. After generating the DMATDMFT.OUT file, these diagonalized wavefunctions and occupations are calculated by amending elk.in with the new task::
task
809
This will write the new second variational eigenvectors and occupations in the EVECSV.OUT and OCCSV.OUT binary files respectively. Then the wavefunction dependent quantities implemented within Elk can be calculated using these DFT+DMFT wavefunctions and occupations. Note that this only works for energy independent quantities. Also, the user has to ensure that the second variational eigenvectors will be used in determining the wavefunction dependent quantities. This is done by looking for the variable "tevecsv" in init0.f90 of Elk's source code and making sure that this is set to .true. for the task number the user wishes to use.

View File

@ -87,7 +87,7 @@ matrix of the imaginary part, and then move on to the next :math:`\mathbf{k}`-po
The converter itself is used as::
from triqs_dft_tools.converters.hk_converter import *
from triqs_dft_tools.converters.hk import *
Converter = HkConverter(filename = hkinputfile)
Converter.convert_dft_input()
@ -95,6 +95,6 @@ where :file:`hkinputfile` is the name of the input file described
above. This produces the hdf file that you need for a DMFT calculation.
For more options of this converter, have a look at the
:ref:`refconverters` section of the reference manual.
:py:mod:`Converters <triqs_dft_tools.converters>` section of the reference manual.

View File

@ -1,50 +1,67 @@
.. _convVASP:
===================
Interface with VASP
===================
.. warning::
The VASP interface is in the alpha-version and the VASP part of it is not
yet publicly released. The documentation may, thus, be subject to changes
before the final release.
The VASP interface relies on new options introduced since version 5.4.x In
particular, a new INCAR-option `LOCPROJ
<https://cms.mpi.univie.ac.at/wiki/index.php/LOCPROJ>`_, the new `LORBIT` modes
13 and 14 have been added, and the new `ICHARG` mode 5 for charge
self-consistent DFT+DMFT calculations have been added.
*Limitations of the alpha-version:*
The VASP interface methodologically builds on the so called projection on
localized orbitals (PLO) scheme, where the resulting KS states from DFT are
projected on localized orbitals, which defines a basis for setting up a
Hubbard-like model Hamiltonian. Resulting in lattice object stored in `SumkDFT`.
The implementation is presented in `M. Schüler et al. 2018 J. Phys.: Condens.
Matter 30 475901 <https://doi.org/10.1088/1361-648X/aae80a>`_.
* The interface works correctly only if the k-point symmetries
are turned off during the VASP run (ISYM=-1).
The interface consists of two parts, :py:mod:`PLOVASP<triqs_dft_tools.converters.plovasp>`, a collection of
python classes and functions converting the raw VASP output to proper projector
functions, and the python based :py:mod:`VaspConverter<triqs_dft_tools.converters.vasp>`, which
creates a h5 archive from the :py:mod:`PLOVASP<triqs_dft_tools.converters.plovasp>` output readable by
`SumkDFT`. Therefore, the conversion consist always of two steps.
* Generation of projectors for k-point lines (option `Lines` in KPOINTS)
needed for Bloch spectral function calculations is not possible at the moment.
Here, we will present a guide how the interface `can` be used to create input for a DMFT calculation, using SrVO3 as an example. Full examples can be found in the :ref:`tutorial section of DFTTools<tutorials>`.
* The interface currently supports only collinear-magnetism calculation
(this implis no spin-orbit coupling) and
spin-polarized projectors have not been tested.
Limitations of the interface
============================
A detailed description of the VASP converter tool PLOVasp can be found
in the :ref:`PLOVasp User's Guide <plovasp>`. Here, a quick-start guide is presented.
* The interface works correctly only if the k-point symmetries
are turned off during the VASP run (ISYM=-1).
* Generation of projectors for k-point lines (option `Lines` in KPOINTS)
needed for Bloch spectral function calculations is not possible at the moment.
* The interface currently supports only collinear-magnetism calculation
(this implies no spin-orbit coupling) and spin-polarized projectors have not
been tested.
* The converter needs the correct Fermi energy from VASP, which is read from
the LOCPROJ file. However, VASP by default does not output this information.
Please see `Remarks on the VASP version`_.
The VASP interface relies on new options introduced since version
5.4.x. In particular, a new INCAR-option `LOCPROJ`
and new `LORBIT` modes 13 and 14 have been added.
VASP: generating raw projectors
===============================
Option `LOCPROJ` selects a set of localized projectors that will
be written to file `LOCPROJ` after a successful VASP run.
A projector set is specified by site indices,
labels of the target local states, and projector type:
The VASP **INCAR** option `LOCPROJ` selects a set of localized projectors that
will be written to the file **LOCPROJ** after a successful VASP run. A projector set is specified by site indices, labels of the target local states, and projector type:
| `LOCPROJ = <sites> : <shells> : <projector type>`
where `<sites>` represents a list of site indices separated by spaces,
with the indices corresponding to the site position in the POSCAR file;
`<shells>` specifies local states (see below);
`<projector type>` chooses a particular type of the local basis function.
The recommended projector type is `Pr 2`. The formalism for this type
of projectors is presented in
`M. Schüler et al. 2018 J. Phys.: Condens. Matter 30 475901 <https://doi.org/10.1088/1361-648X/aae80a>`_.
where `<sites>` represents a list of site indices separated by spaces, with the
indices corresponding to the site position in the **POSCAR** file; `<shells>`
specifies local states (see below); `<projector type>` chooses a particular type
of the local basis function. The recommended projector type is `Pr 2`. This will
perform a projection of the Kohn-Sham states onto the VASP PAW projector
functions. The number specified behind `Pr` is selecting a specific PAW channel,
see the `VASP wiki page <https://cms.mpi.univie.ac.at/wiki/index.php/LOCPROJ>`_
for more information. The formalism for this type of projectors is presented in
`M. Schüler et al. 2018 J. Phys.: Condens. Matter 30 475901
<https://doi.org/10.1088/1361-648X/aae80a>`_. For further details on the
`LOCPROJ` flag also have a look in the `VASP wiki
<https://cms.mpi.univie.ac.at/wiki/index.php/LOCPROJ>`_.
The allowed labels of the local states defined in terms of cubic
harmonics are:
harmonics are (mind the order):
* Entire shells: `s`, `p`, `d`, `f`
@ -55,16 +72,25 @@ harmonics are:
* `f`-states: `fy(3x2-y2)`, `fxyz`, `fyz2`, `fz3`,
`fxz2`, `fz(x2-y2)`, `fx(x2-3y2)`.
For projector type `Pr 2`, one should also set `LORBIT = 14` in the INCAR file
and provide parameters `EMIN`, `EMAX`, defining, in this case, an
energy range (energy window) corresponding to the valence states.
Note that, as in the case
of a DOS calculation, the position of the valence states depends on the
Fermi level, which can usually be found at the end of the OUTCAR file.
For projector type `Pr`, one should ideally also set `LORBIT = 14` in the
INCAR file and provide parameters `EMIN`, `EMAX`, defining, in this case, an
energy range (energy window) corresponding to the valence states. Note that,
as in the case of a DOS calculation, the position of the valence states
depends on the Fermi level, which can usually be found at the end of the
OUTCAR file. Setting `LORBIT=14` will perform an automatic optimization of
the PAW projector channel as described in `M. Schüler et al. 2018 J. Phys.:
Condens. Matter 30 475901 <https://doi.org/10.1088/1361-648X/aae80a>`_, by
using a linear combination of the PAW channels, to maximize the overlap in
the chosen energy window between the projector and the Kohn-Sham state.
Therefore, setting `LORBIT=14` will let VASP ignore the channel specified
after `Pr`. This optimization is only performed for the projector type `Pr`,
not for `Ps` and obviously not for `Hy`. We recommend to specify the PAW
channel anyway, in case one forgets to set `LORBIT=14`.
For example, in case of SrVO3 one may first want to perform a self-consistent
calculation, then set `ICHARGE = 1` and add the following additional
lines into INCAR (provided that V is the second ion in POSCAR):
In case of SrVO3 one may first want to perform a self-consistent
calculation to know the Fermi level and the rough position of the target states.
In the next step one sets `ICHARG = 1` and adds the following additional lines
into INCAR (provided that V is the second ion in POSCAR):
| `EMIN = 3.0`
| `EMAX = 8.0`
@ -72,73 +98,347 @@ lines into INCAR (provided that V is the second ion in POSCAR):
| `LOCPROJ = 2 : d : Pr 2`
The energy range does not have to be precise. Important is that it has a large
overlap with valence bands and no overlap with semi-core or high unoccupied states.
overlap with valence bands and no overlap with semi-core or high unoccupied
states. This **INCAR** will calculate and write-out projections for all five d-orbitals.
VASP input-output
-----------------
The calculated projections :math:`\langle \chi_L | \Psi_\mu \rangle` are written
into files **PROJCAR** and **LOCPROJ**. The difference between these two files
is that **LOCPROJ** contains raw matrices without any reference to
sites/orbitals, while **PROJCAR** is more detailed. In particular, the
information that can be obtained for each projector from **PROJCAR** is the
following:
* site (and species) index
* for each `k`-point and band: a set of complex numbers for labeled orbitals
At the same time, **LOCPROJ** contains the total number of projectors (as well
as the number of `k`-points, bands, and spin channels) in the first line, which
can be used to allocate the arrays before parsing.
Conversion for the DMFT self-consistency cycle
----------------------------------------------
==============================================
The projectors generated by VASP require certain post-processing before
they can be used for DMFT calculations. The most important step is to normalize
The projectors generated by VASP require certain post-processing before they can
be used for DMFT calculations. The most important step is to (ortho-)normalize
them within an energy window that selects band states relevant for the impurity
problem. Note that this energy window is different from the one described above
and it must be chosen independently of the energy
range given by `EMIN, EMAX` in INCAR.
problem. This will create proper Wannier functions of the initial projections
produced by VASP. Note that this energy window is different from the one
described above and it must be chosen independently of the energy range given by
`EMIN, EMAX` in the **INCAR** VASP input file. This part is done in `PLOVASP`.
Post-processing of `LOCPROJ` data is generally done as follows:
#. Prepare an input file `<name>.cfg` (e.g., `plo.cfg`) that describes the definition
of your impurity problem (more details below).
PLOVASP: converting VASP output
--------------------------------
#. Extract the value of the Fermi level from OUTCAR and paste it at the end of
the first line of LOCPROJ.
:py:mod:`PLOVASP<triqs_dft_tools.converters.plovasp>` is a collection of python functions and classes, post-processing the raw VASP `LOCPROJ` output creating proper projector functions.
#. Run :program:`plovasp` with the input file as an argument, e.g.:
The following VASP files are used by PLOVASP:
* PROJCAR, LOCPROJ: raw projectors generated by VASP-PLO interface
* EIGENVAL: Kohn-Sham eigenvalues as well as `k`-points with weights and Fermi weights
* IBZKPT: `k`-point data (:math:`\Gamma`)
* POSCAR: crystal structure data
| `plovasp plo.cfg`
To run `PLOVASP`, one first prepares an input file `<name>.cfg` (default name `plo.cfg`) that describes the definition of the correlated subspace. For SrVO3 this input file would look like this:
This requires that the TRIQS paths are set correctly (see Installation
of TRIQS).
.. literalinclude:: ../tutorials/svo_vasp/plo.cfg
If everything goes right one gets files `<name>.ctrl` and `<name>.pg1`.
These files are needed for the converter that will be invoked in your
DMFT script.
In the [section] general, the `DOSMESH` defines an energy window and number of
data points, which lets the converter calculate the density of states of the
created projector functions in a given energy window. Each projector shell is
defined by a section `[Shell 1]` where the number can be arbitrary and used only
for user convenience. Several parameters are required
The format of input file `<name>.cfg` is described in details in
the :ref:`User's Guide <plovasp>`. Here we just consider a simple example for the case
of SrVO3:
.. literalinclude:: images_scripts/srvo3.cfg
A projector shell is defined by a section `[Shell 1]` where the number
can be arbitrary and used only for user convenience. Several
parameters are required
- **IONS**: list of site indices which must be a subset of indices
given earlier in `LOCPROJ`.
- **IONS**: list of site indices which must be a subset of indices given earlier
in the VASP INCAR `LOCPROJ` flag. Note: If projections are performed for
multiple sites one can specify symmetry equivalent sites with brackets: `[2
3]`. Here the projector are generated for ions 2 and 3, but they will be
marked as symmetry equivalent later in 'SumkDFT'.
- **LSHELL**: :math:`l`-quantum number of the projector shell; the corresponding
orbitals must be present in `LOCPROJ`.
- **EWINDOW**: energy window in which the projectors are normalized;
note that the energies are defined with respect to the Fermi level.
Option **TRANSFORM** is optional but here, it is specified to extract
only three :math:`t_{2g}` orbitals out of five `d` orbitals given by
:math:`l = 2`.
The Option **TRANSFORM** is optional here, and it is specified to extract
only the three :math:`t_{2g}` orbitals out of the five `d` orbitals given by
:math:`l = 2`. A detailed explanation of all input parameters can be found
further below `PLOVASP detailed guide`_.
The conversion to a h5-file is performed in the same way as for Wien2TRIQS::
Next, the converter is executed. This can be done by calling :program:`PLOVASP` directly in the command line with the input file as an argument, e.g.:
| `plovasp plo.cfg`
from triqs_dft_tools.converters.vasp_converter import *
Converter = VaspConverter(filename = filename)
or embedded in a python script as::
import triqs_dft_tools.converters.plovasp.converter as plo_converter
# Generate and store PLOs
plo_converter.generate_and_output_as_text('plo.cfg', vasp_dir='./')
This will create the xml files `vasp.ctrl` and `vasp.pg1` containing the orthonormalized projector functions readable by the :py:mod:`VaspConverter<triqs_dft_tools.converters.vasp>`. Moreover, :py:mod:`PLOVASP<triqs_dft_tools.converters.plovasp>` will output important information of the orthonormalization process, such as the density matrix of the correlated shell and the local Hamiltonian.
Running the VASP converter
-------------------------------------
The actual conversion to a h5-file is performed with the orthonormalized projector functions readable by the :py:mod:`VaspConverter<triqs_dft_tools.converters.vasp>` in the same fashion as with the other `DFTTools` converters::
from triqs_dft_tools.converters.vasp import *
Converter = VaspConverter(filename = 'vasp')
Converter.convert_dft_input()
As usual, the resulting h5-file can then be used with the SumkDFT class.
As usual, the resulting h5-file can then be used with the SumkDFT class::
sk = SumkDFTTools(hdf_file='vasp.h5')
Note that the automatic detection of the correct block structure might
fail for VASP inputs.
This can be circumvented by setting a bigger value of the threshold in
:class:`SumkDFT <dft.sumk_dft.SumkDFT>`, e.g.::
Note that the automatic detection of the correct block structure might fail for
VASP inputs. This can be circumvented by setting a bigger value of the threshold
in :class:`SumkDFT <dft.sumk_dft.SumkDFT>`, e.g.::
SK.analyse_block_structure(threshold = 1e-4)
However, do this only after a careful study of the density matrix and
the projected DOS in the localized basis.
However, this should only be done after a careful study of the density matrix and the projected DOS in the localized basis. For the complete process for SrVO3 see the tutorial for the VASP interface `here <../tutorials/svo_vasp/svo_notebook.html>`_.
PLOVASP detailed guide
======================
The general purpose of the PLOVASP tool is to transform raw, non-normalized
projectors generated by VASP into normalized projectors corresponding to
user-defined projected localized orbitals (PLO). To enhance the performance
parsing the raw VASP output files, the parser is implemented in plain C. The
idea is that the python part of the parser first reads the first line of
**LOCPROJ** and then calls the C-routine with necessary parameters to parse
**PROJCAR**. The resulting PLOs can then be used for DFT+DMFT calculations with
or without charge self-consistency. PLOVASP also provides some utilities for
basic analysis of the generated projectors, such as outputting density matrices,
local Hamiltonians, and projected density of states.
PLOs are determined by the energy window in which the raw projectors are
normalized. This allows to define either atomic-like strongly localized Wannier
functions (large energy window) or extended Wannier functions focusing on
selected low-energy states (small energy window).
In PLOVASP, all projectors sharing the same energy window are combined into a
`projector group`. This allows one in principal to define several groups with
different energy windows for the same set of raw projectors. Note: multiple groups are not yet implemented.
A set of projectors defined on sites related to each other either by symmetry
or by an atomic sort, along with a set of :math:`l`, :math:`m` quantum numbers,
forms a `projector shell`. There could be several projectors shells in a
projector group, implying that they will be normalized within the same energy
window.
Projector shells and groups are specified by a user-defined input file whose
format is described below. Additionally, each shell can be marked correlated or non-correlated, to tell `SumkDFT` whether or not these should be treated in the DMFT impurity problem.
Input file format
-----------------
The input file is written in the standard config-file format.
Parameters (or 'options') are grouped into sections specified as
`[Section name]`. All parameters must be defined inside some section.
A PLOVASP input file can contain three types of sections:
#. **[General]**: includes parameters that are independent
of a particular projector set, such as the Fermi level, additional
output (e.g. the density of states), etc.
#. **[Group <Ng>]**: describes projector groups, i.e. a set of
projectors sharing the same energy window and normalization type.
At the moment, DFTtools support only one projector group, therefore
there should be no more than one projector group.
#. **[Shell <Ns>]**: contains parameters of a projector shell labelled
with `<Ns>`. If there is only one group section and one shell section,
the group section can be omitted but in this case, the group required
parameters must be provided inside the shell section.
Section [General]
"""""""""""""""""
The entire section is optional and it contains four parameters:
* **BASENAME** (string): provides a base name for output files.
Default filenames are :file:`vasp.*`.
* **DOSMESH** ([float float] integer): if this parameter is given,
the projected density of states for each projected orbital will be
evaluated and stored to files :file:`pdos_<s>_<n>.dat`, where `s` is the
shell index and `n` the ion index. The energy mesh is defined by three
numbers: `EMIN` `EMAX` `NPOINTS`. The first two
can be omitted in which case they are taken to be equal to the projector
energy window. **Important note**: at the moment this option works
only if the tetrahedron integration method (`ISMEAR = -4` or `-5`)
is used in VASP to produce `LOCPROJ`.
* **EFERMI** (float): provides the Fermi level. This value overrides
the one extracted from VASP output files.
* **HK** (True/False): If True, the projectors are applied the the Kohn-Sham
eigenvalues which results in a Hamitlonian H(k) in orbital basis. The H(k)
is written for each group to a file :file:`Basename.hk<Ng>`. It is recommended
to also set `COMPLEMENT = True` (see below). Default is False.
There are no required parameters in this section.
Section [Shell]
"""""""""""""""
This section specifies a projector shell. Each `[Shell]` section must be
labeled by an index, e.g. `[Shell 1]`. These indices can then be referenced
in a `[Group]` section.
In each `[Shell]` section two parameters are required:
* **IONS** (list of integer): indices of sites included in the shell.
The sites can be given either by a list of integers `IONS = 5 6 7 8`
or by a range `IONS = 5..8`. The site indices must be compatible with
the POSCAR file. Morever, sites can be marked to be identical by
grouping them with brackets, i.e. `IONS = [5 6] [7 8]` will mark the
sites 5 and 6 in the POSCAR (and of course also 7 and 8) to be idential.
This will mark these correlated site as equivalent, and only one
impurity problem per bracket group is generated.
* **LSHELL** (integer): :math:`l` quantum number of the desired local states.
It is important that a given combination of site indices and local states
given by `LSHELL` must be present in the LOCPROJ file.
There are additional optional parameters that allow one to transform
the local states:
* **CORR** (True/False): Determines if shell is correlated or not. At least one
shell has to be correlated. Default is True.
* **SORT** (integer): Overrides the default detection of ion sorts by supplying
an integer. Default is `None`, for which the default behavior is retained.
* **TRANSFORM** (matrix): local transformation matrix applied to all states
in the projector shell. The matrix is defined by a (multiline) block
of floats, with each line corresponding to a row. The number of columns
must be equal to :math:`2 l + 1`, with :math:`l` given by `LSHELL`. Only real matrices
are allowed. This parameter can be useful to select certain subset of
orbitals or perform a simple global rotation.
* **TRANSFILE** (string): name of the file containing transformation
matrices for each site. This option allows for a full-fledged functionality
when it comes to local state transformations. The format of this file
is described :ref:`below <transformation_file>`.
Section [Group]
"""""""""""""""
Each defined projector shell must be part of a projector group. In the current
implementation of DFTtools only a single group (labelled by any integer, e.g. `[Group 1]`)
is supported. This implies that all projector shells
must be included in this group.
Required parameters for any group are the following:
* **SHELLS** (list of integers): indices of projector shells included in the group.
All defined shells must be grouped.
* **EWINDOW** (float float): the energy window specified by two floats: bottom
and top. All projectors in the current group are going to be normalized within
this window. *Note*: This option must be specified inside the `[Shell]` section
if only one shell is defined and the `[Group]` section is omitted.
Optional group parameters:
* **NORMALIZE** (True/False): specifies whether projectors in the group are
to be normalized. The default value is **True**.
* **NORMION** (True/False): specifies whether projectors are normalized on
a per-site (per-ion) basis. That is, if `NORMION = True`, the orthogonality
condition will be enforced on each site separately but the Wannier functions
on different sites will not be orthogonal. If `NORMION = False`, the Wannier functions
on different sites included in the group will be orthogonal to each other. The default value is **True**
* **BANDS** (int int): the energy window specified by two ints: band index of
lowest band and band index of highest band. Using this overrides the selection
in `EWINDOW`.
* **COMPLEMENT** (True/False). If True, the orthogonal complement is calculated
resulting in unitary (quadratic) projectors, i.e., the same number of orbitals
as bands. It is required to have an equal number of bands in the energy window
at each k-point. Default is False.
.. _transformation_file:
File of transformation matrices
"""""""""""""""""""""""""""""""
.. warning::
The description below applies only to collinear cases (i.e., without spin-orbit
coupling). In this case, the matrices are spin-independent.
The file specified by option `TRANSFILE` contains transformation matrices
for each ion. Each line must contain a series of floats whose number is either equal to
the number of orbitals :math:`N_{orb}` (in this case the transformation matrices
are assumed to be real) or to :math:`2 N_{orb}` (for the complex transformation matrices).
The total number of lines :math:`N` must be a multiple of the number of ions :math:`N_{ion}`
and the ratio :math:`N / N_{ion}`, then, gives the dimension of the transformed
orbital space. The lines with floats can be separated by any number of empty or
comment lines (starting from `#`), which are ignored.
A very simple example is a transformation matrix that selects the :math:`t_{2g}` manifold.
For two correlated sites, one can define the file as follows:
::
# Site 1
1.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0
# Site 2
1.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0
Remarks on the VASP version
===============================
In the current version of the interface the Fermi energy is extracted from the
DOSCAR. However, if one pursues to do charge self-consistent calculations one
needs to write the Fermi energy to the projectors (`LOCPROJ` file), as the DOSCAR
is only updated after a full SCF/NSCF run. The file should contain the Fermi energy
in the header. One can either copy the Fermi energy manually there after a successful
VASP run, or modify the VASP source code slightly, by replacing the following line in
`locproj.F` (around line 695):
::
< WRITE(99,'(4I6," # of spin, # of k-points, # of bands, # of proj" )') NS,NK,NB,NF
---
> WRITE(99,'(4I6,F12.7," # of spin, # of k-points, # of bands, # of proj, Efermi" )') W%WDES%NCDIJ,NK,NB,NF,EFERMI
Now one needs to pass additionally the variable `EFERMI` to the function, by changing (at arount line 560):
::
< SUBROUTINE LPRJ_WRITE(IU6,IU0,W)
---
> SUBROUTINE LPRJ_WRITE(IU6,IU0,W,EFERMI)
REAL(q) :: EFERMI
Next, we need to pass this option when calling from `electron.F` and `main.F`
(just search for LPRJ_WRITE in the files) and change all occurences as follows:
::
< CALL LPRJ_WRITE(IO%IU6, IO%IU0, W)
---
> CALL LPRJ_WRITE(IO%IU6, IO%IU0, W, EFERMI)
Now Vasp should print in the header of the `LOCPROJ` file additionally the Fermi energy.
Another critical point for CSC calculations is the function call of
`LPRJ_LDApU` in VASP. This function is not needed, and was left there for debug
purposes, but is called every iteration. Removing the call to this function in `electron.F` in line 644 speeds up the calculation significantly in the `ICHARG=5` mode. Moreover, this prevents VASP from generating the `GAMMA` file, which should ideally only be done by the DMFT code after a successful DMFT step, and then be read by VASP.
Furthermore, there is a bug in `fileio.F` around line 1710 where VASP tries to
print "reading the density matrix from Gamma". This should be done only by the
master node, and VASP gets stuck sometimes. Adding a
::
IF (IO%IU0>=0) THEN
...
ENDIF
statement resolves this issue. A similar problem occurs, when VASP writes the
`OSZICAR` file and a buffer is stuck. Adding a `flush` to the buffer in
`electron.F` around line 580 after
::
CALL STOP_TIMING("G",IO%IU6,"DOS")
flush(17)
print *, ' '
resolves this issue. Otherwise the OSZICAR file is not written properly.

View File

@ -68,10 +68,33 @@ is given by the following 3 to 5 lines:
These lines have to be repeated for each inequivalent atom.
The last line gives the energy window, relative to the Fermi energy,
that is used for the projective Wannier functions. Note that, in
accordance with Wien2k, we give energies in Rydberg units!
The last line gives the lower and upper limit of the energy window,
relative to the Fermi energy, which is used for the projective Wannier functions.
Note that, in accordance with Wien2k, we give energies in Rydberg units!
The third number is an optional flag to switch between different modes:
#. 0: The projectors are constructed for the given energy window. The number
of bands within the window is usually different at each k-point which
will be reflected by the projectors, too. This is the default mode
which is also used if no mode flag is provided.
#. 1: The lowest and highest band indices within the given energy window
are calculated. The resulting indices are used at all k-points.
Bands which fall within the window only in some parts of the Brillouin zone
are fully taken into account. Keep in mind that a different set of k-points
or the -band option can change the lower or upper index. This can be avoided
by using mode 2.
#. 2: In this mode the first two values of the line are interpreted as lower
and upper band indices to be included in the projective subspace. For example,
if the line reads `21 23 2`, bands number 21, 22 and 23 are included at all
k-points. For SrVO3 this corresponds to the t2g bands around the Fermi energy.
The lowest possible index is 1. Note that the indices need to be provided as integer.
In all modes the used energy range, i.e. band range, is printed to the
:program:`dmftproj` output.
We also provide a simple python script `init_dmftpr` that creates the input file
interactively with user input in the shell, when executed in the wien2k run dir.
After setting up the :file:`case.indmftpr` input file, you run:
`dmftproj`
@ -94,9 +117,9 @@ directory name):
Now we convert these files into an hdf5 file that can be used for the
DMFT calculations. For this purpose we
use the python module :class:`Wien2kConverter <dft.converters.wien2k_converter.Wien2kConverter>`. It is initialized as::
use the python module :class:`Wien2kConverter <dft.converters.wien2k.Wien2kConverter>`. It is initialized as::
from triqs_dft_tools.converters.wien2k_converter import *
from triqs_dft_tools.converters.wien2k import *
Converter = Wien2kConverter(filename = case)
The only necessary parameter to this construction is the parameter `filename`.
@ -105,7 +128,7 @@ example, the :program:`Wien2k` naming convention is that all files have the
same name, but different extensions, :file:`case.*`. The constructor opens
an hdf5 archive, named :file:`case.h5`, where all relevant data will be
stored. For other parameters of the constructor please visit the
:ref:`refconverters` section of the reference manual.
:py:mod:`Converters <triqs_dft_tools.converters>` section of the reference manual.
After initializing the interface module, we can now convert the input
text files to the hdf5 archive by::
@ -158,7 +181,7 @@ and convert the input for :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>
After having converted this input, you can further proceed with the
:ref:`analysis`. For more options on the converter module, please have
a look at the :ref:`refconverters` section of the reference manual.
a look at the :py:mod:`Converters <triqs_dft_tools.converters>` section of the reference manual.
Data for transport calculations
-------------------------------

View File

@ -1,22 +1,23 @@
.. _conversion:
Supported interfaces
Supported interfaces
====================
The first step for a DMFT calculation is to provide the necessary
input based on a DFT calculation. We will not review how to do the DFT
calculation here in this documentation, but refer the user to the
documentation and tutorials that come with the actual DFT
package. At the moment, there are two full charge self consistent interfaces, for the
Wien2k and the VASP DFT packages, resp. In addition, there is an interface to Wannier90, as well
as a light-weight general-purpose interface. In the following, we will describe the usage of these
package. At the moment, there are three full charge self consistent interfaces, for the
Wien2k, VASP and Elk DFT packages, resp. In addition, there is an interface to Wannier90, as well
as a light-weight general-purpose interface. In the following, we will describe the usage of these
conversion tools.
.. toctree::
:maxdepth: 2
:maxdepth: 3
conv_wien2k
conv_vasp
conv_elk
conv_W90
conv_generalhk

View File

@ -37,7 +37,7 @@ that for one-shot calculations. Only at the very end we have to calculate the mo
and store it in a format such that Wien2k can read it. Therefore, after the DMFT loop that we saw in the
previous section, we symmetrise the self energy, and recalculate the impurity Green function::
SK.symm_deg_gf(S.Sigma,orb=0)
SK.symm_deg_gf(S.Sigma,ish=0)
S.G_iw << inverse(S.G0_iw) - S.Sigma_iw
S.G_iw.invert()
@ -124,28 +124,96 @@ example how such a self-consistent calculation is performed from scratch.
VASP + PLOVasp
--------------
.. warning::
This is a preliminary documentation valid for the alpha-version of the interface.
Modifications to the implementation might be introduced before the final release.
Unlike Wien2k implementation the charge self-consistent DMFT cycle in the
framework of PLOVasp interface is controlled by an external script. Because of
the specific way the DFT self-consistency is implemented in VASP the latter has
to run parallel to the DMFT script, with the synchronisation being ensured by a
lock file.
Unlike Wien2k implementation the charge self-consistent DMFT cycle
in the framework of PLOVasp interface is controlled by an external script.
Because of the specific way the DFT self-consistency is implemented in VASP
the latter has to run parallel to the DMFT script, with the synchronisation being
ensured by a lock file. PLOVasp interface provides a shell-script :program:`vasp_dmft.sh`
which takes care of the process management. The user must, however, specify a path
to VASP code and provide the DMFT Python-script.
Once VASP reaches the point where the projectors are generated
it creates a lock file `vasp.lock` and waits until the lock file is
removed. The shell script, in turn, waits for the VASP process and once
the lock file is created it starts a DMFT iteration. The DMFT iteration
must finish by generating a Kohn-Sham (KS) density matrix (file `GAMMA`)
and removing the lock file. The VASP process then reads in `GAMMA`
and proceeds with the next iteration. PLOVasp interface provides a shell-script :program:`vasp_dmft` (in the triqs bin directory):
::
vasp_dmft [-n <number of cores>] -i <number of iterations> -j <number of VASP iterations with fixed charge density> [-v <VASP version>] [-p <path to VASP directory>] [<dmft_script.py>]
If the number of cores is not specified it is set to 1 by default.
Set the number of times the dmft solver is called with -i <number of iterations>
Set the number of VASP iteration with a fixed charge density update
inbetween the dmft runs with -j <number of VASP iterations with fixed charge density>
Set the version of VASP by -v standard(default)/no_gamma_write to
specify if VASP writes the GAMMA file or not.
If the path to VASP directory is not specified it must be provided by a
variable VASP_DIR.
<dmft_script.py> must provide an importable function 'dmft_cycle()'
which is invoked once per DFT+DMFT iteration. If the script name is
omitted the default name 'csc_dmft.py' is used.
which takes care of the process management. The user must, however, specify a path to VASP code and provide the DMFT Python-script. See for an example :ref:`NiO CSC tutorial<nio_csc>`.
The user-provided script is almost the same as for Wien2k charge self-consistent
calculations with the main difference that its functionality (apart from
the lines importing other modules) should be placed inside a function `dmft_cycle()`
which will be called every DMFT cycle. Another difference is the way
function `calc_density_correction()` works.
calculations with the main difference that its functionality (apart from the
lines importing other modules) should be placed inside a function `dmft_cycle()`
which will be called every DMFT cycle.
VASP has a special INCAR `ICHARG=5` mode, that has to be switched on to make VASP wait for the `vasp.lock` file, and read the updated charge density after each step. One should add the following lines to the `INCAR` file::
ICHARG = 5
NELM = 1000
NELMIN = 1000
Technically, VASP runs with `ICHARG=5` in a SCF mode, and adding the DMFT
changes to the DFT density in each step, so that the full DFT+DMFT charge
density is constructed in every step. This is only done in VASP because only the
changes to the DFT density are read by VASP not the full DFT+DMFT density.
Moreover, one should always start with a converged `WAVECAR` file, or make sure,
that the KS states are well converged before the first projectors are created!
To understand the difference please make sure to read `ISTART flag VASP wiki
<https://www.vasp.at/wiki/index.php/ISTART>`_. Furthermore, the flags `NELM` and
`NELMIN` ensure that VASP does not terminate after the default number of
iterations of 60.
Elk
---------
The Elk CSC implementation is fairly similar to the Wien2k implementation. At the end of the :ref:`DMFT python script <SrVO3_elk>`, the density matrix in Bloch space needs to be calculated along with the correlation energy. This is written to DMATDMFT.OUT. An example of this (using the Migdal correlation energy formula) is given below::
#output the density matrix for Elk interface
dN, d = SK.calc_density_correction(dm_type='elk')
#correlation energy via the Migdal formula
correnerg = 0.5 * (S.G_iw * S.Sigma_iw).total_density()
#subtract the double counting energy
correnerg -= SK.dc_energ[0]
#convert to Hartree
correnerg = correnerg/SK.energy_unit
#save the correction to energy
if (mpi.is_master_node()):
f=open('DMATDMFT.OUT','a')
f.write("%.16f\n"%correnerg)
f.close()
To read this into Elk and update the electron density, run task 808. So elk.in is amended with the following::
task
808
This solves the Kohn-Sham equations once with the updated electron density and outputs the new set of energy eigenvalues and wavefunctions. To start the next fully charge self-consistent DFT+DMFT cycle (FCSC), a new set of projectors need to be generated (using task 805) and the whole procedure continues until convergence. The Elk potential rms value for each FCSC DFT+DMFT cycle is given in DMFT_INFO.OUT. An extensive example for SrVO:math:`_3` can be found here: :ref:`Elk SVO tutorial <SrVO3_elk>`.
This FCSC method should be universal irrespective to what type of ground state calculation performed. However, not all types of ground state calculations have been tested.
Other DFT codes
---------------
The extension to other DFT codes is straight forward. As described
The extension to other DFT codes is straightforward. As described
here, one needs to implement the correlated density matrix to be used
for the calculation of the charge density. This implementation will of
course depend on the DFT package, and might be easy to do or a quite

View File

@ -80,8 +80,8 @@ for :emphasis:`use_dc_formula` are:
At the end of the calculation, we can save the Green function and self energy into a file::
from pytriqs.archive import HDFArchive
import pytriqs.utility.mpi as mpi
from h5 import HDFArchive
import triqs.utility.mpi as mpi
if mpi.is_master_node():
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
ar["G"] = S.G_iw

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -5,3 +5,4 @@
1 0 2 3 0 0 # atom, sort, l, dim, SO, irep
2 0 2 3 0 0 # atom, sort, l, dim, SO, irep
3 0 2 3 0 0 # atom, sort, l, dim, SO, irep
0.0 # DFT Fermi Energy (optional)

View File

@ -1,167 +0,0 @@
.. _plovasp:
PLOVasp
=======
The general purpose of the PLOVasp tool is to transform raw, non-normalized
projectors generated by VASP into normalized projectors corresponding to
user-defined projected localized orbitals (PLO). The PLOs can then be used for
DFT+DMFT calculations with or without charge self-consistency. PLOVasp also
provides some utilities for basic analysis of the generated projectors, such as
outputting density matrices, local Hamiltonians, and projected density of
states.
PLOs are determined by the energy window in which the raw projectors are
normalized. This allows to define either atomic-like strongly localized Wannier
functions (large energy window) or extended Wannier functions focusing on
selected low-energy states (small energy window).
In PLOVasp, all projectors sharing the same energy window are combined into a
`projector group`. Technically, this allows one to define several groups with
different energy windows for the same set of raw projectors. Note, however,
that DFTtools does not support projector groups at the moment but this feature
might appear in future releases.
A set of projectors defined on sites related to each other either by symmetry
or by an atomic sort, along with a set of :math:`l`, :math:`m` quantum numbers,
forms a `projector shell`. There could be several projectors shells in a
projector group, implying that they will be normalized within the same energy
window.
Projector shells and groups are specified by a user-defined input file whose
format is described below.
Input file format
-----------------
The input file is written in the standard config-file format.
Parameters (or 'options') are grouped into sections specified as
`[Section name]`. All parameters must be defined inside some section.
A PLOVasp input file can contain three types of sections:
#. **[General]**: includes parameters that are independent
of a particular projector set, such as the Fermi level, additional
output (e.g. the density of states), etc.
#. **[Group <Ng>]**: describes projector groups, i.e. a set of
projectors sharing the same energy window and normalization type.
At the moment, DFTtools support only one projector group, therefore
there should be no more than one projector group.
#. **[Shell <Ns>]**: contains parameters of a projector shell labelled
with `<Ns>`. If there is only one group section and one shell section,
the group section can be omitted but in this case, the group required
parameters must be provided inside the shell section.
Section [General]
"""""""""""""""""
The entire section is optional and it contains three parameters:
* **BASENAME** (string): provides a base name for output files.
Default filenames are :file:`vasp.*`.
* **DOSMESH** ([float float] integer): if this parameter is given,
the projected density of states for each projected orbital will be
evaluated and stored to files :file:`pdos_<n>.dat`, where `n` is the
orbital index. The energy
mesh is defined by three numbers: `EMIN` `EMAX` `NPOINTS`. The first two
can be omitted in which case they are taken to be equal to the projector
energy window. **Important note**: at the moment this option works
only if the tetrahedron integration method (`ISMEAR = -4` or `-5`)
is used in VASP to produce `LOCPROJ`.
* **EFERMI** (float): provides the Fermi level. This value overrides
the one extracted from VASP output files.
There are no required parameters in this section.
Section [Shell]
"""""""""""""""
This section specifies a projector shell. Each `[Shell]` section must be
labeled by an index, e.g. `[Shell 1]`. These indices can then be referenced
in a `[Group]` section.
In each `[Shell]` section two parameters are required:
* **IONS** (list of integer): indices of sites included in the shell.
The sites can be given either by a list of integers `IONS = 5 6 7 8`
or by a range `IONS = 5..8`. The site indices must be compatible with
the POSCAR file.
* **LSHELL** (integer): :math:`l` quantum number of the desired local states.
It is important that a given combination of site indices and local states
given by `LSHELL` must be present in the LOCPROJ file.
There are additional optional parameters that allow one to transform
the local states:
* **TRANSFORM** (matrix): local transformation matrix applied to all states
in the projector shell. The matrix is defined by a (multiline) block
of floats, with each line corresponding to a row. The number of columns
must be equal to :math:`2 l + 1`, with :math:`l` given by `LSHELL`. Only real matrices
are allowed. This parameter can be useful to select certain subset of
orbitals or perform a simple global rotation.
* **TRANSFILE** (string): name of the file containing transformation
matrices for each site. This option allows for a full-fledged functionality
when it comes to local state transformations. The format of this file
is described :ref:`below <transformation_file>`.
Section [Group]
"""""""""""""""
Each defined projector shell must be part of a projector group. In the current
implementation of DFTtools only a single group (labelled by any integer, e.g. `[Group 1]`)
is supported. This implies that all projector shells
must be included in this group.
Required parameters for any group are the following:
* **SHELLS** (list of integers): indices of projector shells included in the group.
All defined shells must be grouped.
* **EWINDOW** (float float): the energy window specified by two floats: bottom
and top. All projectors in the current group are going to be normalized within
this window. *Note*: This option must be specified inside the `[Shell]` section
if only one shell is defined and the `[Group]` section is omitted.
Optional group parameters:
* **NORMALIZE** (True/False): specifies whether projectors in the group are
to be normalized. The default value is **True**.
* **NORMION** (True/False): specifies whether projectors are normalized on
a per-site (per-ion) basis. That is, if `NORMION = True`, the orthogonality
condition will be enforced on each site separately but the Wannier functions
on different sites will not be orthogonal. If `NORMION = False`, the Wannier functions
on different sites included in the group will be orthogonal to each other.
.. _transformation_file:
File of transformation matrices
"""""""""""""""""""""""""""""""
.. warning::
The description below applies only to collinear cases (i.e., without spin-orbit
coupling). In this case, the matrices are spin-independent.
The file specified by option `TRANSFILE` contains transformation matrices
for each ion. Each line must contain a series of floats whose number is either equal to
the number of orbitals :math:`N_{orb}` (in this case the transformation matrices
are assumed to be real) or to :math:`2 N_{orb}` (for the complex transformation matrices).
The total number of lines :math:`N` must be a multiple of the number of ions :math:`N_{ion}`
and the ratio :math:`N / N_{ion}`, then, gives the dimension of the transformed
orbital space. The lines with floats can be separated by any number of empty or
comment lines (starting from `#`), which are ignored.
A very simple example is a transformation matrix that selects the :math:`t_{2g}` manifold.
For two correlated sites, one can define the file as follows:
::
# Site 1
1.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0
# Site 2
1.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0

53
doc/guide/soc.rst Normal file
View File

@ -0,0 +1,53 @@
.. _soc:
Spin-orbit coupled calculations (single-shot)
=============================================
There are two main ways of including the spin-orbit coupling (SOC) term into
DFT+DMFT calculations:
- by performing a DFT calculation including SOC and then doing a DMFT calculation on top, or
- by performing a DFT calculation without SOC and then adding the SOC term on the model level.
The second variant is a bit more involved and needs quite some expertise, so this guide will cover only the first variant with SOC included in the DFT calculations.
Treatment of SOC in DFT
-----------------------
For now, TRIQS/DFTTools does only work with Wien2k and Elk when performing calculations with SO.
The treatment of SOC in the VASP package is fundamentally different to the way Wien2k treats it, and the interface does not handle that at the moment.
Therefore, this guide describes how to do an SOC calculation using the Wien2k and Elk DFT packages.
Treatment of SOC in Wien2k
--------------------------
First, a Wien2k calculation including SOC has to be performed.
For details, we refer the reader to the `documentation of Wien2k <http://susi.theochem.tuwien.ac.at/reg_user/textbooks/>`_ . As a matter of fact, we need the output for the DFT band structure for both spin directions explicitly. That means that one needs to do a spin-polarised DFT calculation with SOC, but, however, with magnetic moment set to zero. In the Wien2k initialisation procedure, one can choose for the option -nom when ``lstart`` is called. This means that the charge densities are initialised without magnetic splitting. The SOC calculation is then performed in a standard way as described in the Wien2k manual.
Performing the projection in Wien2k
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that the final ``x lapw2 -almd -so -up`` and ``x lapw2 -almd -so -dn`` have to be run *on a single core*, which implies that, before, ``x lapw2 -up``, ``x lapw2 -dn``, and ``x lapwso -up`` have to be run in single-core mode (at least once).
In the ``case.indmftpr`` file, the spin-orbit flag has to be set to ``1`` for the correlated atoms.
For example, for the compound Sr\ :sub:`2`\ MgOsO\ :sub:`6`, with the struct file :download:`Sr2MgOsO6.struct <Sr2MgOsO6/Sr2MgOsO6.struct>`, we would, e.g., use the ``indmftpr`` file :download:`found here <Sr2MgOsO6/Sr2MgOsO6_SOC.indmftpr>`.
Then, ``dmftproj -sp -so`` has to be called.
As usual, it is important to check for warnings (e.g., about eigenvalues of the overlap matrix) in the output of ``dmftproj`` and adapt the window until these warnings disappear.
Note that in presence of SOC, it is not possible to project only onto the :math:`t_{2g}` subshell because it is not an irreducible representation.
Treatment of SOC in Elk
-------------------------
First, a Elk calculation including SOC has to be performed. For details, we refer the reader to the SOC Elk examples in Elk's example directory and `Elk manual <https//elk.sourceforge.net/elk.pdf>`_ for further information about the input flags. Then the projectors can be generated using the ``wanproj`` input flag in the same format as in :ref:`convElk`. Like in Wien2k, you cannot project only onto the :math:`t_{2g}` subshell because it is not an irreducible representation in SOC calculations.
After generating the projectors
-------------------------------
We strongly suggest using the :py:meth:`.dos_wannier_basis` functionality of the :py:class:`.SumkDFTTools` class (see :download:`calculate_dos_wannier_basis.py <Sr2RuO4/calculate_dos_wannier_basis.py>`) and compare the Wannier-projected orbitals to the original DFT DOS (they should be more or less equal).
Note that, with SOC, there are usually off-diagonal elements of the spectral function, which can also be imaginary.
The imaginary part can be found in the third column of the files ``DOS_wann_...``.
After the projection, one can proceed with the DMFT calculation. However, two things need to be noted here. First, since the spin is not a good quantum number any more, there are off-diagonal elements in the hybridisation function and the local Hamiltonian coupling the two spin directions. This will eventually lead to a fermonic sign problem when QMC is used as a impurity solver. Second, although the :math:`e_{g}` subshell needs to be included in the projection, it can in many cases be neglected in the solution of the Anderson impurity model, after a transformation to a rotated local basis is done. This basis, diagonalising the local Hamiltonian in the presence of SOC, is often called the numerical j-basis. How rotations are performed is described in :ref:`basisrotation`, and the cutting of the orbitals in :ref:`blockstructure`.
A DMFT calculation including SOC for Sr2MgOsO6 using Wien2k is included in the :ref:`tutorials`.

View File

@ -52,13 +52,13 @@ real-frequency self energy.
it is crucial to perform the analytic continuation in such a way that the real-frequency self energy
is accurate around the Fermi energy as low-energy features strongly influence the final results.
Besides the self energy the Wien2k files read by the transport converter (:meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`) are:
Besides the self energy the Wien2k files read by the transport converter (:meth:`convert_transport_input <dft.converters.wien2k.Wien2kConverter.convert_transport_input>`) are:
* :file:`.struct`: The lattice constants specified in the struct file are used to calculate the unit cell volume.
* :file:`.outputs`: In this file the k-point symmetries are given.
* :file:`.oubwin`: Contains the indices of the bands within the projected subspace (written by :program:`dmftproj`) for each k-point.
* :file:`.pmat`: This file is the output of the Wien2k optics package and contains the velocity (momentum) matrix elements between all bands in the desired energy
window for each k-point. How to use the optics package is described below.
* :file:`.h5`: The hdf5 archive has to be present and should contain the dft_input subgroup. Otherwise :meth:`convert_dft_input <dft.converters.wien2k_converter.Wien2kConverter.convert_dft_input>` needs to be called before :meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`.
* :file:`.h5`: The hdf5 archive has to be present and should contain the dft_input subgroup. Otherwise :meth:`convert_dft_input <dft.converters.wien2k.Wien2kConverter.convert_dft_input>` needs to be called before :meth:`convert_transport_input <dft.converters.wien2k.Wien2kConverter.convert_transport_input>`.
Wien2k optics package
@ -84,7 +84,7 @@ Using the transport code
First we have to read the Wien2k files and store the relevant information in the hdf5 archive::
from triqs_dft_tools.converters.wien2k_converter import *
from triqs_dft_tools.converters.wien2k import *
from triqs_dft_tools.sumk_dft_tools import *
Converter = Wien2kConverter(filename='case', repacking=True)
@ -92,7 +92,7 @@ First we have to read the Wien2k files and store the relevant information in the
SK = SumkDFTTools(hdf_file='case.h5', use_dft_blocks=True)
The converter :meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`
The converter :meth:`convert_transport_input <dft.converters.wien2k.Wien2kConverter.convert_transport_input>`
reads the required data of the Wien2k output and stores it in the `dft_transp_input` subgroup of your hdf file.
Additionally we need to read and set the self energy, the chemical potential and the double counting::

View File

@ -1,12 +1,12 @@
.. _hdfstructure:
hdf5 structure
==============
standardized hdf5 structure
===========================
All the data is stored using the hdf5 standard, as described also in the
All the DFT input data is stored using the hdf5 standard, as described also in the
documentation of the TRIQS package itself. In order to do a DMFT calculation,
using input from DFT applications, a converter is needed on order to provide
the necessary data in the hdf5 format.
the necessary data in the hdf5 format.
groups and their formats
------------------------
@ -17,7 +17,7 @@ DMFT calculations for all kinds of situations, e.g. d-p Hamiltonians, more than
one correlated atomic shell, or using symmetry operations for the k-summation.
We store all data in subgroups of the hdf5 archive:
Main data
Main data
^^^^^^^^^
There needs to be one subgroup for the main data of the
calculation. The default name of this group is `dft_input`. Its contents are
@ -31,56 +31,94 @@ k_dep_projection numpy.int
0 otherwise.
SP numpy.int 1 for spin-polarised Hamiltonian, 0 for paramagnetic Hamiltonian.
SO numpy.int 1 if spin-orbit interaction is included, 0 otherwise.
charge_below numpy.float Number of electrons in the crystal below the correlated orbitals.
Note that this is for compatibility with dmftproj.
charge_below numpy.float Number of electrons in the crystal below the correlated orbitals.
Note that this is for compatibility with dmftproj, otherwise set to 0
density_required numpy.float Required total electron density. Needed to determine the chemical potential.
The density in the projection window is then `density_required`-`charge_below`.
symm_op numpy.int 1 if symmetry operations are used for the BZ sums,
symm_op numpy.int 1 if symmetry operations are used for the BZ sums,
0 if all k-points are directly included in the input.
n_shells numpy.int Number of atomic shells for which post-processing is possible.
Note: this is `not` the number of correlated orbitals!
n_shells numpy.int Number of atomic shells for which post-processing is possible.
Note: this is `not` the number of correlated orbitals!
If there are two equivalent atoms in the unit cell, `n_shells` is 2.
shells list of dict {string:int}, dim n_shells x 4 Atomic shell information.
For each shell, have a dict with keys ['atom', 'sort', 'l', 'dim'].
shells list of dict {string:int}, dim n_shells x 4 Atomic shell information.
For each shell, have a dict with keys ['atom', 'sort', 'l', 'dim'].
'atom' is the atom index, 'sort' defines the equivalency of the atoms,
'l' is the angular quantum number, 'dim' is the dimension of the atomic shell.
e.g. for two equivalent atoms in the unit cell, `atom` runs from 0 to 1,
e.g. for two equivalent atoms in the unit cell, `atom` runs from 0 to 1,
but `sort` can take only one value 0.
n_corr_shells numpy.int Number of correlated atomic shells.
If there are two correlated equivalent atoms in the unit cell, `n_corr_shells` is 2.
corr_shells list of dict {string:int}, dim n_corr_shells x 6 Correlated orbital information.
For each correlated shell, have a dict with keys
['atom', 'sort', 'l', 'dim', 'SO', 'irep'].
n_corr_shells numpy.int Number of correlated atomic shells.
If there are two correlated equivalent atoms in the unit cell, `n_corr_shells` is 2.
n_inequiv_shells numpy.int Number of inequivalent atomic shells. Needs to be smaller than `n_corr_shells`.
The up / downfolding routines mediate between all correlated shells and the
actual inequivalent shells, by using the self-energy etc. for all equal shells
belonging to the same class of inequivalent shells. The mapping is performed with
information stored in `corr_to_inequiv` and `inequiv_to_corr`.
corr_to_inequiv list of numpy.int, dim `n_corr_shells` mapping from correlated shells to inequivalent correlated shells.
A list of length `n_corr_shells` containing integers, where same numbers mark
equivalent sites.
inequiv_to_corr list of numpy.int, dim `n_inequiv_shells` A list of length `n_inequiv_shells` containing list indices as integers pointing
to the corresponding sites in `corr_to_inequiv`.
corr_shells list of dict {string:int}, dim n_corr_shells x 6 Correlated orbital information.
For each correlated shell, have a dict with keys
['atom', 'sort', 'l', 'dim', 'SO', 'irrep'].
'atom' is the atom index, 'sort' defines the equivalency of the atoms,
'l' is the angular quantum number, 'dim' is the dimension of the atomic shell.
'SO' is one if spin-orbit is included, 0 otherwise, 'irep' is a dummy integer 0.
use_rotations numpy.int 1 if local and global coordinate systems are used, 0 otherwise.
rot_mat list of numpy.array.complex, Rotation matrices for correlated shells, if `use_rotations`.
dim n_corr_shells x [corr_shells['dim'],corr_shells['dim']] Set to the unity matrix if no rotations are used.
rot_mat list of numpy.array.complex, Rotation matrices for correlated shells, if `use_rotations`.
dim n_corr_shells x [corr_shells['dim'],corr_shells['dim']] These rotations are automatically applied for up / downfolding.
Set to the unity matrix if no rotations are used.
rot_mat_time_inv list of numpy.int, dim n_corr_shells If `SP` is 1, 1 if the coordinate transformation contains inversion, 0 otherwise.
If `use_rotations` or `SP` is 0, give a list of zeros.
n_reps numpy.int Number of irreducible representations of the correlated shell.
n_reps numpy.int Number of irreducible representations of the correlated shell.
e.g. 2 if eg/t2g splitting is used.
dim_reps list of numpy.int, dim n_reps Dimension of the representations.
e.g. [2,3] for eg/t2g subsets.
T list of numpy.array.complex, Transformation matrix from the spherical harmonics to impurity problem basis
dim n_inequiv_corr_shell x normally the real cubic harmonics).
[max(corr_shell['dim']),max(corr_shell['dim'])] This matrix is used to calculate the 4-index U matrix.
e.g. [2,3] for eg/t2g subsets.
T list of numpy.array.complex, Transformation matrix from the spherical harmonics to impurity problem basis
dim n_inequiv_corr_shell x normally the real cubic harmonics).
[max(corr_shell['dim']),max(corr_shell['dim'])] This matrix can be used to calculate the 4-index U matrix, not automatically done.
n_orbitals numpy.array.int, dim [n_k,SP+1-SO] Number of Bloch bands included in the projection window for each k-point.
If SP+1-SO=2, the number of included bands may depend on the spin projection up/down.
proj_mat numpy.array.complex, Projection matrices from Bloch bands to Wannier orbitals.
dim [n_k,SP+1-SO,n_corr_shells,max(corr_shell['dim']),max(n_orbitals)] For efficient storage reasons, all matrices must be of the same size
(given by last two indices).
dim [n_k,SP+1-SO,n_corr_shells,max(corr_shell['dim']),max(n_orbitals)] For efficient storage reasons, all matrices must be of the same size
(given by last two indices).
For k-points with fewer bands, only the first entries are used, the rest are zero.
e.g. if number of Bloch bands ranges from 4-6, all matrices are of size 6.
bz_weights numpy.array.float, dim n_k Weights of the k-points for the k summation.
hopping numpy.array.complex, Non-interacting Hamiltonian matrix for each k point.
dim [n_k,SP+1-SO,max(n_orbitals),max(n_orbitals)] As for `proj_mat`, all matrices have to be of the same size.
bz_weights numpy.array.float, dim n_k Weights of the k-points for the k summation. Soon be replaced by `kpt_weights`
hopping numpy.array.complex, Non-interacting Hamiltonian matrix for each k point.
dim [n_k,SP+1-SO,max(n_orbitals),max(n_orbitals)] As for `proj_mat`, all matrices have to be of the same size.
================= ====================================================================== =====================================================================================
Converter specific data
^^^^^^^^^^^^^^^^^^^^^^^
This data is specific to the different converters and stored in the `dft_input`
group as well.
For the Vasp converter:
================= ====================================================================== =====================================================================================
Name Type Meaning
================= ====================================================================== =====================================================================================
kpt_basis numpy.array.float, dim [3, 3] Basis for the k-point mesh, reciprocal lattice vectors.
kpts numpy.array.float, dim [n_k, 3] k-points given in reciprocal coordinates.
kpt_weights numpy.array.float, dim [n_k] Weights of the k-points for the k summation.
proj_or_hk string Switch determining whether the Vasp converter is running in projection mode `proj`, or
in Hamiltonian mode `hk`. In Hamiltonian mode, the hopping matrix is written in
orbital basis, whereas in projection mode hopping is written in band basis.
proj_mat_csc numpy.array.complex, Projection matrices from Bloch bands to Wannier orbitals for Hamiltonian based `hk`
dim approach. No site index is given, since hk is written in orbital basis. The last to
[n_k, SP+1-SO, n_corr_shells, max(corr_shell['dim']), max(n_orbitals)] indices are a square matrix rotating from orbital to band space.
dft_fermi_weights numpy.array.float, dim [n_k, SP+1-SO, max(n_orbitals)] DFT fermi weights (occupations) of KS eigenstates for each k-point for calculation
(stored in dft_misc_input) of density matrix correction.
band_window list of numpy.array.int , dim [n_k, 2] Band windows as KS band indices in Vasp for each spin channel, and k-point. Needed for
(stored in dft_misc_input) writing out the GAMMA file.
================= ====================================================================== =====================================================================================
Symmetry operations
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^
In this subgroup we store all the data for applying the symmetry operations in
the DMFT loop (in case you want to use symmetry operations). The default name
of this subgroup is `dft_symmcorr_input`. This information is needed only if symmetry
@ -127,8 +165,8 @@ It is furthermore assumed that all k-points have equal weight in the k-sum.
Note that the input file should contain only the numbers, not the comments
given in above example.
The Hamiltonian matrices can be taken, e.g., from Wannier90, which contructs
the Hamiltonian in a maximally localised Wannier basis.
The Hamiltonian matrices can be taken, e.g., from Wannier90, which constructs
the Hamiltonian in a maximally localized Wannier basis.
Note that with this simplified converter, no full charge self consistent
calculations are possible!

View File

@ -1,31 +1,68 @@
.. index:: DFTTools
.. module:: triqs_dft_tools
.. _dft:
.. _welcome:
#########
DFTTools
========
#########
.. sidebar:: DFTTools 2.2
.. sidebar:: DFTTools 3.0.0
This is the homepage of DFTTools v3.0.0.
For changes see the :ref:`changelog page <changelog>`.
.. image:: _static/logo_github.png
:width: 75%
:align: center
:target: https://github.com/triqs/dft_tools
This is the homepage DFTTools Version 2.2
For the changes in DFTTools, Cf :ref:`changelog page <changelog>`
This :ref:`TRIQS-based <triqslibs:welcome>`-based application is aimed
at ab-initio calculations for
correlated materials, combining realistic DFT band-structure
calculations with the dynamical mean-field theory. Together with the
necessary tools to perform the DMFT self-consistency loop for
realistic multi-band problems, the package provides a full-fledged
realistic multi-band problems. The package provides a full-fledged
charge self-consistent interface to the `Wien2K package
<http://www.wien2k.at>`_. In addition, if Wien2k is not available, it
provides a generic interface for one-shot DFT+DMFT calculations, where
only the single-particle Hamiltonian in orbital space has to be
provided.
<http://www.wien2k.at>`_, and `VASP package <https://www.vasp.at>`_.
In addition, it provides a generic interface for one-shot DFT+DMFT
calculations, where only the single-particle Hamiltonian in
orbital space has to be provided. The Hamiltonian can be
generated from the above mentioned DFT codes,
`wannier90 <http://www.wannier.org/>`_ output files, or with the
built-in generic H(k) converter.
Learn how to use this package in the :ref:`documentation` and the :ref:`tutorials`.
.. image:: _static/logo_cea.png
:width: 14%
:target: http://ipht.cea.fr
.. image:: _static/logo_x.png
:width: 14%
:target: "https://www.cpht.polytechnique.fr
.. image:: _static/logo_cnrs.png
:width: 14%
:target: https://www.cnrs.fr
.. image:: _static/logo_erc.jpg
:width: 14%
.. image:: _static/logo_flatiron.png
:width: 20%
:target: https://www.simonsfoundation.org/flatiron
.. image:: _static/logo_simons.jpg
:width: 20%
:target: https://www.simonsfoundation.org
.. toctree::
:maxdepth: 2
:hidden:
install
documentation
tutorials
issues
ChangeLog.md
about

View File

@ -2,16 +2,36 @@
.. _install:
Installation
************
Packaged Versions of DFTTools
=============================
A Docker image including the latest version of DFTTools is available `here <https://hub.docker.com/r/flatironinstitute/triqs>`_. For more information, please see the page on :ref:`TRIQS Docker <triqslibs:triqs_docker>`.
.. _ubuntu_debian:
Ubuntu Debian packages
----------------------
We further provide a Debian package for the Ubuntu LTS Versions 16.04 (xenial) and 18.04 (bionic), which can be installed by following the steps outlined :ref:`here <triqslibs:triqs_docker>`, and the subsequent command::
We provide a Debian package for the Ubuntu LTS Versions 18.04 (bionic) and 20.04 (focal), which can be installed by following the steps outlined :ref:`here <triqslibs:ubuntu_debian>`, and the subsequent command::
sudo apt-get install -y triqs_dft_tools
.. _anaconda:
Anaconda (experimental)
-----------------------
We provide Linux and OSX packages for the `Anaconda <https://www.anaconda.com/>`_ distribution. The packages are provided through the `conda-forge <https://conda-forge.org/>`_ repositories. After `installing conda <https://docs.conda.io/en/latest/miniconda.html>`_ you can install DFTTools with::
conda install -c conda-forge triqs_dft_tools
See also `github.com/conda-forge/triqs_dft_tools-feedstock <https://github.com/conda-forge/triqs_dft_tools-feedstock/>`_.
.. _docker:
Docker
------
A Docker image including the latest version of DFTTools is available `here <https://hub.docker.com/r/flatironinstitute/triqs>`_. For more information, please see the page on :ref:`TRIQS Docker <triqslibs:triqs_docker>`.
Compiling DFTTools from source
==============================
@ -19,34 +39,40 @@ Compiling DFTTools from source
Prerequisites
-------------
#. The :ref:`TRIQS <triqslibs:welcome>` toolbox.
#. The :ref:`TRIQS <triqslibs:welcome>` library, see :ref:`TRIQS installation instruction <triqslibs:triqs_install>`.
In the following, we assume that TRIQS is installed in the directory ``path_to_triqs``.
#. Likely, you will also need at least one impurity solver, e.g. the `CTHYB solver <https://triqs.github.io/cthyb/latest/>`_.
#. Likely, you will also need at least one impurity solver, e.g. the :ref:`CTHYB solver <triqscthyb:welcome>`.
Installation steps
Installation steps
------------------
#. Download the source code by cloning the ``TRIQS/dft_tools`` repository from GitHub::
$ git clone https://github.com/TRIQS/dft_tools.git dft_tools.src
#. Download the source code of the latest stable version by cloning the ``TRIQS/dft_tools`` repository from GitHub::
$ git clone https://github.com/TRIQS/dft_tools dft_tools.src
#. Create and move to a new directory where you will compile the code::
$ mkdir dft_tools.build && cd dft_tools.build
#. Ensure that your shell contains the TRIQS environment variables by sourcing the ``triqsvars.sh`` file from your TRIQS installation::
$ source path_to_triqs/share/triqsvarsh.sh
$ source path_to_triqs/share/triqs/triqsvars.sh
#. In the build directory call cmake, including any additional custom CMake options, see below::
$ cmake ../dft_tools.src
#. Compile the code, run the tests and install the application::
$ make
$ make test
$ make install
#. Compile the code, run the tests and install the application::
$ make
$ make test
$ make install
Important note for FCSC DFT+DMFT calculations
---------------------------------------------
To use dft_tools together with any of the supported DFT codes (Wien2k, Vasp, or Elk) in a full charge self-consistent manner, please make sure to compile both triqs and the designated DFT code with the same compiler / library setup for best compatibility. For example, if Vasp is compiled with the intel compiler suite, it will not be possible to use it together with a GNU compiled triqs and vice versa during a FCSC calculation, as both codes need to run at the same time. Hence, it is highly advisable to not use the intel compilers (linking againt intel mkl libraries is of course fine) to compile any of the interfaced DFT codes.
Installation steps for the use with WIEN2K version 14.2 and older
@ -96,37 +122,41 @@ Finally, you will have to change the calls to :program:`python_with_DMFT` to
your :program:`python` installation in the Wien2k :file:`path_to_Wien2k/run*` files.
Version compatibility
Version compatibility
---------------------
Be careful that the version of the TRIQS library and of the :program:`DFTTools` must be
compatible (more information on the :ref:`TRIQS website <triqslibs:welcome>`.
If you want to use a version of the :program:`DFTTools` that is not the latest one, go
into the directory with the sources and look at all available versions::
$ cd src && git tag
Checkout the version of the code that you want, for instance::
$ git co 2.1
Then follow the steps 2 to 5 described above to compile the code.
Keep in mind that the version of ``dft_tools`` must be compatible with your TRIQS library version,
see :ref:`TRIQS website <triqslibs:versions>`.
In particular the Major and Minor Version numbers have to be the same.
To use a particular version, go into the directory with the sources, and look at all available versions::
$ cd dft_tools.src && git tag
Checkout the version of the code that you want::
$ git checkout 2.1.0
and follow steps 2 to 4 above to compile the code.
Custom CMake options
--------------------
Functionality of ``dft_tools`` can be tweaked using extra compile-time options passed to CMake::
The compilation of ``dft_tools`` can be configured using CMake-options::
cmake -DOPTION1=value1 -DOPTION2=value2 ... ../dft_tools.src
cmake ../dft_tools.src -DOPTION1=value1 -DOPTION2=value2 ...
+---------------------------------------------------------------+-----------------------------------------------+
| Options | Syntax |
+===============================================================+===============================================+
| Disable testing (not recommended) | -DBuild_Tests=OFF |
+---------------------------------------------------------------+-----------------------------------------------+
| Build the documentation locally | -DBuild_Documentation=ON |
+---------------------------------------------------------------+-----------------------------------------------+
| Check test coverage when testing | -DTEST_COVERAGE=ON |
| (run ``make coverage`` to show the results; requires the | |
| python ``coverage`` package) | |
+---------------------------------------------------------------+-----------------------------------------------+
+-----------------------------------------------------------------+-----------------------------------------------+
| Options | Syntax |
+=================================================================+===============================================+
| Specify an installation path other than path_to_triqs | -DCMAKE_INSTALL_PREFIX=path_to_dft_tools |
+-----------------------------------------------------------------+-----------------------------------------------+
| Build in Debugging Mode | -DCMAKE_BUILD_TYPE=Debug |
+-----------------------------------------------------------------+-----------------------------------------------+
| Disable testing (not recommended) | -DBuild_Tests=OFF |
+-----------------------------------------------------------------+-----------------------------------------------+
| Build the documentation | -DBuild_Documentation=ON |
+-----------------------------------------------------------------+-----------------------------------------------+
| Check test coverage when testing | -DTEST_COVERAGE=ON |
| (run ``make coverage`` to show the results; requires the | |
| python ``coverage`` package) | |
+-----------------------------------------------------------------+-----------------------------------------------+

View File

@ -1,13 +1,14 @@
.. _issues:
Reporting issues
================
*****************
Please report all problems and bugs directly at the github issue page
`<https://github.com/TRIQS/dft_tools/issues>`_. In order to make it easier
for us to solve the issue please follow these guidelines:
`<https://github.com/TRIQS/dft_tools/issues>`_. In order to make it easier for us
to solve the issue please follow these guidelines:
#. In all cases specify which version of the application you are using. You can
find the version number in the file :file:`README.txt` at the root of the
find the version number in the file :file:`CMakeLists.txt` at the root of the
application sources.
#. If you have a problem during the installation, give us information about

View File

@ -1,22 +0,0 @@
Block Structure
===============
The `BlockStructure` class allows to change and manipulate
Green functions structures and mappings from sumk to solver.
The block structure can also be written to and read from HDF files.
.. warning::
Do not write the individual elements of this class to a HDF file,
as they belong together and changing one without the other can
result in unexpected results. Always write the BlockStructure
object as a whole.
Writing the sumk_to_solver and solver_to_sumk elements
individually is not implemented.
.. autoclass:: triqs_dft_tools.block_structure.BlockStructure
:members:
:show-inheritance:

View File

@ -1,29 +0,0 @@
.. _refconverters:
Converters
==========
Wien2k Converter
----------------
.. autoclass:: triqs_dft_tools.converters.wien2k_converter.Wien2kConverter
:members:
:special-members:
:show-inheritance:
H(k) Converter
--------------
.. autoclass:: triqs_dft_tools.converters.hk_converter.HkConverter
:members:
:special-members:
Wannier90 Converter
-------------------
.. autoclass:: triqs_dft_tools.converters.wannier90_converter.Wannier90Converter
:members:
:special-members:
Converter Tools
---------------
.. autoclass:: triqs_dft_tools.converters.converter_tools.ConverterTools
:members:
:special-members:

View File

@ -1,8 +0,0 @@
SumK DFT
========
.. autoclass:: triqs_dft_tools.sumk_dft.SumkDFT
:members:
:special-members:
:show-inheritance:

View File

@ -1,8 +0,0 @@
SumK DFT Tools
==============
.. autoclass:: triqs_dft_tools.sumk_dft_tools.SumkDFTTools
:members:
:special-members:
:show-inheritance:

View File

@ -1,6 +0,0 @@
Symmetry
========
.. autoclass:: triqs_dft_tools.Symmetry
:members:
:special-members:

View File

@ -1,6 +0,0 @@
TransBasis
==========
.. autoclass:: triqs_dft_tools.trans_basis.TransBasis
:members:
:special-members:

View File

@ -0,0 +1,427 @@
"""Attempt to generate templates for module reference with Sphinx
XXX - we exclude extension modules
To include extension modules, first identify them as valid in the
``_uri2path`` method, then handle them in the ``_parse_module`` script.
We get functions and classes by parsing the text of .py files.
Alternatively we could import the modules for discovery, and we'd have
to do that for extension modules. This would involve changing the
``_parse_module`` method to work via import and introspection, and
might involve changing ``discover_modules`` (which determines which
files are modules, and therefore which module URIs will be passed to
``_parse_module``).
NOTE: this is a modified version of a script originally shipped with the
PyMVPA project, which we've adapted for NIPY use. PyMVPA is an MIT-licensed
project."""
# Stdlib imports
import os
import re
# Functions and classes
class ApiDocWriter:
''' Class for automatic detection and parsing of API docs
to Sphinx-parsable reST format'''
# only separating first two levels
rst_section_levels = ['*', '=', '-', '~', '^']
def __init__(self,
package_name,
rst_extension='.rst',
package_skip_patterns=None,
module_skip_patterns=None,
):
''' Initialize package for parsing
Parameters
----------
package_name : string
Name of the top-level package. *package_name* must be the
name of an importable package
rst_extension : string, optional
Extension for reST files, default '.rst'
package_skip_patterns : None or sequence of {strings, regexps}
Sequence of strings giving URIs of packages to be excluded
Operates on the package path, starting at (including) the
first dot in the package path, after *package_name* - so,
if *package_name* is ``sphinx``, then ``sphinx.util`` will
result in ``.util`` being passed for earching by these
regexps. If is None, gives default. Default is:
['\.tests$']
module_skip_patterns : None or sequence
Sequence of strings giving URIs of modules to be excluded
Operates on the module name including preceding URI path,
back to the first dot after *package_name*. For example
``sphinx.util.console`` results in the string to search of
``.util.console``
If is None, gives default. Default is:
['\.setup$', '\._']
'''
if package_skip_patterns is None:
package_skip_patterns = ['\\.tests$']
if module_skip_patterns is None:
module_skip_patterns = ['\\.setup$', '\\._']
self.package_name = package_name
self.rst_extension = rst_extension
self.package_skip_patterns = package_skip_patterns
self.module_skip_patterns = module_skip_patterns
def get_package_name(self):
return self._package_name
def set_package_name(self, package_name):
''' Set package_name
>>> docwriter = ApiDocWriter('sphinx')
>>> import sphinx
>>> docwriter.root_path == sphinx.__path__[0]
True
>>> docwriter.package_name = 'docutils'
>>> import docutils
>>> docwriter.root_path == docutils.__path__[0]
True
'''
# It's also possible to imagine caching the module parsing here
self._package_name = package_name
self.root_module = __import__(package_name)
self.root_path = self.root_module.__path__[0]
self.written_modules = None
package_name = property(get_package_name, set_package_name, None,
'get/set package_name')
def _get_object_name(self, line):
''' Get second token in line
>>> docwriter = ApiDocWriter('sphinx')
>>> docwriter._get_object_name(" def func(): ")
'func'
>>> docwriter._get_object_name(" class Klass: ")
'Klass'
>>> docwriter._get_object_name(" class Klass: ")
'Klass'
'''
name = line.split()[1].split('(')[0].strip()
# in case we have classes which are not derived from object
# ie. old style classes
return name.rstrip(':')
def _uri2path(self, uri):
''' Convert uri to absolute filepath
Parameters
----------
uri : string
URI of python module to return path for
Returns
-------
path : None or string
Returns None if there is no valid path for this URI
Otherwise returns absolute file system path for URI
Examples
--------
>>> docwriter = ApiDocWriter('sphinx')
>>> import sphinx
>>> modpath = sphinx.__path__[0]
>>> res = docwriter._uri2path('sphinx.builder')
>>> res == os.path.join(modpath, 'builder.py')
True
>>> res = docwriter._uri2path('sphinx')
>>> res == os.path.join(modpath, '__init__.py')
True
>>> docwriter._uri2path('sphinx.does_not_exist')
'''
if uri == self.package_name:
return os.path.join(self.root_path, '__init__.py')
path = uri.replace('.', os.path.sep)
path = path.replace(self.package_name + os.path.sep, '')
path = os.path.join(self.root_path, path)
# XXX maybe check for extensions as well?
if os.path.exists(path + '.py'): # file
path += '.py'
elif os.path.exists(os.path.join(path, '__init__.py')):
path = os.path.join(path, '__init__.py')
else:
return None
return path
def _path2uri(self, dirpath):
''' Convert directory path to uri '''
relpath = dirpath.replace(self.root_path, self.package_name)
if relpath.startswith(os.path.sep):
relpath = relpath[1:]
return relpath.replace(os.path.sep, '.')
def _parse_module(self, uri):
''' Parse module defined in *uri* '''
filename = self._uri2path(uri)
if filename is None:
# nothing that we could handle here.
return ([],[])
f = open(filename, 'rt')
functions, classes = self._parse_lines(f)
f.close()
return functions, classes
def _parse_lines(self, linesource):
''' Parse lines of text for functions and classes '''
functions = []
classes = []
for line in linesource:
if line.startswith('def ') and line.count('('):
# exclude private stuff
name = self._get_object_name(line)
if not name.startswith('_'):
functions.append(name)
elif line.startswith('class '):
# exclude private stuff
name = self._get_object_name(line)
if not name.startswith('_'):
classes.append(name)
else:
pass
functions.sort()
classes.sort()
return functions, classes
def generate_api_doc(self, uri):
'''Make autodoc documentation template string for a module
Parameters
----------
uri : string
python location of module - e.g 'sphinx.builder'
Returns
-------
S : string
Contents of API doc
'''
# get the names of all classes and functions
functions, classes = self._parse_module(uri)
if not len(functions) and not len(classes):
print('WARNING: Empty -',uri) # dbg
return ''
# Make a shorter version of the uri that omits the package name for
# titles
uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)
ad = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
chap_title = uri_short
ad += (chap_title+'\n'+ self.rst_section_levels[1] * len(chap_title)
+ '\n\n')
# Set the chapter title to read 'module' for all modules except for the
# main packages
if '.' in uri:
title = 'Module: :mod:`' + uri_short + '`'
else:
title = ':mod:`' + uri_short + '`'
ad += title + '\n' + self.rst_section_levels[2] * len(title)
if len(classes):
ad += '\nInheritance diagram for ``%s``:\n\n' % uri
ad += '.. inheritance-diagram:: %s \n' % uri
ad += ' :parts: 3\n'
ad += '\n.. automodule:: ' + uri + '\n'
ad += '\n.. currentmodule:: ' + uri + '\n'
multi_class = len(classes) > 1
multi_fx = len(functions) > 1
if multi_class:
ad += '\n' + 'Classes' + '\n' + \
self.rst_section_levels[2] * 7 + '\n'
elif len(classes) and multi_fx:
ad += '\n' + 'Class' + '\n' + \
self.rst_section_levels[2] * 5 + '\n'
for c in classes:
ad += '\n:class:`' + c + '`\n' \
+ self.rst_section_levels[multi_class + 2 ] * \
(len(c)+9) + '\n\n'
ad += '\n.. autoclass:: ' + c + '\n'
# must NOT exclude from index to keep cross-refs working
ad += ' :members:\n' \
' :undoc-members:\n' \
' :show-inheritance:\n' \
' :inherited-members:\n' \
'\n' \
' .. automethod:: __init__\n'
if multi_fx:
ad += '\n' + 'Functions' + '\n' + \
self.rst_section_levels[2] * 9 + '\n\n'
elif len(functions) and multi_class:
ad += '\n' + 'Function' + '\n' + \
self.rst_section_levels[2] * 8 + '\n\n'
for f in functions:
# must NOT exclude from index to keep cross-refs working
ad += '\n.. autofunction:: ' + uri + '.' + f + '\n\n'
return ad
def _survives_exclude(self, matchstr, match_type):
''' Returns True if *matchstr* does not match patterns
``self.package_name`` removed from front of string if present
Examples
--------
>>> dw = ApiDocWriter('sphinx')
>>> dw._survives_exclude('sphinx.okpkg', 'package')
True
>>> dw.package_skip_patterns.append('^\\.badpkg$')
>>> dw._survives_exclude('sphinx.badpkg', 'package')
False
>>> dw._survives_exclude('sphinx.badpkg', 'module')
True
>>> dw._survives_exclude('sphinx.badmod', 'module')
True
>>> dw.module_skip_patterns.append('^\\.badmod$')
>>> dw._survives_exclude('sphinx.badmod', 'module')
False
'''
if match_type == 'module':
patterns = self.module_skip_patterns
elif match_type == 'package':
patterns = self.package_skip_patterns
else:
raise ValueError('Cannot interpret match type "%s"'
% match_type)
# Match to URI without package name
L = len(self.package_name)
if matchstr[:L] == self.package_name:
matchstr = matchstr[L:]
for pat in patterns:
try:
pat.search
except AttributeError:
pat = re.compile(pat)
if pat.search(matchstr):
return False
return True
def discover_modules(self):
''' Return module sequence discovered from ``self.package_name``
Parameters
----------
None
Returns
-------
mods : sequence
Sequence of module names within ``self.package_name``
Examples
--------
>>> dw = ApiDocWriter('sphinx')
>>> mods = dw.discover_modules()
>>> 'sphinx.util' in mods
True
>>> dw.package_skip_patterns.append('\.util$')
>>> 'sphinx.util' in dw.discover_modules()
False
>>>
'''
modules = [self.package_name]
# raw directory parsing
for dirpath, dirnames, filenames in os.walk(self.root_path):
# Check directory names for packages
root_uri = self._path2uri(os.path.join(self.root_path,
dirpath))
for dirname in dirnames[:]: # copy list - we modify inplace
package_uri = '.'.join((root_uri, dirname))
if (self._uri2path(package_uri) and
self._survives_exclude(package_uri, 'package')):
modules.append(package_uri)
else:
dirnames.remove(dirname)
# Check filenames for modules
for filename in filenames:
module_name = filename[:-3]
module_uri = '.'.join((root_uri, module_name))
if (self._uri2path(module_uri) and
self._survives_exclude(module_uri, 'module')):
modules.append(module_uri)
return sorted(modules)
def write_modules_api(self, modules,outdir):
# write the list
written_modules = []
for m in modules:
api_str = self.generate_api_doc(m)
if not api_str:
continue
# write out to file
outfile = os.path.join(outdir,
m + self.rst_extension)
fileobj = open(outfile, 'wt')
fileobj.write(api_str)
fileobj.close()
written_modules.append(m)
self.written_modules = written_modules
def write_api_docs(self, outdir):
"""Generate API reST files.
Parameters
----------
outdir : string
Directory name in which to store files
We create automatic filenames for each module
Returns
-------
None
Notes
-----
Sets self.written_modules to list of written modules
"""
if not os.path.exists(outdir):
os.mkdir(outdir)
# compose list of modules
modules = self.discover_modules()
self.write_modules_api(modules,outdir)
def write_index(self, outdir, froot='gen', relative_to=None):
"""Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : string, optional
root (filename without extension) of filename to write to
Defaults to 'gen'. We add ``self.rst_extension``.
relative_to : string
path to which written filenames are relative. This
component of the written file path will be removed from
outdir, in the generated index. Default is None, meaning,
leave path as it is.
"""
if self.written_modules is None:
raise ValueError('No modules written')
# Get full filename path
path = os.path.join(outdir, froot+self.rst_extension)
# Path written into index is relative to rootpath
if relative_to is not None:
relpath = outdir.replace(relative_to + os.path.sep, '')
else:
relpath = outdir
idx = open(path,'wt')
w = idx.write
w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
w('.. toctree::\n\n')
for f in self.written_modules:
w(' %s\n' % os.path.join(relpath,f))
idx.close()

View File

@ -0,0 +1,497 @@
"""Extract reference documentation from the NumPy source tree.
"""
import inspect
import textwrap
import re
import pydoc
from io import StringIO
from warnings import warn
4
class Reader:
"""A line-based string reader.
"""
def __init__(self, data):
"""
Parameters
----------
data : str
String with lines separated by '\n'.
"""
if isinstance(data,list):
self._str = data
else:
self._str = data.split('\n') # store string as list of lines
self.reset()
def __getitem__(self, n):
return self._str[n]
def reset(self):
self._l = 0 # current line nr
def read(self):
if not self.eof():
out = self[self._l]
self._l += 1
return out
else:
return ''
def seek_next_non_empty_line(self):
for l in self[self._l:]:
if l.strip():
break
else:
self._l += 1
def eof(self):
return self._l >= len(self._str)
def read_to_condition(self, condition_func):
start = self._l
for line in self[start:]:
if condition_func(line):
return self[start:self._l]
self._l += 1
if self.eof():
return self[start:self._l+1]
return []
def read_to_next_empty_line(self):
self.seek_next_non_empty_line()
def is_empty(line):
return not line.strip()
return self.read_to_condition(is_empty)
def read_to_next_unindented_line(self):
def is_unindented(line):
return (line.strip() and (len(line.lstrip()) == len(line)))
return self.read_to_condition(is_unindented)
def peek(self,n=0):
if self._l + n < len(self._str):
return self[self._l + n]
else:
return ''
def is_empty(self):
return not ''.join(self._str).strip()
class NumpyDocString:
def __init__(self,docstring):
docstring = textwrap.dedent(docstring).split('\n')
self._doc = Reader(docstring)
self._parsed_data = {
'Signature': '',
'Summary': [''],
'Extended Summary': [],
'Parameters': [],
'Returns': [],
'Raises': [],
'Warns': [],
'Other Parameters': [],
'Attributes': [],
'Methods': [],
'See Also': [],
'Notes': [],
'Warnings': [],
'References': '',
'Examples': '',
'index': {}
}
self._parse()
def __getitem__(self,key):
return self._parsed_data[key]
def __setitem__(self,key,val):
if key not in self._parsed_data:
warn("Unknown section %s" % key)
else:
self._parsed_data[key] = val
def _is_at_section(self):
self._doc.seek_next_non_empty_line()
if self._doc.eof():
return False
l1 = self._doc.peek().strip() # e.g. Parameters
if l1.startswith('.. index::'):
return True
l2 = self._doc.peek(1).strip() # ---------- or ==========
return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1))
def _strip(self,doc):
i = 0
j = 0
for i,line in enumerate(doc):
if line.strip(): break
for j,line in enumerate(doc[::-1]):
if line.strip(): break
return doc[i:len(doc)-j]
def _read_to_next_section(self):
section = self._doc.read_to_next_empty_line()
while not self._is_at_section() and not self._doc.eof():
if not self._doc.peek(-1).strip(): # previous line was empty
section += ['']
section += self._doc.read_to_next_empty_line()
return section
def _read_sections(self):
while not self._doc.eof():
data = self._read_to_next_section()
name = data[0].strip()
if name.startswith('..'): # index section
yield name, data[1:]
elif len(data) < 2:
yield StopIteration
else:
yield name, self._strip(data[2:])
def _parse_param_list(self,content):
r = Reader(content)
params = []
while not r.eof():
header = r.read().strip()
if ' : ' in header:
arg_name, arg_type = header.split(' : ')[:2]
else:
arg_name, arg_type = header, ''
desc = r.read_to_next_unindented_line()
desc = dedent_lines(desc)
params.append((arg_name,arg_type,desc))
return params
_name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
def _parse_see_also(self, content):
"""
func_name : Descriptive text
continued text
another_func_name : Descriptive text
func_name1, func_name2, :meth:`func_name`, func_name3
"""
items = []
def parse_item_name(text):
"""Match ':role:`name`' or 'name'"""
m = self._name_rgx.match(text)
if m:
g = m.groups()
if g[1] is None:
return g[3], None
else:
return g[2], g[1]
raise ValueError("%s is not a item name" % text)
def push_item(name, rest):
if not name:
return
name, role = parse_item_name(name)
items.append((name, list(rest), role))
del rest[:]
current_func = None
rest = []
for line in content:
if not line.strip(): continue
m = self._name_rgx.match(line)
if m and line[m.end():].strip().startswith(':'):
push_item(current_func, rest)
current_func, line = line[:m.end()], line[m.end():]
rest = [line.split(':', 1)[1].strip()]
if not rest[0]:
rest = []
elif not line.startswith(' '):
push_item(current_func, rest)
current_func = None
if ',' in line:
for func in line.split(','):
push_item(func, [])
elif line.strip():
current_func = line
elif current_func is not None:
rest.append(line.strip())
push_item(current_func, rest)
return items
def _parse_index(self, section, content):
"""
.. index: default
:refguide: something, else, and more
"""
def strip_each_in(lst):
return [s.strip() for s in lst]
out = {}
section = section.split('::')
if len(section) > 1:
out['default'] = strip_each_in(section[1].split(','))[0]
for line in content:
line = line.split(':')
if len(line) > 2:
out[line[1]] = strip_each_in(line[2].split(','))
return out
def _parse_summary(self):
"""Grab signature (if given) and summary"""
if self._is_at_section():
return
summary = self._doc.read_to_next_empty_line()
summary_str = " ".join([s.strip() for s in summary]).strip()
if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
self['Signature'] = summary_str
if not self._is_at_section():
self['Summary'] = self._doc.read_to_next_empty_line()
else:
self['Summary'] = summary
if not self._is_at_section():
self['Extended Summary'] = self._read_to_next_section()
def _parse(self):
self._doc.reset()
self._parse_summary()
for (section,content) in self._read_sections():
if not section.startswith('..'):
section = ' '.join([s.capitalize() for s in section.split(' ')])
if section in ('Parameters', 'Attributes', 'Methods',
'Returns', 'Raises', 'Warns'):
self[section] = self._parse_param_list(content)
elif section.startswith('.. index::'):
self['index'] = self._parse_index(section, content)
elif section == 'See Also':
self['See Also'] = self._parse_see_also(content)
else:
self[section] = content
# string conversion routines
def _str_header(self, name, symbol='-'):
return [name, len(name)*symbol]
def _str_indent(self, doc, indent=4):
out = []
for line in doc:
out += [' '*indent + line]
return out
def _str_signature(self):
if self['Signature']:
return [self['Signature'].replace('*','\*')] + ['']
else:
return ['']
def _str_summary(self):
if self['Summary']:
return self['Summary'] + ['']
else:
return []
def _str_extended_summary(self):
if self['Extended Summary']:
return self['Extended Summary'] + ['']
else:
return []
def _str_param_list(self, name):
out = []
if self[name]:
out += self._str_header(name)
for param,param_type,desc in self[name]:
out += ['%s : %s' % (param, param_type)]
out += self._str_indent(desc)
out += ['']
return out
def _str_section(self, name):
out = []
if self[name]:
out += self._str_header(name)
out += self[name]
out += ['']
return out
def _str_see_also(self, func_role):
if not self['See Also']: return []
out = []
out += self._str_header("See Also")
last_had_desc = True
for func, desc, role in self['See Also']:
if role:
link = ':%s:`%s`' % (role, func)
elif func_role:
link = ':%s:`%s`' % (func_role, func)
else:
link = "`%s`_" % func
if desc or last_had_desc:
out += ['']
out += [link]
else:
out[-1] += ", %s" % link
if desc:
out += self._str_indent([' '.join(desc)])
last_had_desc = True
else:
last_had_desc = False
out += ['']
return out
def _str_index(self):
idx = self['index']
out = []
out += ['.. index:: %s' % idx.get('default','')]
for section, references in idx.items():
if section == 'default':
continue
out += [' :%s: %s' % (section, ', '.join(references))]
return out
def __str__(self, func_role=''):
out = []
out += self._str_signature()
out += self._str_summary()
out += self._str_extended_summary()
for param_list in ('Parameters','Returns','Raises'):
out += self._str_param_list(param_list)
out += self._str_section('Warnings')
out += self._str_see_also(func_role)
for s in ('Notes','References','Examples'):
out += self._str_section(s)
out += self._str_index()
return '\n'.join(out)
def indent(str,indent=4):
indent_str = ' '*indent
if str is None:
return indent_str
lines = str.split('\n')
return '\n'.join(indent_str + l for l in lines)
def dedent_lines(lines):
"""Deindent a list of lines maximally"""
return textwrap.dedent("\n".join(lines)).split("\n")
def header(text, style='-'):
return text + '\n' + style*len(text) + '\n'
class FunctionDoc(NumpyDocString):
def __init__(self, func, role='func', doc=None):
self._f = func
self._role = role # e.g. "func" or "meth"
if doc is None:
doc = inspect.getdoc(func) or ''
try:
NumpyDocString.__init__(self, doc)
except ValueError as e:
print('*'*78)
print("ERROR: '%s' while parsing `%s`" % (e, self._f))
print('*'*78)
#print "Docstring follows:"
#print doclines
#print '='*78
if not self['Signature']:
func, func_name = self.get_func()
try:
# try to read signature
argspec = inspect.getargspec(func)
argspec = inspect.formatargspec(*argspec)
argspec = argspec.replace('*','\*')
signature = '%s%s' % (func_name, argspec)
except TypeError as e:
signature = '%s()' % func_name
self['Signature'] = signature
def get_func(self):
func_name = getattr(self._f, '__name__', self.__class__.__name__)
if inspect.isclass(self._f):
func = getattr(self._f, '__call__', self._f.__init__)
else:
func = self._f
return func, func_name
def __str__(self):
out = ''
func, func_name = self.get_func()
signature = self['Signature'].replace('*', '\*')
roles = {'func': 'function',
'meth': 'method'}
if self._role:
if self._role not in roles:
print("Warning: invalid role %s" % self._role)
out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''),
func_name)
out += super(FunctionDoc, self).__str__(func_role=self._role)
return out
class ClassDoc(NumpyDocString):
def __init__(self,cls,modulename='',func_doc=FunctionDoc,doc=None):
if not inspect.isclass(cls):
raise ValueError("Initialise using a class. Got %r" % cls)
self._cls = cls
if modulename and not modulename.endswith('.'):
modulename += '.'
self._mod = modulename
self._name = cls.__name__
self._func_doc = func_doc
if doc is None:
doc = pydoc.getdoc(cls)
NumpyDocString.__init__(self, doc)
@property
def methods(self):
return [name for name,func in inspect.getmembers(self._cls)
if not name.startswith('_') and callable(func)]
def __str__(self):
out = ''
out += super(ClassDoc, self).__str__()
out += "\n\n"
#for m in self.methods:
# print "Parsing `%s`" % m
# out += str(self._func_doc(getattr(self._cls,m), 'meth')) + '\n\n'
# out += '.. index::\n single: %s; %s\n\n' % (self._name, m)
return out

View File

@ -0,0 +1,136 @@
import re, inspect, textwrap, pydoc
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):
return [':' + name + ':']
def _str_indent(self, doc, indent=4):
out = []
for line in doc:
out += [' '*indent + line]
return out
def _str_signature(self):
return ['']
if self['Signature']:
return ['``%s``' % self['Signature']] + ['']
else:
return ['']
def _str_summary(self):
return self['Summary'] + ['']
def _str_extended_summary(self):
return self['Extended Summary'] + ['']
def _str_param_list(self, name):
out = []
if self[name]:
out += self._str_field_list(name)
out += ['']
for param,param_type,desc in self[name]:
out += self._str_indent(['**%s** : %s' % (param.strip(),
param_type)])
out += ['']
out += self._str_indent(desc,8)
out += ['']
return out
def _str_section(self, name):
out = []
if self[name]:
out += self._str_header(name)
out += ['']
content = textwrap.dedent("\n".join(self[name])).split("\n")
out += content
out += ['']
return out
def _str_see_also(self, func_role):
out = []
if self['See Also']:
see_also = super(SphinxDocString, self)._str_see_also(func_role)
out = ['.. seealso::', '']
out += self._str_indent(see_also[2:])
return out
def _str_warnings(self):
out = []
if self['Warnings']:
out = ['.. warning::', '']
out += self._str_indent(self['Warnings'])
return out
def _str_index(self):
idx = self['index']
out = []
if len(idx) == 0:
return out
out += ['.. index:: %s' % idx.get('default','')]
for section, references in idx.items():
if section == 'default':
continue
elif section == 'refguide':
out += [' single: %s' % (', '.join(references))]
else:
out += [' %s: %s' % (section, ','.join(references))]
return out
def _str_references(self):
out = []
if self['References']:
out += self._str_header('References')
if isinstance(self['References'], str):
self['References'] = [self['References']]
out.extend(self['References'])
out += ['']
return out
def __str__(self, indent=0, func_role="obj"):
out = []
out += self._str_signature()
out += self._str_index() + ['']
out += self._str_summary()
out += self._str_extended_summary()
for param_list in ('Parameters', 'Attributes', 'Methods',
'Returns','Raises'):
out += self._str_param_list(param_list)
out += self._str_warnings()
out += self._str_see_also(func_role)
out += self._str_section('Notes')
out += self._str_references()
out += self._str_section('Examples')
out = self._str_indent(out,indent)
return '\n'.join(out)
class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
pass
class SphinxClassDoc(SphinxDocString, ClassDoc):
pass
def get_doc_object(obj, what=None, doc=None):
if what is None:
if inspect.isclass(obj):
what = 'class'
elif inspect.ismodule(obj):
what = 'module'
elif callable(obj):
what = 'function'
else:
what = 'object'
if what == 'class':
return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)
elif what in ('function', 'method'):
return SphinxFunctionDoc(obj, '', doc=doc)
else:
if doc is None:
doc = pydoc.getdoc(obj)
return SphinxDocString(doc)

View File

@ -0,0 +1,407 @@
"""
Defines a docutils directive for inserting inheritance diagrams.
Provide the directive with one or more classes or modules (separated
by whitespace). For modules, all of the classes in that module will
be used.
Example::
Given the following classes:
class A: pass
class B(A): pass
class C(A): pass
class D(B, C): pass
class E(B): pass
.. inheritance-diagram: D E
Produces a graph like the following:
A
/ \
B C
/ \ /
E D
The graph is inserted as a PNG+image map into HTML and a PDF in
LaTeX.
"""
import inspect
import os
import re
import subprocess
try:
from hashlib import md5
except ImportError:
from md5 import md5
from docutils.nodes import Body, Element
from docutils.parsers.rst import directives
from sphinx.roles import xfileref_role
def my_import(name):
"""Module importer - taken from the python documentation.
This function allows importing names with dots in them."""
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
class DotException(Exception):
pass
class InheritanceGraph:
"""
Given a list of classes, determines the set of classes that
they inherit from all the way to the root "object", and then
is able to generate a graphviz dot graph from them.
"""
def __init__(self, class_names, show_builtins=False):
"""
*class_names* is a list of child classes to show bases from.
If *show_builtins* is True, then Python builtins will be shown
in the graph.
"""
self.class_names = class_names
self.classes = self._import_classes(class_names)
self.all_classes = self._all_classes(self.classes)
if len(self.all_classes) == 0:
raise ValueError("No classes found for inheritance diagram")
self.show_builtins = show_builtins
py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
(\w+) \s* $ # optionally arguments
''', re.VERBOSE)
def _import_class_or_module(self, name):
"""
Import a class using its fully-qualified *name*.
"""
try:
path, base = self.py_sig_re.match(name).groups()
except:
raise ValueError(
"Invalid class or module '%s' specified for inheritance diagram" % name)
fullname = (path or '') + base
path = (path and path.rstrip('.'))
if not path:
path = base
try:
module = __import__(path, None, None, [])
# We must do an import of the fully qualified name. Otherwise if a
# subpackage 'a.b' is requested where 'import a' does NOT provide
# 'a.b' automatically, then 'a.b' will not be found below. This
# second call will force the equivalent of 'import a.b' to happen
# after the top-level import above.
my_import(fullname)
except ImportError:
raise ValueError(
"Could not import class or module '%s' specified for inheritance diagram" % name)
try:
todoc = module
for comp in fullname.split('.')[1:]:
todoc = getattr(todoc, comp)
except AttributeError:
raise ValueError(
"Could not find class or module '%s' specified for inheritance diagram" % name)
# If a class, just return it
if inspect.isclass(todoc):
return [todoc]
elif inspect.ismodule(todoc):
classes = []
for cls in list(todoc.__dict__.values()):
if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
classes.append(cls)
return classes
raise ValueError(
"'%s' does not resolve to a class or module" % name)
def _import_classes(self, class_names):
"""
Import a list of classes.
"""
classes = []
for name in class_names:
classes.extend(self._import_class_or_module(name))
return classes
def _all_classes(self, classes):
"""
Return a list of all classes that are ancestors of *classes*.
"""
all_classes = {}
def recurse(cls):
all_classes[cls] = None
for c in cls.__bases__:
if c not in all_classes:
recurse(c)
for cls in classes:
recurse(cls)
return list(all_classes.keys())
def class_name(self, cls, parts=0):
"""
Given a class object, return a fully-qualified name. This
works for things I've tested in matplotlib so far, but may not
be completely general.
"""
module = cls.__module__
if module == '__builtin__':
fullname = cls.__name__
else:
fullname = "%s.%s" % (module, cls.__name__)
if parts == 0:
return fullname
name_parts = fullname.split('.')
return '.'.join(name_parts[-parts:])
def get_all_class_names(self):
"""
Get all of the class names involved in the graph.
"""
return [self.class_name(x) for x in self.all_classes]
# These are the default options for graphviz
default_graph_options = {
"rankdir": "LR",
"size": '"8.0, 12.0"'
}
default_node_options = {
"shape": "box",
"fontsize": 10,
"height": 0.25,
"fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
"style": '"setlinewidth(0.5)"'
}
default_edge_options = {
"arrowsize": 0.5,
"style": '"setlinewidth(0.5)"'
}
def _format_node_options(self, options):
return ','.join(["%s=%s" % x for x in list(options.items())])
def _format_graph_options(self, options):
return ''.join(["%s=%s;\n" % x for x in list(options.items())])
def generate_dot(self, fd, name, parts=0, urls={},
graph_options={}, node_options={},
edge_options={}):
"""
Generate a graphviz dot graph from the classes that
were passed in to __init__.
*fd* is a Python file-like object to write to.
*name* is the name of the graph
*urls* is a dictionary mapping class names to http urls
*graph_options*, *node_options*, *edge_options* are
dictionaries containing key/value pairs to pass on as graphviz
properties.
"""
g_options = self.default_graph_options.copy()
g_options.update(graph_options)
n_options = self.default_node_options.copy()
n_options.update(node_options)
e_options = self.default_edge_options.copy()
e_options.update(edge_options)
fd.write('digraph %s {\n' % name)
fd.write(self._format_graph_options(g_options))
for cls in self.all_classes:
if not self.show_builtins and cls in list(__builtins__.values()):
continue
name = self.class_name(cls, parts)
# Write the node
this_node_options = n_options.copy()
url = urls.get(self.class_name(cls))
if url is not None:
this_node_options['URL'] = '"%s"' % url
fd.write(' "%s" [%s];\n' %
(name, self._format_node_options(this_node_options)))
# Write the edges
for base in cls.__bases__:
if not self.show_builtins and base in list(__builtins__.values()):
continue
base_name = self.class_name(base, parts)
fd.write(' "%s" -> "%s" [%s];\n' %
(base_name, name,
self._format_node_options(e_options)))
fd.write('}\n')
def run_dot(self, args, name, parts=0, urls={},
graph_options={}, node_options={}, edge_options={}):
"""
Run graphviz 'dot' over this graph, returning whatever 'dot'
writes to stdout.
*args* will be passed along as commandline arguments.
*name* is the name of the graph
*urls* is a dictionary mapping class names to http urls
Raises DotException for any of the many os and
installation-related errors that may occur.
"""
try:
dot = subprocess.Popen(['dot'] + list(args),
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
close_fds=True)
except OSError:
raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
except ValueError:
raise DotException("'dot' called with invalid arguments")
except:
raise DotException("Unexpected error calling 'dot'")
self.generate_dot(dot.stdin, name, parts, urls, graph_options,
node_options, edge_options)
dot.stdin.close()
result = dot.stdout.read()
returncode = dot.wait()
if returncode != 0:
raise DotException("'dot' returned the errorcode %d" % returncode)
return result
class inheritance_diagram(Body, Element):
"""
A docutils node to use as a placeholder for the inheritance
diagram.
"""
pass
def inheritance_diagram_directive(name, arguments, options, content, lineno,
content_offset, block_text, state,
state_machine):
"""
Run when the inheritance_diagram directive is first encountered.
"""
node = inheritance_diagram()
class_names = arguments
# Create a graph starting with the list of classes
graph = InheritanceGraph(class_names)
# Create xref nodes for each target of the graph's image map and
# add them to the doc tree so that Sphinx can resolve the
# references to real URLs later. These nodes will eventually be
# removed from the doctree after we're done with them.
for name in graph.get_all_class_names():
refnodes, x = xfileref_role(
'class', ':class:`%s`' % name, name, 0, state)
node.extend(refnodes)
# Store the graph object so we can use it to generate the
# dot file later
node['graph'] = graph
# Store the original content for use as a hash
node['parts'] = options.get('parts', 0)
node['content'] = " ".join(class_names)
return [node]
def get_graph_hash(node):
return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
def html_output_graph(self, node):
"""
Output the graph for HTML. This will insert a PNG with clickable
image map.
"""
graph = node['graph']
parts = node['parts']
graph_hash = get_graph_hash(node)
name = "inheritance%s" % graph_hash
path = '_images'
dest_path = os.path.join(setup.app.builder.outdir, path)
if not os.path.exists(dest_path):
os.makedirs(dest_path)
png_path = os.path.join(dest_path, name + ".png")
path = setup.app.builder.imgpath
# Create a mapping from fully-qualified class names to URLs.
urls = {}
for child in node:
if child.get('refuri') is not None:
urls[child['reftitle']] = child.get('refuri')
elif child.get('refid') is not None:
urls[child['reftitle']] = '#' + child.get('refid')
# These arguments to dot will save a PNG file to disk and write
# an HTML image map to stdout.
image_map = graph.run_dot(['-Tpng', '-o%s' % png_path, '-Tcmapx'],
name, parts, urls)
return ('<img src="%s/%s.png" usemap="#%s" class="inheritance"/>%s' %
(path, name, name, image_map))
def latex_output_graph(self, node):
"""
Output the graph for LaTeX. This will insert a PDF.
"""
graph = node['graph']
parts = node['parts']
graph_hash = get_graph_hash(node)
name = "inheritance%s" % graph_hash
dest_path = os.path.abspath(os.path.join(setup.app.builder.outdir, '_images'))
if not os.path.exists(dest_path):
os.makedirs(dest_path)
pdf_path = os.path.abspath(os.path.join(dest_path, name + ".pdf"))
graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
name, parts, graph_options={'size': '"6.0,6.0"'})
return '\n\\includegraphics{%s}\n\n' % pdf_path
def visit_inheritance_diagram(inner_func):
"""
This is just a wrapper around html/latex_output_graph to make it
easier to handle errors and insert warnings.
"""
def visitor(self, node):
try:
content = inner_func(self, node)
except DotException as e:
# Insert the exception as a warning in the document
warning = self.document.reporter.warning(str(e), line=node.line)
warning.parent = node
node.children = [warning]
else:
source = self.document.attributes['source']
self.body.append(content)
node.children = []
return visitor
def do_nothing(self, node):
pass
def setup(app):
setup.app = app
setup.confdir = app.confdir
app.add_node(
inheritance_diagram,
latex=(visit_inheritance_diagram(latex_output_graph), do_nothing),
html=(visit_inheritance_diagram(html_output_graph), do_nothing))
app.add_directive(
'inheritance-diagram', inheritance_diagram_directive,
False, (1, 100, 0), parts = directives.nonnegative_int)

View File

@ -0,0 +1,114 @@
"""reST directive for syntax-highlighting ipython interactive sessions.
XXX - See what improvements can be made based on the new (as of Sept 2009)
'pycon' lexer for the python console. At the very least it will give better
highlighted tracebacks.
"""
#-----------------------------------------------------------------------------
# Needed modules
# Standard library
import re
# Third party
from pygments.lexer import Lexer, do_insertions
from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
PythonTracebackLexer)
from pygments.token import Comment, Generic
from sphinx import highlighting
#-----------------------------------------------------------------------------
# Global constants
line_re = re.compile('.*?\n')
#-----------------------------------------------------------------------------
# Code begins - classes and functions
class IPythonConsoleLexer(Lexer):
"""
For IPython console output or doctests, such as:
.. sourcecode:: ipython
In [1]: a = 'foo'
In [2]: a
Out[2]: 'foo'
In [3]: print a
foo
In [4]: 1 / 0
Notes:
- Tracebacks are not currently supported.
- It assumes the default IPython prompts, not customized ones.
"""
name = 'IPython console session'
aliases = ['ipython']
mimetypes = ['text/x-ipython-console']
input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
continue_prompt = re.compile(" \.\.\.+:")
tb_start = re.compile("\-+")
def get_tokens_unprocessed(self, text):
pylexer = PythonLexer(**self.options)
tblexer = PythonTracebackLexer(**self.options)
curcode = ''
insertions = []
for match in line_re.finditer(text):
line = match.group()
input_prompt = self.input_prompt.match(line)
continue_prompt = self.continue_prompt.match(line.rstrip())
output_prompt = self.output_prompt.match(line)
if line.startswith("#"):
insertions.append((len(curcode),
[(0, Comment, line)]))
elif input_prompt is not None:
insertions.append((len(curcode),
[(0, Generic.Prompt, input_prompt.group())]))
curcode += line[input_prompt.end():]
elif continue_prompt is not None:
insertions.append((len(curcode),
[(0, Generic.Prompt, continue_prompt.group())]))
curcode += line[continue_prompt.end():]
elif output_prompt is not None:
# Use the 'error' token for output. We should probably make
# our own token, but error is typicaly in a bright color like
# red, so it works fine for our output prompts.
insertions.append((len(curcode),
[(0, Generic.Error, output_prompt.group())]))
curcode += line[output_prompt.end():]
else:
if curcode:
for item in do_insertions(insertions,
pylexer.get_tokens_unprocessed(curcode)):
yield item
curcode = ''
insertions = []
yield match.start(), Generic.Output, line
if curcode:
for item in do_insertions(insertions,
pylexer.get_tokens_unprocessed(curcode)):
yield item
def setup(app):
"""Setup as a sphinx extension."""
# This is only a lexer, so adding it below to pygments appears sufficient.
# But if somebody knows that the right API usage should be to do that via
# sphinx, by all means fix it here. At least having this setup.py
# suppresses the sphinx warning we'd get without it.
pass
#-----------------------------------------------------------------------------
# Register the extension as a valid pygments lexer
highlighting.lexers['ipython'] = IPythonConsoleLexer()

View File

@ -0,0 +1,116 @@
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.
.. [1] http://projects.scipy.org/scipy/numpy/wiki/CodingStyleGuidelines#docstring-standard
"""
import os, re, pydoc
from docscrape_sphinx import get_doc_object, SphinxDocString
import inspect
def mangle_docstrings(app, what, name, obj, options, lines,
reference_offset=[0]):
if what == 'module':
# Strip top title
title_re = re.compile(r'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*',
re.I|re.S)
lines[:] = title_re.sub('', "\n".join(lines)).split("\n")
else:
doc = get_doc_object(obj, what, "\n".join(lines))
lines[:] = str(doc).split("\n")
if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \
obj.__name__:
if hasattr(obj, '__module__'):
v = dict(full_name="%s.%s" % (obj.__module__, obj.__name__))
else:
v = dict(full_name=obj.__name__)
lines += ['', '.. htmlonly::', '']
lines += [' %s' % x for x in
(app.config.numpydoc_edit_link % v).split("\n")]
# replace reference numbers so that there are no duplicates
references = []
for l in lines:
l = l.strip()
if l.startswith('.. ['):
try:
references.append(int(l[len('.. ['):l.index(']')]))
except ValueError:
print("WARNING: invalid reference in %s docstring" % name)
# Start renaming from the biggest number, otherwise we may
# overwrite references.
references.sort()
if references:
for i, line in enumerate(lines):
for r in references:
new_r = reference_offset[0] + r
lines[i] = lines[i].replace('[%d]_' % r,
'[%d]_' % new_r)
lines[i] = lines[i].replace('.. [%d]' % r,
'.. [%d]' % new_r)
reference_offset[0] += len(references)
def mangle_signature(app, what, name, obj, options, sig, retann):
# Do not try to inspect classes that don't define `__init__`
if (inspect.isclass(obj) and
'initializes x; see ' in pydoc.getdoc(obj.__init__)):
return '', ''
if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return
if not hasattr(obj, '__doc__'): return
doc = SphinxDocString(pydoc.getdoc(obj))
if doc['Signature']:
sig = re.sub("^[^(]*", "", doc['Signature'])
return sig, ''
def initialize(app):
try:
app.connect('autodoc-process-signature', mangle_signature)
except:
monkeypatch_sphinx_ext_autodoc()
def setup(app, get_doc_object_=get_doc_object):
global get_doc_object
get_doc_object = get_doc_object_
app.connect('autodoc-process-docstring', mangle_docstrings)
app.connect('builder-inited', initialize)
app.add_config_value('numpydoc_edit_link', None, True)
#------------------------------------------------------------------------------
# Monkeypatch sphinx.ext.autodoc to accept argspecless autodocs (Sphinx < 0.5)
#------------------------------------------------------------------------------
def monkeypatch_sphinx_ext_autodoc():
global _original_format_signature
import sphinx.ext.autodoc
if sphinx.ext.autodoc.format_signature is our_format_signature:
return
print("[numpydoc] Monkeypatching sphinx.ext.autodoc ...")
_original_format_signature = sphinx.ext.autodoc.format_signature
sphinx.ext.autodoc.format_signature = our_format_signature
def our_format_signature(what, obj):
r = mangle_signature(None, what, None, obj, None, None, None)
if r is not None:
return r[0]
else:
return _original_format_signature(what, obj)

View File

@ -0,0 +1,773 @@
"""
A directive for including a matplotlib plot in a Sphinx document.
By default, in HTML output, `plot` will include a .png file with a
link to a high-res .png and .pdf. In LaTeX output, it will include a
.pdf.
The source code for the plot may be included in one of three ways:
1. **A path to a source file** as the argument to the directive::
.. plot:: path/to/plot.py
When a path to a source file is given, the content of the
directive may optionally contain a caption for the plot::
.. plot:: path/to/plot.py
This is the caption for the plot
Additionally, one my specify the name of a function to call (with
no arguments) immediately after importing the module::
.. plot:: path/to/plot.py plot_function1
2. Included as **inline content** to the directive::
.. plot::
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
img = mpimg.imread('_static/stinkbug.png')
imgplot = plt.imshow(img)
3. Using **doctest** syntax::
.. plot::
A plotting example:
>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3], [4,5,6])
Options
-------
The ``plot`` directive supports the following options:
format : {'python', 'doctest'}
Specify the format of the input
include-source : bool
Whether to display the source code. The default can be changed
using the `plot_include_source` variable in conf.py
encoding : str
If this source file is in a non-UTF8 or non-ASCII encoding,
the encoding must be specified using the `:encoding:` option.
The encoding will not be inferred using the ``-*- coding -*-``
metacomment.
context : bool
If provided, the code will be run in the context of all
previous plot directives for which the `:context:` option was
specified. This only applies to inline code plot directives,
not those run from files.
nofigs : bool
If specified, the code block will be run, but no figures will
be inserted. This is usually useful with the ``:context:``
option.
Additionally, this directive supports all of the options of the
`image` directive, except for `target` (since plot will add its own
target). These include `alt`, `height`, `width`, `scale`, `align` and
`class`.
Configuration options
---------------------
The plot directive has the following configuration options:
plot_include_source
Default value for the include-source option
plot_pre_code
Code that should be executed before each plot.
plot_basedir
Base directory, to which ``plot::`` file names are relative
to. (If None or empty, file names are relative to the
directoly where the file containing the directive is.)
plot_formats
File formats to generate. List of tuples or strings::
[(suffix, dpi), suffix, ...]
that determine the file format and the DPI. For entries whose
DPI was omitted, sensible defaults are chosen.
plot_html_show_formats
Whether to show links to the files in HTML.
plot_rcparams
A dictionary containing any non-standard rcParams that should
be applied before each plot.
"""
import sys, os, glob, shutil, imp, warnings, io, re, textwrap, \
traceback, exceptions
from docutils.parsers.rst import directives
from docutils import nodes
from docutils.parsers.rst.directives.images import Image
align = Image.align
import sphinx
sphinx_version = sphinx.__version__.split(".")
# The split is necessary for sphinx beta versions where the string is
# '6b1'
sphinx_version = tuple([int(re.split('[a-z]', x)[0])
for x in sphinx_version[:2]])
try:
# Sphinx depends on either Jinja or Jinja2
import jinja2
def format_template(template, **kw):
return jinja2.Template(template).render(**kw)
except ImportError:
import jinja
def format_template(template, **kw):
return jinja.from_string(template, **kw)
import matplotlib
import matplotlib.cbook as cbook
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import _pylab_helpers
__version__ = 2
#------------------------------------------------------------------------------
# Relative pathnames
#------------------------------------------------------------------------------
# os.path.relpath is new in Python 2.6
try:
from os.path import relpath
except ImportError:
# Copied from Python 2.7
if 'posix' in sys.builtin_module_names:
def relpath(path, start=os.path.curdir):
"""Return a relative version of a path"""
from os.path import sep, curdir, join, abspath, commonprefix, \
pardir
if not path:
raise ValueError("no path specified")
start_list = abspath(start).split(sep)
path_list = abspath(path).split(sep)
# Work out how much of the filepath is shared by start and path.
i = len(commonprefix([start_list, path_list]))
rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
return curdir
return join(*rel_list)
elif 'nt' in sys.builtin_module_names:
def relpath(path, start=os.path.curdir):
"""Return a relative version of a path"""
from os.path import sep, curdir, join, abspath, commonprefix, \
pardir, splitunc
if not path:
raise ValueError("no path specified")
start_list = abspath(start).split(sep)
path_list = abspath(path).split(sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = splitunc(path)
unc_start, rest = splitunc(start)
if bool(unc_path) ^ bool(unc_start):
raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
% (path, start))
else:
raise ValueError("path is on drive %s, start on drive %s"
% (path_list[0], start_list[0]))
# Work out how much of the filepath is shared by start and path.
for i in range(min(len(start_list), len(path_list))):
if start_list[i].lower() != path_list[i].lower():
break
else:
i += 1
rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
return curdir
return join(*rel_list)
else:
raise RuntimeError("Unsupported platform (no relpath available!)")
#------------------------------------------------------------------------------
# Registration hook
#------------------------------------------------------------------------------
def plot_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return run(arguments, content, options, state_machine, state, lineno)
plot_directive.__doc__ = __doc__
def _option_boolean(arg):
if not arg or not arg.strip():
# no argument given, assume used as a flag
return True
elif arg.strip().lower() in ('no', '0', 'false'):
return False
elif arg.strip().lower() in ('yes', '1', 'true'):
return True
else:
raise ValueError('"%s" unknown boolean' % arg)
def _option_format(arg):
return directives.choice(arg, ('python', 'doctest'))
def _option_align(arg):
return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
"right"))
def mark_plot_labels(app, document):
"""
To make plots referenceable, we need to move the reference from
the "htmlonly" (or "latexonly") node to the actual figure node
itself.
"""
for name, explicit in document.nametypes.items():
if not explicit:
continue
labelid = document.nameids[name]
if labelid is None:
continue
node = document.ids[labelid]
if node.tagname in ('html_only', 'latex_only'):
for n in node:
if n.tagname == 'figure':
sectname = name
for c in n:
if c.tagname == 'caption':
sectname = c.astext()
break
node['ids'].remove(labelid)
node['names'].remove(name)
n['ids'].append(labelid)
n['names'].append(name)
document.settings.env.labels[name] = \
document.settings.env.docname, labelid, sectname
break
def setup(app):
setup.app = app
setup.config = app.config
setup.confdir = app.confdir
options = {'alt': directives.unchanged,
'height': directives.length_or_unitless,
'width': directives.length_or_percentage_or_unitless,
'scale': directives.nonnegative_int,
'align': _option_align,
'class': directives.class_option,
'include-source': _option_boolean,
'format': _option_format,
'context': directives.flag,
'nofigs': directives.flag,
'encoding': directives.encoding
}
app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
app.add_config_value('plot_pre_code', None, True)
app.add_config_value('plot_include_source', False, True)
app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
app.add_config_value('plot_basedir', None, True)
app.add_config_value('plot_html_show_formats', True, True)
app.add_config_value('plot_rcparams', {}, True)
app.connect('doctree-read', mark_plot_labels)
#------------------------------------------------------------------------------
# Doctest handling
#------------------------------------------------------------------------------
def contains_doctest(text):
try:
# check if it's valid Python as-is
compile(text, '<string>', 'exec')
return False
except SyntaxError:
pass
r = re.compile(r'^\s*>>>', re.M)
m = r.search(text)
return bool(m)
def unescape_doctest(text):
"""
Extract code from a piece of text, which contains either Python code
or doctests.
"""
if not contains_doctest(text):
return text
code = ""
for line in text.split("\n"):
m = re.match(r'^\s*(>>>|\.\.\.) (.*)$', line)
if m:
code += m.group(2) + "\n"
elif line.strip():
code += "# " + line.strip() + "\n"
else:
code += "\n"
return code
def split_code_at_show(text):
"""
Split code at plt.show()
"""
parts = []
is_doctest = contains_doctest(text)
part = []
for line in text.split("\n"):
if (not is_doctest and line.strip() == 'plt.show()') or \
(is_doctest and line.strip() == '>>> plt.show()'):
part.append(line)
parts.append("\n".join(part))
part = []
else:
part.append(line)
if "\n".join(part).strip():
parts.append("\n".join(part))
return parts
#------------------------------------------------------------------------------
# Template
#------------------------------------------------------------------------------
TEMPLATE = """
{{ source_code }}
{{ only_html }}
{% if source_link or (html_show_formats and not multi_image) %}
(
{%- if source_link -%}
`Source code <{{ source_link }}>`__
{%- endif -%}
{%- if html_show_formats and not multi_image -%}
{%- for img in images -%}
{%- for fmt in img.formats -%}
{%- if source_link or not loop.first -%}, {% endif -%}
`{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
)
{% endif %}
{% for img in images %}
.. figure:: {{ build_dir }}/{{ img.basename }}.png
{%- for option in options %}
{{ option }}
{% endfor %}
{% if html_show_formats and multi_image -%}
(
{%- for fmt in img.formats -%}
{%- if not loop.first -%}, {% endif -%}
`{{ fmt }} <{{ dest_dir }}/{{ img.basename }}.{{ fmt }}>`__
{%- endfor -%}
)
{%- endif -%}
{{ caption }}
{% endfor %}
{{ only_latex }}
{% for img in images %}
.. image:: {{ build_dir }}/{{ img.basename }}.pdf
{% endfor %}
"""
exception_template = """
.. htmlonly::
[`source code <%(linkdir)s/%(basename)s.py>`__]
Exception occurred rendering plot.
"""
# the context of the plot for all directives specified with the
# :context: option
plot_context = dict()
class ImageFile:
def __init__(self, basename, dirname):
self.basename = basename
self.dirname = dirname
self.formats = []
def filename(self, format):
return os.path.join(self.dirname, "%s.%s" % (self.basename, format))
def filenames(self):
return [self.filename(fmt) for fmt in self.formats]
def out_of_date(original, derived):
"""
Returns True if derivative is out-of-date wrt original,
both of which are full file paths.
"""
return (not os.path.exists(derived) or
(os.path.exists(original) and
os.stat(derived).st_mtime < os.stat(original).st_mtime))
class PlotError(RuntimeError):
pass
def run_code(code, code_path, ns=None, function_name=None):
"""
Import a Python module from a path, and run the function given by
name, if function_name is not None.
"""
# Change the working directory to the directory of the example, so
# it can get at its data files, if any. Add its path to sys.path
# so it can import any helper modules sitting beside it.
pwd = os.getcwd()
old_sys_path = list(sys.path)
if code_path is not None:
dirname = os.path.abspath(os.path.dirname(code_path))
os.chdir(dirname)
sys.path.insert(0, dirname)
# Redirect stdout
stdout = sys.stdout
sys.stdout = io.StringIO()
# Reset sys.argv
old_sys_argv = sys.argv
sys.argv = [code_path]
try:
try:
code = unescape_doctest(code)
if ns is None:
ns = {}
if not ns:
if setup.config.plot_pre_code is None:
exec("import numpy as np\nfrom matplotlib import pyplot as plt\n", ns)
else:
exec(setup.config.plot_pre_code, ns)
if "__main__" in code:
exec("__name__ = '__main__'", ns)
exec(code, ns)
if function_name is not None:
exec(function_name + "()", ns)
except (Exception, SystemExit) as err:
raise PlotError(traceback.format_exc())
finally:
os.chdir(pwd)
sys.argv = old_sys_argv
sys.path[:] = old_sys_path
sys.stdout = stdout
return ns
def clear_state(plot_rcparams):
plt.close('all')
matplotlib.rc_file_defaults()
matplotlib.rcParams.update(plot_rcparams)
def render_figures(code, code_path, output_dir, output_base, context,
function_name, config):
"""
Run a pyplot script and save the low and high res PNGs and a PDF
in outdir.
Save the images under *output_dir* with file names derived from
*output_base*
"""
# -- Parse format list
default_dpi = {'png': 80, 'hires.png': 200, 'pdf': 200}
formats = []
plot_formats = config.plot_formats
if isinstance(plot_formats, str):
plot_formats = eval(plot_formats)
for fmt in plot_formats:
if isinstance(fmt, str):
formats.append((fmt, default_dpi.get(fmt, 80)))
elif type(fmt) in (tuple, list) and len(fmt)==2:
formats.append((str(fmt[0]), int(fmt[1])))
else:
raise PlotError('invalid image format "%r" in plot_formats' % fmt)
# -- Try to determine if all images already exist
code_pieces = split_code_at_show(code)
# Look for single-figure output files first
# Look for single-figure output files first
all_exists = True
img = ImageFile(output_base, output_dir)
for format, dpi in formats:
if out_of_date(code_path, img.filename(format)):
all_exists = False
break
img.formats.append(format)
if all_exists:
return [(code, [img])]
# Then look for multi-figure output files
results = []
all_exists = True
for i, code_piece in enumerate(code_pieces):
images = []
for j in range(1000):
if len(code_pieces) > 1:
img = ImageFile('%s_%02d_%02d' % (output_base, i, j), output_dir)
else:
img = ImageFile('%s_%02d' % (output_base, j), output_dir)
for format, dpi in formats:
if out_of_date(code_path, img.filename(format)):
all_exists = False
break
img.formats.append(format)
# assume that if we have one, we have them all
if not all_exists:
all_exists = (j > 0)
break
images.append(img)
if not all_exists:
break
results.append((code_piece, images))
if all_exists:
return results
# We didn't find the files, so build them
results = []
if context:
ns = plot_context
else:
ns = {}
for i, code_piece in enumerate(code_pieces):
if not context:
clear_state(config.plot_rcparams)
run_code(code_piece, code_path, ns, function_name)
images = []
fig_managers = _pylab_helpers.Gcf.get_all_fig_managers()
for j, figman in enumerate(fig_managers):
if len(fig_managers) == 1 and len(code_pieces) == 1:
img = ImageFile(output_base, output_dir)
elif len(code_pieces) == 1:
img = ImageFile("%s_%02d" % (output_base, j), output_dir)
else:
img = ImageFile("%s_%02d_%02d" % (output_base, i, j),
output_dir)
images.append(img)
for format, dpi in formats:
try:
figman.canvas.figure.savefig(img.filename(format), dpi=dpi)
except Exception as err:
raise PlotError(traceback.format_exc())
img.formats.append(format)
results.append((code_piece, images))
if not context:
clear_state(config.plot_rcparams)
return results
def run(arguments, content, options, state_machine, state, lineno):
# The user may provide a filename *or* Python code content, but not both
if arguments and content:
raise RuntimeError("plot:: directive can't have both args and content")
document = state_machine.document
config = document.settings.env.config
nofigs = 'nofigs' in options
options.setdefault('include-source', config.plot_include_source)
context = 'context' in options
rst_file = document.attributes['source']
rst_dir = os.path.dirname(rst_file)
if len(arguments):
if not config.plot_basedir:
source_file_name = os.path.join(setup.app.builder.srcdir,
directives.uri(arguments[0]))
else:
source_file_name = os.path.join(setup.app.builder.srcdir, config.plot_basedir,
directives.uri(arguments[0]))
# If there is content, it will be passed as a caption.
caption = '\n'.join(content)
# If the optional function name is provided, use it
if len(arguments) == 2:
function_name = arguments[1]
else:
function_name = None
fd = open(source_file_name, 'r')
code = fd.read()
fd.close()
output_base = os.path.basename(source_file_name)
else:
source_file_name = rst_file
code = textwrap.dedent("\n".join(map(str, content)))
counter = document.attributes.get('_plot_counter', 0) + 1
document.attributes['_plot_counter'] = counter
base, ext = os.path.splitext(os.path.basename(source_file_name))
output_base = '%s-%d.py' % (base, counter)
function_name = None
caption = ''
base, source_ext = os.path.splitext(output_base)
if source_ext in ('.py', '.rst', '.txt'):
output_base = base
else:
source_ext = ''
# ensure that LaTeX includegraphics doesn't choke in foo.bar.pdf filenames
output_base = output_base.replace('.', '-')
# is it in doctest format?
is_doctest = contains_doctest(code)
if 'format' in options:
if options['format'] == 'python':
is_doctest = False
else:
is_doctest = True
# determine output directory name fragment
source_rel_name = relpath(source_file_name, setup.app.srcdir)
source_rel_dir = os.path.dirname(source_rel_name)
while source_rel_dir.startswith(os.path.sep):
source_rel_dir = source_rel_dir[1:]
# build_dir: where to place output files (temporarily)
build_dir = os.path.join(os.path.dirname(setup.app.doctreedir),
'plot_directive',
source_rel_dir)
# get rid of .. in paths, also changes pathsep
# see note in Python docs for warning about symbolic links on Windows.
# need to compare source and dest paths at end
build_dir = os.path.normpath(build_dir)
if not os.path.exists(build_dir):
os.makedirs(build_dir)
# output_dir: final location in the builder's directory
dest_dir = os.path.abspath(os.path.join(setup.app.builder.outdir,
source_rel_dir))
if not os.path.exists(dest_dir):
os.makedirs(dest_dir) # no problem here for me, but just use built-ins
# how to link to files from the RST file
dest_dir_link = os.path.join(relpath(setup.app.srcdir, rst_dir),
source_rel_dir).replace(os.path.sep, '/')
build_dir_link = relpath(build_dir, rst_dir).replace(os.path.sep, '/')
source_link = dest_dir_link + '/' + output_base + source_ext
# make figures
try:
results = render_figures(code, source_file_name, build_dir, output_base,
context, function_name, config)
errors = []
except PlotError as err:
reporter = state.memo.reporter
sm = reporter.system_message(
2, "Exception occurred in plotting %s\n from %s:\n%s" % (output_base,
source_file_name, err),
line=lineno)
results = [(code, [])]
errors = [sm]
# Properly indent the caption
caption = '\n'.join(' ' + line.strip()
for line in caption.split('\n'))
# generate output restructuredtext
total_lines = []
for j, (code_piece, images) in enumerate(results):
if options['include-source']:
if is_doctest:
lines = ['']
lines += [row.rstrip() for row in code_piece.split('\n')]
else:
lines = ['.. code-block:: python', '']
lines += [' %s' % row.rstrip()
for row in code_piece.split('\n')]
source_code = "\n".join(lines)
else:
source_code = ""
if nofigs:
images = []
opts = [':%s: %s' % (key, val) for key, val in list(options.items())
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
only_html = ".. only:: html"
only_latex = ".. only:: latex"
if j == 0:
src_link = source_link
else:
src_link = None
result = format_template(
TEMPLATE,
dest_dir=dest_dir_link,
build_dir=build_dir_link,
source_link=src_link,
multi_image=len(images) > 1,
only_html=only_html,
only_latex=only_latex,
options=opts,
images=images,
source_code=source_code,
html_show_formats=config.plot_html_show_formats,
caption=caption)
total_lines.extend(result.split("\n"))
total_lines.extend("\n")
if total_lines:
state_machine.insert_input(total_lines, source=source_file_name)
# copy image files to builder's output directory, if necessary
if not os.path.exists(dest_dir):
cbook.mkdirs(dest_dir)
for code_piece, images in results:
for img in images:
for fn in img.filenames():
destimg = os.path.join(dest_dir, os.path.basename(fn))
if fn != destimg:
shutil.copyfile(fn, destimg)
# copy script (if necessary)
#if source_file_name == rst_file:
target_name = os.path.join(dest_dir, output_base + source_ext)
f = open(target_name, 'w')
f.write(unescape_doctest(code))
f.close()
return errors

View File

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
"""
sphinxcontirb.autorun
~~~~~~~~~~~~~~~~~~~~~~
Run the code and insert stdout after the code block.
"""
import os
from subprocess import PIPE, Popen
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from sphinx.errors import SphinxError
from sphinx_autorun import version
__version__ = version.version
class RunBlockError(SphinxError):
category = 'runblock error'
class AutoRun(object):
here = os.path.abspath(__file__)
pycon = os.path.join(os.path.dirname(here), 'pycon.py')
config = {
'pycon': 'python ' + pycon,
'pycon_prefix_chars': 4,
'pycon_show_source': False,
'console': 'bash',
'console_prefix_chars': 1,
}
@classmethod
def builder_init(cls, app):
cls.config.update(app.builder.config.autorun_languages)
class RunBlock(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec = {
'linenos': directives.flag,
}
def run(self):
config = AutoRun.config
language = self.arguments[0]
if language not in config:
raise RunBlockError('Unknown language %s' % language)
# Get configuration values for the language
args = config[language].split()
input_encoding = config.get(language+'_input_encoding', 'utf8')
output_encoding = config.get(language+'_output_encoding', 'utf8')
prefix_chars = config.get(language+'_prefix_chars', 0)
show_source = config.get(language+'_show_source', True)
# Build the code text
proc = Popen(args, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=PIPE)
codelines = (line[prefix_chars:] for line in self.content)
code = u'\n'.join(codelines).encode(input_encoding)
# Run the code
stdout, stderr = proc.communicate(code)
# Process output
if stdout:
out = stdout.decode(output_encoding)
if stderr:
out = stderr.decode(output_encoding)
# Get the original code with prefixes
if show_source:
code = u'\n'.join(self.content)
code_out = u'\n'.join((code, out))
else:
code_out = out
literal = nodes.literal_block(code_out, code_out)
literal['language'] = language
literal['linenos'] = 'linenos' in self.options
return [literal]
def setup(app):
app.add_directive('runblock', RunBlock)
app.connect('builder-inited', AutoRun.builder_init)
app.add_config_value('autorun_languages', AutoRun.config, 'env')

View File

@ -0,0 +1,31 @@
import sys
from code import InteractiveInterpreter
def main():
"""
Print lines of input along with output.
"""
source_lines = (line.rstrip() for line in sys.stdin)
console = InteractiveInterpreter()
source = ''
try:
while True:
source = next(source_lines)
# Allow the user to ignore specific lines of output.
if not source.endswith('# ignore'):
print('>>>', source)
more = console.runsource(source)
while more:
next_line = next(source_lines)
print('...', next_line)
source += '\n' + next_line
more = console.runsource(source)
except StopIteration:
if more:
print('... ')
more = console.runsource(source + '\n')
if __name__ == '__main__':
main()

View File

@ -0,0 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '1.1.1'

View File

@ -0,0 +1,123 @@
import tempfile
# -*- coding: utf-8 -*-
# seems to be executed at the level of the conf.py
# so we need to link the lib at that place...
"""
"""
import os
import codecs
from os import path
from subprocess import Popen,PIPE
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from sphinx.errors import SphinxError
class TriqsExampleError(SphinxError):
category = 'triqs_example error'
class TriqsExampleRun:
#here = os.path.abspath(__file__)
#pycon = os.path.join(os.path.dirname(here),'pycon.py')
config = dict(
)
@classmethod
def builder_init(cls,app):
#cls.config.update(app.builder.config.autorun_languages)
#cls.config.update(app.builder.config.autocompile_opts)
pass
class TriqsExample(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec = {
'linenos': directives.flag,
}
def run(self):
document = self.state.document
filename = self.arguments[0]
if not document.settings.file_insertion_enabled:
return [document.reporter.warning('File insertion disabled',
line=self.lineno)]
env = document.settings.env
if filename.startswith('/') or filename.startswith(os.sep):
rel_fn = filename[1:]
else:
docdir = path.dirname(env.doc2path(env.docname, base=None))
rel_fn = path.normpath(path.join(docdir, filename))
try:
fn = path.join(env.srcdir, rel_fn)
except UnicodeDecodeError:
# the source directory is a bytestring with non-ASCII characters;
# let's try to encode the rel_fn in the file system encoding
rel_fn = rel_fn.encode(sys.getfilesystemencoding())
fn = path.join(env.srcdir, rel_fn)
encoding = self.options.get('encoding', env.config.source_encoding)
try:
f = codecs.open(fn, 'rU', encoding)
lines = f.readlines()
f.close()
except (IOError, OSError):
return [document.reporter.warning(
'Include file %r not found or reading it failed' % filename,
line=self.lineno)]
except UnicodeError:
return [document.reporter.warning(
'Encoding %r used for reading included file %r seems to '
'be wrong, try giving an :encoding: option' %
(encoding, filename))]
config = TriqsExampleRun.config
# Get configuration values for the language
input_encoding = 'utf8' #config.get(language+'_input_encoding','ascii')
output_encoding = 'utf8' #config.get(language+'_output_encoding','ascii')
show_source = True
# Build the code text
code = ''.join(lines).strip()
filename_clean = filename.rsplit('.',1)[0]
if filename_clean.startswith('./') : filename_clean = filename_clean[2:]
#print "Running the example ....",filename_clean
#print "Root ?", env.doc2path(env.docname, base=None)
import subprocess as S
error = True
try :
stdout =''
#resout = S.check_output("./example_bin/doc_%s"%(filename_clean) ,stderr=S.STDOUT,shell=True)
resout = S.check_output("./%s/doc_%s"%(docdir,filename_clean) ,stderr=S.STDOUT,shell=True)
if resout :
stdout = '---------- Result is -------\n' + resout.strip()
error = False
except S.CalledProcessError as E :
stdout ='---------- RunTime error -------\n'
stdout += E.output
# Process output
if stdout:
stdout = stdout.decode(output_encoding,'ignore')
out = ''.join(stdout).decode(output_encoding)
else:
out = '' #.join(stderr).decode(output_encoding)
# Get the original code with prefixes
code_out = '\n'.join((code,out))
if error : # report on console
print(" Error in processing ")
print(code_out)
literal = nodes.literal_block(code_out,code_out)
literal['language'] = 'c'
literal['linenos'] = 'linenos' in self.options
return [literal]
def setup(app):
app.add_directive('triqs_example', TriqsExample)
app.connect('builder-inited',TriqsExampleRun.builder_init)

52
doc/themes/triqs/layout.html vendored Normal file
View File

@ -0,0 +1,52 @@
{#
layout.html
~~~~~~~~~~~
TRIQS layout template heavily based on the sphinxdoc theme.
:copyright: Copyright 2013 by the TRIQS team.
:copyright: Copyright 2007-2013 by the Sphinx team.
:license: BSD, see LICENSE for details.
#}
{%- extends "basic/layout.html" %}
{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
{% block sidebar2 %}{% endblock %}
{% block extrahead %}
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
<script src="{{ pathto('_static/cufon-yui.js',1) }}" type="text/javascript"></script>
<script src="{{ pathto('_static/spaceman.cufonfonts.js',1) }}" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('.triqs', { fontFamily: 'spaceman', hover: true });
</script>
{{ super() }}
{%- if not embedded %}
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
{% if pagename == 'index' %}
.related { display: none; }
{% endif %}
</style>
{%- endif %}
{% endblock %}
{% block rootrellink %}
<li><a href="{{ pathto('index') }}">Home</a> &raquo;</li>
{% endblock %}
{% block header %}
<div class="pageheader">
<ul>
{% for header_link in header_links %}
<li><a href="{{ pathto(header_link[1]) }}">{{ header_link[0] }}</a></li>
{% endfor %}
</ul>
<div>
<h1 style="padding:0; margin: 10px 0 0 0;"><a class="triqs" href="{{ pathto('index') }}">{{ header_title }}</a></h1>
<span style="font-size: 14px; margin: 0px; padding: 0px;">{{ header_subtitle }}</span>
</div>
</div>
{% endblock %}

BIN
doc/themes/triqs/static/bodybg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

7
doc/themes/triqs/static/cufon-yui.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
doc/themes/triqs/static/footerbg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Some files were not shown because too many files have changed in this diff Show More