Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4f46215
include _static in doc site
zekun-shi Mar 17, 2025
41905d3
debug call graph
zekun-shi Mar 17, 2025
f803e86
add github icon link
nicktianboli Mar 18, 2025
2ba6c26
fix grid bug
nicktianboli Mar 20, 2025
c3ea90e
Create LICENSE
nicktianboli Mar 20, 2025
2aee140
Update README.md (#29)
nicktianboli Mar 20, 2025
b943e7d
update docs
nicktianboli Mar 20, 2025
d6a01a9
update cal
nicktianboli Mar 21, 2025
f000e0a
add tests
nicktianboli Mar 24, 2025
7cbec4e
fix pp
nicktianboli Mar 24, 2025
15eedf3
fix calc
nicktianboli Mar 24, 2025
0bafb68
add sharding args
nicktianboli Apr 2, 2025
8a5729b
update spmd
nicktianboli Apr 2, 2025
405c0bd
update requirement
nicktianboli Apr 4, 2025
4c72faf
update pseudopotential
nicktianboli Apr 4, 2025
5cded17
add convergence checker
nicktianboli Apr 8, 2025
53ed137
debug call graph
zekun-shi Mar 17, 2025
4a9717c
implement spin polarized
jiaxi98 Mar 27, 2025
0b62121
review
jiaxi98 Mar 28, 2025
44879d0
fix some docstrings in pw.py
jiaxi98 Mar 28, 2025
8c05fd1
debug
jiaxi98 Apr 2, 2025
d8cbbe1
debug
jiaxi98 Apr 2, 2025
004983d
fix broken link
nicktianboli Apr 8, 2025
9eb2447
implement pb
jiaxi98 Mar 17, 2025
7d9d509
update pbe
jiaxi98 Mar 18, 2025
0ea1fc8
update pbe
jiaxi98 Mar 19, 2025
dbe3ac1
update
jiaxi98 Mar 19, 2025
b1fb663
add pbe_test
zekun-shi Mar 20, 2025
1e3dc33
ad vs fft
zekun-shi Mar 20, 2025
557c06b
update
zekun-shi Mar 20, 2025
5de5f14
pbe works
jiaxi98 Mar 20, 2025
b75260c
wip
zekun-shi Mar 20, 2025
e06f7ec
wip
zekun-shi Mar 20, 2025
66cf864
wip
zekun-shi Mar 20, 2025
ef0b2d9
working
zekun-shi Mar 20, 2025
f1fe4ec
debug band
zekun-shi Mar 20, 2025
36eb1ab
add viz
zekun-shi Mar 20, 2025
df51a7e
update
zekun-shi Mar 20, 2025
6068745
update
zekun-shi Mar 21, 2025
e91b6c1
call pbe from jax_xc
zekun-shi Mar 21, 2025
f59977b
debug
zekun-shi Mar 21, 2025
c7bb989
update
zekun-shi Apr 7, 2025
379c524
debug
zekun-shi Apr 7, 2025
9b0a580
debug merge
zekun-shi Apr 9, 2025
5aaa458
debug merge
zekun-shi Apr 9, 2025
e6f0527
debug
zekun-shi Apr 9, 2025
987e3e1
remove unused files
zekun-shi Apr 9, 2025
2561c3e
update spmd
nicktianboli Apr 2, 2025
ceff90c
add convergence checker
nicktianboli Apr 8, 2025
7f433a0
parallel (spmd) for all electron
nicktianboli Apr 15, 2025
b9b7c74
[wip] correlation and polarization
zekun-shi Apr 21, 2025
2b1354f
debug
zekun-shi Apr 22, 2025
016d805
update pseudopotential
nicktianboli Apr 29, 2025
e95fcd6
update pseudo utils
nicktianboli Apr 30, 2025
3ddfadc
add simplex-projector occupation
nicktianboli Apr 30, 2025
c5c2bc9
refactor local pp
nicktianboli Jun 30, 2025
53c754b
rename ncpp files
nicktianboli Jul 11, 2025
7715039
add lda_x for test
nicktianboli Jul 11, 2025
f7af98e
fix typo
nicktianboli Jul 11, 2025
9705678
change setup.cfg
nicktianboli Jul 11, 2025
738301a
change main.py
nicktianboli Jul 11, 2025
642bfd9
change unit conversion
nicktianboli Jul 13, 2025
8da0261
add ultrasoft datacalss
nicktianboli Jul 13, 2025
0ee0a69
edit load pp
nicktianboli Jul 13, 2025
8f81aa4
remove interpolate
nicktianboli Jul 13, 2025
4a965ee
edit spherical funs
nicktianboli Jul 13, 2025
d7dda27
edit pp utils
nicktianboli Jul 13, 2025
0669204
edit beta funs
nicktianboli Jul 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
keep_files: true
201 changes: 201 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# Jrystal
A JAX-based Differentiable Density Functional Theory Framework for Materials

<div style="flex: 1; text-align: left;">
<img src="docs/images/jrystal_logo.png" alt="feature-solid" width="120"/>
</div>

[**Reference docs**](https://sail-sg.github.io/jrystal/)

## Core Features

<img src="docs/_static/images/feature-AD.png" alt="feature-AD" width="64" align="left"/>

**Differentiable:** Leveraging JAX's automatic differentiation for efficient gradient computation of quantum properties, enabling straightforward optimization workflows.

<br clear="all"/>
**Differentiable:** Leveraging JAX's automatic differentiation for efficient gradient computation of quantum properties, enabling straightforward optimization workflows. <br><br>

<img src="docs/_static/images/feature-gpu.png" alt="feature-gpu" width="64" align="left"/>

**GPU-Accelerated:** Optimized for modern GPU architectures, delivering high-performance quantum calculations with automatic hardware acceleration.

<br clear="all"/>
**GPU-Accelerated:** Optimized for modern GPU architectures, delivering high-performance quantum calculations with automatic hardware acceleration. <br><br>

<img src="docs/_static/images/feature-solid.png" alt="feature-solid" width="64" align="left"/>

**Solid-State Calculation:** Full-featured framework for periodic systems using plane wave basis sets, supporting precise electronic structure calculations of crystalline materials.

<br clear="all"/>
**Solid-State Calculation:** Full-featured framework for periodic systems using plane wave basis sets, supporting precise electronic structure calculations of crystalline materials. <br><br>

<img src="docs/_static/images/feature-total.png" alt="feature-total" width="64" align="left"/>

**Direct Optimization:** A direct minimization approach that avoids SCF iterations, enabling smooth convergence and natural integration of machine learning methods, and advanced quantum chemistry methods into density functional theory calculations.
**Direct Optimization:** A direct minimization approach that avoids SCF iterations, enabling smooth convergence and natural integration of machine learning methods, and advanced quantum chemistry methods into density functional theory calculations. <br><br>

<br clear="all"/>

## Installation

Expand Down Expand Up @@ -147,7 +146,3 @@ If you find this project useful, please cite:
## License

This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).

## Documentation

For detailed documentation, tutorials, and API reference, please visit our [documentation page](https://jrystal.readthedocs.io/).
57 changes: 37 additions & 20 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@
# Code will load the "$CRYSTAL.xyz" file in the geometry directory if
# crystal name is provided, otherwise the code will read the from the path
# specified by "crystal_file_path_path".
crystal: "si"
crystal: "diamond"
crystal_file_path_path: null
spin: 0 # number of unpaired electrons

# The directory to save the results. If None, the code will not save the results under the current directory.
save_dir: null
################################################
# Exchange-Correlation Setting #
################################################
# xc functional
xc: "lda_x"
# xc: "lda_x+lda_c_pw"
xc: "gga_x_pbe+gga_c_pbe"
# xc: "pbe"

################################################
# Pseudopotential Setting #
################################################

use_pseudopotential: False
# if false, the code will use the all-electron calculation
use_pseudopotential: true
pseudopotential_file_dir: null
# The pseudopotential file directory. If None, the code will use the default
# pseudopotential file directory.
Expand All @@ -35,23 +41,23 @@ freq_mask_method: "spherical"
# cutoff energy in Hartree
cutoff_energy: 40
# grid sizes for the FFT grid
grid_sizes: 48
grid_sizes: 32
# k grid sizes for the Brillouin zone sampling using Monkhorst-Pack scheme
k_grid_sizes: 1
k_grid_sizes: [2, 2, 2]
# Occupation method
occupation: "gamma"
# occupation support {"fermi-dirac", "gamma", "uniform"}
occupation: "simplex-projector"
# occupation support {"gamma", "uniform", "simplex-projector", "idempotent"}

# smearing factor for the Fermi-Dirac distribution
smearing: 0.0001
smearing: 0.001
# the total number of unoccupapied bands. The Total number of
# potentially-occupied bands is ceil(num_electron / 2) + empty_bands
empty_bands: 8
spin_restricted: True
empty_bands: 10
spin_restricted: true
# whether the calculation is spin_restricted or not, ie., spin-up and spin-down
# electrons share the same spatial orbitals.

# Hyperparameters for the Ewald sum.
# Hyperparameters for the Ewald sum. nm,m
ewald_args:
ewald_eta: 0.1
ewald_cutoff: 2.0e+4
Expand All @@ -63,6 +69,9 @@ epoch: 10000
optimizer: "adam"
optimizer_args:
learning_rate: 0.01
b1: 0.9
b2: 0.99
# nesterov: false

# arguments for the optimizer. Please refer to optax documentation.
# https://optax.readthedocs.io/en/latest/api/optimizers.html
Expand All @@ -74,11 +83,12 @@ optimizer_args:
scheduler: null
# optax scheduler. No scheduler is used if set to None.

convergence_condition: 1.e-8
convergence_window_size: 20
convergence_condition: 1.e-6
# Convergence criterion for optimization.
# The code monitors the variance of the objective values (e.g., energy)
# over the last 50 steps (if available). If the computed variance meets
# the convergence condition, the calculation will terminate.
# The code monitors the standard deviation of the objective values (e.g.,energy)
# over the last 50 steps (if available). If the computed standard deviation
# meets the convergence condition, the calculation will terminate.

################################################
# Band Structure Calculation Hyper-parameters. #
Expand All @@ -92,16 +102,15 @@ k_path_special_points: null
# special points for the given unit cell, as defined in ASE.
# For more details, refer to:
# https://wiki.fysik.dtu.dk/ase/ase/dft/kpoints.html

"k_path_special_points": "LGXL"
num_kpoints: 60
k_path_special_points: "LGXL"
num_kpoints: 64

# Alternatively, the user can provide a `k_path` file containing k-path
# vectors. The file must be in `.npy` format and contain a 2D array,
# where each row represents the relative coordinates of a k-point in
# reciprocal space.
k_path_file: null
band_structure_epoch: 10000
band_structure_epoch: 5000

# Flag indicating whether fine-tuning is enabled.
# If True, the optimization will start with the first k-point,
Expand All @@ -117,8 +126,16 @@ k_path_fine_tuning_epoch: 300
# Random seed
seed: 123

# Environment setting
# Jax Environment setting
xla_preallocate: True
# whether to use 64-bit precision for JAX operations
jax_enable_x64: True

# Enable the jax_debug_nans flag to automatically detect when NaNs are produced in jax.jit-compiled code
jax_debug_nans: False

# whether to print verbose output
verbose: True

# machine epsilon
eps: 1.e-08
2 changes: 1 addition & 1 deletion docs/_static/graph.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
document.addEventListener("DOMContentLoaded", function() {

fetch("/_static/graph.dot?" + new Date().getTime())
fetch("_static/graph.dot?" + new Date().getTime())
.then(function(response) {
if (!response.ok) {
throw new Error("Network response was not ok: " + response.statusText);
Expand Down
Loading