netobs
Calculate observables from neural network-based VMC (NN-VMC).
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.8%) to scientific vocabulary
Keywords
Repository
Calculate observables from neural network-based VMC (NN-VMC).
Basic Info
Statistics
- Stars: 15
- Watchers: 4
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
NetObs
Calculate observables from neural network–based VMC (NN-VMC).
Currently, NetObs has built-in suport for FermiNet (molecular systems) and DeepSolid (solid systems). We are planning to add support for more neural network VMC frameworks, and it's also very easy to write your own adaptor to make NetObs support your network!
The currently supported observables include energy, electron density, interatomic force, stress, etc. More observables are on the way, and it is also very easy to write your own!
Installation
Clone this repository and run an editable installation:
shell
pip install -e .
Please don't forget to install the NN-VMC code and the corresponding version of JAX beforehand.
NetObs is tested with google-deepmind/ferminet@c6f9db5+jax@0.4.38 and bytedance/DeepSolid+jax@0.2.26. For more details, you can refer to our CI config.
Command Line Example
NetObs comes with a friendly command-line app, making it easy for a quick try. An example command would be:
shell
netobs @ferminet_vmc tests/data/H_atom.py @force:SWCT --with steps=20 --net-restore tests/data/H_atom.npz
A short explanation of the arguments:
@ferminet_vmcspecifies theAdaptor. The@sign is a shortcut to access built-inAdaptors,Estimators, etc.@ferminet_vmcstands for theDEFAULTobject in modulenetobs.adaptors.ferminet_vmc. Another example would bemy_module:MyAdaptor.tests/data/H_atoms.pyis a Python module or file that contains aget_configfunction. If you have a customAdaptor, it can be anything yourAdaptorrecognizes.@force:SWCTspecifies theEstimator.@force:SWCTmeans theSWCTclass in thenetobs.observables.forcemodule.--with steps=20specifies the options for NetObs.--net-restore ...tells theAdaptorwhere to restore the network checkpoint.
Example output
``` 2024-02-29 20:34:29,150 INFO netobs ferminet_vmc.py:54] Assuming running with FermiNet on main. 2024-02-29 20:34:29,333 INFO netobs force.py:319] Using molecular version of SWCT 2024-02-29 20:34:29,548 INFO netobs evaluate.py:102] Start burning in 100 steps 2024-02-29 20:34:30,522 INFO netobs evaluate.py:115] Starting 20 evaluation steps 2024-02-29 20:34:40,112 INFO netobs evaluate.py:148] Time per step: 0.01s energy: -0.50042176 ± 0.00027392566 force [[-7.4391162e-12 -1.3514609e-09 -1.4826655e-09]] std force [[4.9552114e-09 4.2379065e-09 3.2048899e-09]] force_no_warp [[-0.00097416 -0.00091072 0.00125167]] std force_no_warp [[0.00146565 0.00108437 0.00165038]] ``` > [!NOTE] > The standard error (std) here are rough estimates which does NOT take autocorrelation into consideration due to performance conserns. You are STRONGLY encouraged to analyze the data using your own code.Another example with DeepSolid:
shell
netobs @deepsolid_vmc tests/data/H_chain.py @energy --with steps=20 --net-restore tests/data/H_chain.npz
[!NOTE] If you want to use the SWCT force estimator with DeepSolid, it is highly recommended to use the
trifeature.
Core Concepts
Adaptor
Adaptor is an abstract layer over the network that exposes a uniform API. For example, it tells NetObs how to restore from a checkpoint, evaluates the network and Hamiltonian, etc.
Currently, we have built-in support for FermiNet (molecules) and DeepSolid (solid systems). You can find their implementation in netobs/adaptors. It is also very easy to write your own adaptors!
Estimator
You can regard estimators as different ways to estimate a physical quantity given a set of Monte Carlo samples. You can have multiple estimators for an observable, but usually a basic one is enough.
In the code, an Estimator tells us what type of observable it targets at, the expression of the estimator given a set of Monte Carlo samples, how to combine the results from different steps (simply averaging or more actions are required), etc.
An Estimator can work only in the molecular case, or it can be implemented to support molecules and solids at the same time. Check out the SWCT Estimator in force.py for more.
You can find the implementation of built-in estimators in netobs/observables. And it is easy to create your own estimator!
Options
steps(int, default to10): Steps to run inference.mcmc_steps(int, default to10): Steps to run MCMC.mcmc_burn_in(int, default to100): Burn-in steps for MCMC.random_seed(int, default to current time): The random seed for the Monte Carlo simulation.log_interval(int, default to10): Time interval in seconds between logs.save_interval(int, default to600): Time interval in seconds between saves.estimator(dict): Options for the estimators.observable(dict): Options for the observable.
Integrate in Your Code
You need to pass your Adaptor, Estimator class, and evaluate options to netobs.evaluate.evaluate_observable. For example,
```python from netobs.helpers.importer import importmoduleor_file from netobs.observables.force import SWCT
cfg = importmoduleorfile("Hchain.py").getconfig() adaptor = DeepSolidVMCAdaptor(cfg, []) options = NetObsOptions(steps=20) digest, allvalues, state = evaluate_observable(adaptor, SWCT, options=options) ```
For more details, check out this test for how to start an evaluation, and check out this test for how to use different adaptors in your code.
Contributing
Contributions are welcomed and highly appreciated! We are open to new network Adaptors and new Estimators! For a detailed contribution guide, please see CONTRIBUTING.md.
Citation
If you are using NetObs in your works, please consider citing our papers.
Owner
- Name: Bytedance Inc.
- Login: bytedance
- Kind: organization
- Location: Singapore
- Website: https://opensource.bytedance.com
- Twitter: ByteDanceOSS
- Repositories: 255
- Profile: https://github.com/bytedance
Citation (CITATIONS.bib)
@article{qian_solid-force_2024,
author = "Qian, Yubing and Li, Xiang and Chen, Ji",
title = "Force and stress calculation with neural network wavefunction for solids",
journal = "Faraday Discuss.",
year = "2024",
pages = "-",
publisher = "The Royal Society of Chemistry",
doi = "10.1039/D4FD00071D",
url = "http://dx.doi.org/10.1039/D4FD00071D"
}
@article{qian_ferminet-force_2022,
author = {Qian, Yubing and Fu, Weizhong and Ren, Weiluo and Chen, Ji},
title = "{Interatomic force from neural network based variational quantum Monte Carlo}",
journal = {The Journal of Chemical Physics},
volume = {157},
number = {16},
pages = {164104},
year = {2022},
month = {10},
issn = {0021-9606},
doi = {10.1063/5.0112344},
url = {https://doi.org/10.1063/5.0112344}
}
GitHub Events
Total
- Issues event: 2
- Watch event: 10
- Delete event: 2
- Push event: 6
- Fork event: 2
- Create event: 3
Last Year
- Issues event: 2
- Watch event: 10
- Delete event: 2
- Push event: 6
- Fork event: 2
- Create event: 3
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| 钱昱冰 | q****b@b****m | 24 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- sunny-viv (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- jax *
- jaxlib *
- ml_collections *
- omegaconf *