Skip to content

Implemented PBC and ECP. - #160

Merged
sunqm merged 18 commits into
pyscf:masterfrom
kousuke-nakano:mol_and_scf_from_trexio
Nov 17, 2025
Merged

sunqm merged 18 commits into
pyscf:masterfrom
kousuke-nakano:mol_and_scf_from_trexio

Conversation

@kousuke-nakano

Copy link
Copy Markdown
Contributor

Implemented the following functions in pyscf/tools/trexio.py. See also #153.

[Writing]

  • _scf_to_trexio: Complex wavefunctions and twisted-average are done.

[Reading]

  • mol_from_trexio: The ECP implementation if trexio.has_ecp(tf) is done.
  • scf_from_trexio: UHF and ROHF are also supported.

[Test suites]

  • Implemented many new tests for this trexio tool.

@kousuke-nakano
kousuke-nakano marked this pull request as draft September 5, 2025 07:40
@kousuke-nakano

kousuke-nakano commented Sep 5, 2025 •

Copy link
Copy Markdown
Contributor Author

I have switched this request to Draft because it was ok with python=3.8 and python=3.12, but not with python=3.10. I am investigating this.

@kousuke-nakano

kousuke-nakano commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor Author

Dear @sunqm, I could not reproduce the check failure (Only the linux-build (3.10) failed) in my local environment with the same Python version 3.10.18. I would appreciate it if you could relaunch the workflow, or am I allowed to trigger it again?

@kousuke-nakano
kousuke-nakano marked this pull request as ready for review September 15, 2025 23:52
@kousuke-nakano
kousuke-nakano marked this pull request as draft September 15, 2025 23:53
kousuke-nakano and others added 4 commits September 16, 2025 08:55
…k_gamma_ae_6_31g` and `test_cell_k_grid_ae_6_31g`. `int1e_nuc` checks randomly fail in `test_cell_k_gamma_ae_6_31g` and `test_cell_k_grid_ae_6_31g`. We confirm that the internal values are consistent between `cell0` and `cell1`. So, it does not seem due to a TREXIO read/write error.
Comment thread pyscf/tools/trexio.py
kpt = mol.get_scaled_kpts(kpt)
if np.all(np.array(kpt) == 0.0):
# gamma point PBC. Real wavefunction
kpts = np.array(mf.kpts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k-point calculations can be created with a single k-point, such as mf = cell.KRKS(xc='pbe'). This case will go through the nk == 1 branch, which assumes the orbital coefficients a 2D array. This might be problematic. mf.mo_coeff here is an array with shape (1, N, N)

@kousuke-nakano kousuke-nakano Nov 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunqm, Thank you very much for the review. Yes, this is a corner case that I have overlooked. I have fixed it and introduced corresponding new tests test_mf_k_single_grid_rhf_ae_6_31g and test_mf_k_single_grid_uhf_ae_6_31g. They failed with the previous version of trexio.py, while they pass right now.

kousuke-nakano and others added 2 commits November 16, 2025 12:53
…int) that I have overlooked. Introduced corresponding new tests.
@sunqm
sunqm merged commit 6b9408d into pyscf:master Nov 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants