Commit 5f0f614
authored
Added model export functionality to convert trained models to Wannier90 and PythTB formats. (#300)
* feat: Add export to Wannier90 and PythTB functionality
* Add exmple for topythtb
* feat: update PythTB export functionality
* update docs
* fix towannier
* refactor: remove debug prints from load_data_for_model function
Removed multiple debug print statements that were used for troubleshooting data object attributes and transformations. The debug output was checking for cell attribute existence, data object keys, and transformation results. These temporary debugging statements are no longer needed and have been cleaned up to improve code readability.
* refactor: simplify ToWannier90 data handling and structure reconstruction
Remove complex ASE atoms reconstruction logic in _get_data_and_blocks method. Store essential data (positions, cell, atom types, symbols) as instance attributes for reuse. Simplify return values by removing structase parameter. Streamline orbital mapping and hopping collection logic in write_hr method.
* refactor: reorganize examples directory structure and notebooks
- Rename ToPythTB directory to ToW90_PythTB for clarity
- Move and update ToPythTB.ipynb with corrected paths and execution counts
- Add new ToW90_pythtb.ipynb for Wannier90 export verification
- Update .gitignore to exclude example output files (*.xyz, *.win)
* docs: add Wannier90 API example notebook
Add a new Jupyter notebook demonstrating how to export DeePTB models to Wannier90 format and validate the results by comparing band structures. The notebook includes step-by-step instructions for loading a model, exporting to _hr.dat format, and verifying correctness through PythTB interface comparison. Update the API documentation index to include the new example.
* test: Install optional pythtb dependencies for testing.
* fix: remove redundant multiplication by zero in Fermi energy subtraction
The multiplication by 0 in the Fermi energy subtraction was redundant and has been removed. This simplifies the code without changing its behavior.
* feat: refactor orbital handling and improve file resource management
- Add get_orbitals_for_type helper function to centralize orbital expansion logic
- Update load_data_for_model to use context manager for HDF5 file handling
- Refactor ToWannier90 class to use new orbital helper function
- Improve type hints with Optional for better parameter clarity
- Fix trailing whitespace in documentation file
* feat: simplify Wannier90 export interface
Remove redundant struct_path parameter from write_win and write_centres methods in ToWannier90 class. Update export entrypoint and documentation notebooks to reflect the simplified API. Also improve device handling in ToPythTB class with better default value management.
* refactor: simplify Wannier90 export method calls
Remove redundant structure file parameter from write_win and write_centres methods as it's already handled internally by the exporter. This streamlines the API and reduces parameter duplication.1 parent be2c8e8 commit 5f0f614
21 files changed
Lines changed: 2478 additions & 276 deletions
File tree
- docs
- quick_start/api
- dptb
- entrypoints
- postprocess
- bandstructure
- tests
- examples/ToW90_PythTB
- models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
446 | 496 | | |
447 | 497 | | |
448 | 498 | | |
| |||
509 | 559 | | |
510 | 560 | | |
511 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
0 commit comments