├── .github └── workflows │ ├── Test_abICS.yml │ ├── build_docs.yml │ ├── deploy_docs.yml │ └── deploy_pypi.yml ├── .gitignore ├── .nojekyll ├── COPYING ├── README.md ├── abics ├── .gitignore ├── __init__.py ├── applications │ ├── __init__.py │ ├── latgas_abinitio_interface │ │ ├── __init__.py │ │ ├── aenet.py │ │ ├── aenet_pylammps.py │ │ ├── aenet_trainer.py │ │ ├── base_solver.py │ │ ├── base_trainer.py │ │ ├── default_observer.py │ │ ├── defect.py │ │ ├── map2perflat.py │ │ ├── mlip_3.py │ │ ├── mlip_3_trainer.py │ │ ├── model_setup.py │ │ ├── naive_matcher.py │ │ ├── nequip.py │ │ ├── nequip_trainer.py │ │ ├── openmx.py │ │ ├── params.py │ │ ├── qe.py │ │ ├── run_base_mpi.py │ │ ├── user_function_solver.py │ │ ├── util.py │ │ └── vasp.py │ └── lattice_model │ │ ├── __init__.py │ │ └── potts.py ├── exception.py ├── loggers │ ├── README.txt │ ├── __init__.py │ └── loggers.py ├── mc.py ├── mc_mpi.py ├── mlref.py ├── model.py ├── observer.py ├── replica_params.py ├── sampling │ ├── __init__.py │ ├── mc.py │ ├── mc_mpi.py │ ├── pamc.py │ ├── resampling.py │ ├── rxmc.py │ └── simple_parallel.py ├── scripts │ ├── __init__.py │ ├── abicsRXsepT.py │ ├── activelearn.py │ ├── input_template.toml │ ├── main.py │ ├── main_dft_latgas.py │ ├── main_potts.py │ ├── mocksolver.py │ ├── postproc.py │ ├── postproc_dft_latgas.py │ ├── st2abics_config.py │ └── train.py └── util.py ├── docs ├── api │ ├── .gitignore │ ├── Makefile │ ├── conf.py │ ├── index.rst │ └── make.bat ├── make.sh └── sphinx │ ├── .gitignore │ ├── en │ ├── Makefile │ └── source │ │ ├── about │ │ ├── index.rst │ │ └── info.rst │ │ ├── acknowledge │ │ └── index.rst │ │ ├── algorithm │ │ └── index.rst │ │ ├── conf.py │ │ ├── contact │ │ └── index.rst │ │ ├── how_to_use │ │ └── index.rst │ │ ├── index.rst │ │ ├── inputfiles │ │ ├── index.rst │ │ ├── parameter_config.rst │ │ ├── parameter_log.rst │ │ ├── parameter_mlref.rst │ │ ├── parameter_observer.rst │ │ ├── parameter_sampling.rst │ │ ├── parameter_solver.rst │ │ └── parameter_train.rst │ │ ├── install │ │ ├── index.rst │ │ └── install.rst │ │ ├── outputfiles │ │ └── index.rst │ │ ├── tools │ │ ├── index.rst │ │ ├── tools_abicsRXsepT.rst │ │ └── tools_st2abics.rst │ │ └── tutorial │ │ ├── aenet.rst │ │ ├── index.rst │ │ ├── other_models.rst │ │ ├── qe.rst │ │ └── vasp.rst │ ├── image │ ├── al_scheme.pdf │ ├── al_scheme.png │ ├── alg_sampling.eps │ ├── alg_sampling.png │ ├── doi_17.pdf │ ├── doi_17.png │ ├── doi_2.pdf │ ├── doi_2.png │ ├── doi_aenet.pdf │ ├── doi_aenet.png │ ├── doi_qe.pdf │ ├── doi_qe.png │ ├── doi_vasp.pdf │ ├── doi_vasp.png │ └── schmatic_AR.png │ └── ja │ ├── Makefile │ ├── make.bat │ └── source │ ├── about │ ├── index.rst │ └── info.rst │ ├── acknowledge │ └── index.rst │ ├── algorithm │ └── index.rst │ ├── conf.py │ ├── contact │ └── index.rst │ ├── how_to_use │ └── index.rst │ ├── index.rst │ ├── inputfiles │ ├── index.rst │ ├── parameter_config.rst │ ├── parameter_log.rst │ ├── parameter_mlref.rst │ ├── parameter_observer.rst │ ├── parameter_sampling.rst │ ├── parameter_solver.rst │ └── parameter_train.rst │ ├── install │ ├── index.rst │ └── install.rst │ ├── outputfiles │ └── index.rst │ ├── tools │ ├── index.rst │ ├── tools_abicsRXsepT.rst │ └── tools_st2abics.rst │ └── tutorial │ ├── aenet.rst │ ├── index.rst │ ├── other_models.rst │ ├── qe.rst │ └── vasp.rst ├── examples ├── active_learning_qe │ ├── AL.sh │ ├── MC.sh │ ├── MgAl2O4.vasp │ ├── aenet_train_input │ │ ├── generate │ │ │ ├── Al.fingerprint.stp │ │ │ ├── Mg.fingerprint.stp │ │ │ └── generate.in.head │ │ ├── predict │ │ │ └── predict.in │ │ └── train │ │ │ └── train.in │ ├── allegro_train_input │ │ └── train │ │ │ └── input.yaml │ ├── baseinput_ref │ │ ├── download_pp.sh │ │ └── scf.in │ ├── calc_DOI.py │ ├── input-aenet.toml │ ├── input-mlip-3.toml │ ├── input-nequip.toml │ ├── mlip-3_train_input │ │ └── train │ │ │ └── input.almtp │ ├── parallel_run.sh │ └── run_pw.sh ├── active_learning_qe_lammps │ ├── AL.sh │ ├── MC.sh │ ├── MgAl2O4.vasp │ ├── aenet_train_input │ │ ├── generate │ │ │ ├── Al.fingerprint.stp │ │ │ ├── Mg.fingerprint.stp │ │ │ └── generate.in.head │ │ ├── predict │ │ │ └── in.lammps │ │ └── train │ │ │ └── train.in │ ├── baseinput_ref │ │ ├── download_pp.sh │ │ └── scf.in │ ├── calc_DOI.py │ ├── input.toml │ ├── parallel_run.sh │ └── run_pw.sh ├── active_learning_vasp │ ├── AL.sh │ ├── LARGE │ │ ├── AL.sh │ │ ├── MC.sh │ │ ├── MgAl2O4.vasp │ │ ├── aenet_train_input │ │ │ ├── generate │ │ │ │ ├── Al.fingerprint.stp │ │ │ │ ├── Mg.fingerprint.stp │ │ │ │ └── generate.in.head │ │ │ ├── predict │ │ │ │ └── predict.in │ │ │ └── train │ │ │ │ └── train.in │ │ ├── baseinput_ref │ │ │ ├── INCAR │ │ │ ├── KPOINTS │ │ │ ├── POSCAR │ │ │ └── scf.in │ │ ├── calc_DOI.py │ │ ├── input.toml │ │ ├── parallel_run.sh │ │ └── run_vasp.sh │ ├── MC.sh │ ├── MgAl2O4.vasp │ ├── aenet_train_input │ │ ├── generate │ │ │ ├── Al.fingerprint.stp │ │ │ ├── Mg.fingerprint.stp │ │ │ └── generate.in.head │ │ ├── predict │ │ │ └── predict.in │ │ └── train │ │ │ └── train.in │ ├── baseinput_ref │ │ ├── INCAR │ │ ├── KPOINTS │ │ ├── POSCAR │ │ └── scf.in │ ├── calc_DOI.py │ ├── input.toml │ ├── parallel_run.sh │ └── run_vasp.sh ├── lattice_gas │ ├── README.md │ ├── input.toml │ ├── main.py │ ├── main_flip.py │ └── plot.png ├── potts │ ├── L16 │ │ └── input.toml │ ├── L24 │ │ └── input.toml │ ├── L8 │ │ └── input.toml │ └── calc_observables.py ├── potts_pamc │ ├── L16 │ │ └── input.toml │ ├── L8 │ │ └── input.toml │ └── exact_ising.py ├── spinel │ ├── ISSP_sysB.sh │ ├── MgAl2O4.vasp │ ├── analyze_result.py │ ├── baseinput │ │ ├── Al.15t-15t.nn │ │ ├── INCAR │ │ ├── KPOINTS │ │ ├── Mg.15t-15t.nn │ │ ├── POSCAR │ │ ├── predict.in │ │ └── scf.in │ ├── calc_DOI.py │ ├── input_aenet.toml │ ├── input_qe.toml │ ├── input_vasp.toml │ ├── issp_qe.toml │ └── separateT.py └── st2abics │ ├── BaZrO3.vasp │ ├── CuZn.vasp │ ├── MgAl2O4.vasp │ ├── st2abics_BZY.toml │ ├── st2abics_CuZn.toml │ └── st2abics_MgAl2O4.toml ├── pyproject.toml ├── test ├── openmx │ ├── sample │ │ └── base.dat │ └── test_openmx_io.py └── qe │ ├── baseinput │ └── scf.in │ ├── fulltest.py │ └── input.toml └── tests ├── __init__.py ├── data ├── aenet │ ├── baseinput │ │ └── predict.in │ ├── stdout │ └── structure.xsf ├── gc │ └── input.toml ├── input │ └── input.toml ├── openmx │ ├── DFT_DATA19 │ │ ├── README.md │ │ └── vps_info.txt │ ├── baseinput │ │ └── base.dat │ ├── bin │ │ └── openmx.dummy │ ├── input │ │ └── Al.dat │ └── output │ │ ├── Al.dat# │ │ ├── Al.out │ │ └── Al.xyz ├── pos.vasp ├── qe │ ├── baseinput │ │ └── scf.in │ ├── pwscf.save │ │ └── data-file-schema.xml │ └── scf.in └── vasp │ ├── baseinput │ ├── INCAR │ ├── KPOINTS │ └── POSCAR │ ├── input │ ├── INCAR │ ├── KPOINTS │ └── POSCAR │ └── output │ ├── CHG │ ├── CHGCAR │ ├── CONTCAR │ ├── DOSCAR │ ├── EIGENVAL │ ├── IBZKPT │ ├── INCAR │ ├── KPOINTS │ ├── OSZICAR │ ├── PCDAT │ ├── POSCAR │ ├── WAVECAR │ └── XDATCAR ├── integration ├── README.md ├── active_learn_aenet │ ├── AL.sh │ ├── MC.sh │ ├── MgAl2O4.vasp │ ├── aenet_train_input │ │ ├── generate │ │ │ ├── Al.fingerprint.stp │ │ │ ├── Mg.fingerprint.stp │ │ │ └── generate.in.head │ │ ├── predict │ │ │ └── predict.in │ │ └── train │ │ │ └── train.in │ ├── baseinput_ref │ │ └── void │ ├── input.toml │ ├── install_aenet.sh │ ├── mock.py │ ├── parallel_run.sh │ └── run.sh ├── active_learn_mlip3 │ ├── AL.sh │ ├── MC.sh │ ├── input.toml │ ├── install_mlip3.sh │ ├── mlip-3_train_input │ │ └── train │ │ │ └── input.almtp │ ├── mock.py │ ├── parallel_run.sh │ └── run.sh ├── active_learn_nequip │ ├── AL.sh │ ├── MC.sh │ ├── MgAl2O4.vasp │ ├── allegro_train_input │ │ └── train │ │ │ └── input.yaml │ ├── input.toml │ ├── install_nequip.sh │ ├── mock.py │ ├── parallel_run.sh │ └── run.sh ├── mock │ ├── check.py │ ├── input.toml │ ├── mock.py │ ├── ref_logZ.dat │ ├── ref_result.dat │ └── run.sh ├── openmx │ ├── baseinput │ │ └── base.dat │ ├── do_mpich.sh │ ├── do_openmpi.sh │ ├── fulltest.py │ └── input.toml ├── potts │ ├── check.py │ ├── input.toml │ ├── ref_energy.dat │ ├── ref_logZ.dat │ ├── ref_magnetization.dat │ └── run.sh ├── potts_pamc │ ├── check.py │ ├── input.toml │ ├── ref_energy.dat │ ├── ref_logZ.dat │ ├── ref_magnetization.dat │ └── run.sh ├── qe │ ├── baseinput │ │ └── scf.in │ ├── do_mpich.sh │ ├── do_openmpi.sh │ ├── fulltest.py │ └── input.toml └── qe_restart │ ├── baseinput │ └── scf.in │ ├── do_mpich.sh │ ├── do_openmpi.sh │ ├── fulltest.py │ ├── input_2steps.toml │ ├── input_2steps_restart.toml │ └── input_4steps.toml ├── test_aenet.py ├── test_aenetpylammps.py ├── test_gc.py ├── test_input.py ├── test_mc.py ├── test_openmx.py ├── test_qe.py └── test_vasp.py /.github/workflows/Test_abICS.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 3 | 4 | name: Test for abICS 5 | 6 | on: 7 | push: 8 | schedule: 9 | - cron: '0 0 1,15 * *' # JST 9:00 on 1st and 15th every month 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-22.04 15 | strategy: 16 | matrix: 17 | python-version: ['3.9', '3.12'] 18 | testname: [Unit, Sampling, ActiveLearnAenet, ActiveLearnNequip, ActiveLearnMLIP-3] 19 | fail-fast: false 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v5 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - name: Install dependencies 28 | run: | 29 | python -m pip install --upgrade pip 30 | python -m pip install setuptools wheel 31 | sudo apt update 32 | sudo apt install -y libopenmpi-dev openmpi-bin parallel 33 | sudo apt install -y python3-mpi4py 34 | python -m pip install Cython 35 | - name: Install abICS 36 | run: python -m pip install . 37 | - name: Test ${{ matrix.testname }} 38 | run: | 39 | case "${{ matrix.testname }}" in 40 | Unit ) python -m unittest ;; 41 | Sampling ) cd tests/integration/mock 42 | sh ./run.sh 43 | cd ../potts 44 | sh ./run.sh 45 | cd ../potts_pamc 46 | sh ./run.sh 47 | ;; 48 | ActiveLearnAenet ) cd tests/integration/active_learn_aenet 49 | sh ./install_aenet.sh 50 | sh ./run.sh ;; 51 | ActiveLearnNequip ) cd tests/integration/active_learn_nequip 52 | sh ./install_nequip.sh 53 | sh ./run.sh ;; 54 | ActiveLearnMLIP-3 ) cd tests/integration/active_learn_mlip3 55 | sh ./install_mlip3.sh 56 | sh ./run.sh ;; 57 | * ) echo "Unknown testname";; 58 | esac 59 | -------------------------------------------------------------------------------- /.github/workflows/build_docs.yml: -------------------------------------------------------------------------------- 1 | name: test for building doc 2 | 3 | on: [push] 4 | 5 | jobs: 6 | check-build-doc: 7 | runs-on: ubuntu-22.04 8 | timeout-minutes: 10 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v4 12 | 13 | - name: Set up Python 14 | uses: actions/setup-python@v5 15 | with: 16 | python-version: 3.9 17 | 18 | - name: Prepare LaTeX env 19 | run: | 20 | sudo apt update 21 | sudo apt install \ 22 | texlive-latex-recommended texlive-latex-extra texlive-xetex \ 23 | texlive-lang-japanese texlive-fonts-recommended texlive-fonts-extra latexmk 24 | kanji-config-updmap-sys ipaex 25 | 26 | - name: Install python packages 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install sphinx sphinx_rtd_theme 30 | 31 | - name: Build 32 | run: | 33 | cd ${GITHUB_WORKSPACE}/docs 34 | sh make.sh 35 | -------------------------------------------------------------------------------- /.github/workflows/deploy_pypi.yml: -------------------------------------------------------------------------------- 1 | name: upload package to PyPI 2 | 3 | on: 4 | push: 5 | tags: ['*'] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-22.04 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v4 13 | 14 | - name: Set up Python 15 | uses: actions/setup-python@v5 16 | with: 17 | python-version: 3.9 18 | 19 | - name: Install python packages 20 | run: | 21 | python -m pip install --upgrade pip 22 | pip install poetry 23 | 24 | - name: Publish 25 | run: | 26 | cd ${GITHUB_WORKSPACE} 27 | poetry publish --build -u __token__ -p "${{ secrets.PYPI_TOKEN }}" 28 | -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/.nojekyll -------------------------------------------------------------------------------- /abics/.gitignore: -------------------------------------------------------------------------------- 1 | POTCAR 2 | -------------------------------------------------------------------------------- /abics/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "2.2.1" 2 | -------------------------------------------------------------------------------- /abics/applications/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/abics/applications/__init__.py -------------------------------------------------------------------------------- /abics/applications/latgas_abinitio_interface/__init__.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from .map2perflat import * 18 | 19 | from .base_solver import register_solver 20 | from .base_trainer import register_trainer 21 | 22 | register_solver("vasp", "VASPSolver", "abics.applications.latgas_abinitio_interface.vasp") 23 | register_solver("qe", "QESolver", "abics.applications.latgas_abinitio_interface.qe") 24 | register_solver("openmx", "OpenMXSolver", "abics.applications.latgas_abinitio_interface.openmx") 25 | register_solver("aenet", "AenetSolver", "abics.applications.latgas_abinitio_interface.aenet") 26 | register_solver("aenetPyLammps", "AenetPyLammpsSolver", "abics.applications.latgas_abinitio_interface.aenet_pylammps") 27 | register_solver("nequip", "NequipSolver", "abics.applications.latgas_abinitio_interface.nequip") 28 | register_solver("mlip_3", "MLIP3Solver", "abics.applications.latgas_abinitio_interface.mlip_3") 29 | register_solver("User", "UserFunctionSolver", "abics.applications.latgas_abinitio_interface.user_function_solver") 30 | 31 | register_trainer("aenet", "AenetTrainer", "abics.applications.latgas_abinitio_interface.aenet_trainer") 32 | register_trainer("nequip", "NequipTrainer", "abics.applications.latgas_abinitio_interface.nequip_trainer") 33 | register_trainer("mlip_3", "MLIP3Trainer", "abics.applications.latgas_abinitio_interface.mlip_3_trainer") -------------------------------------------------------------------------------- /abics/applications/latgas_abinitio_interface/map2perflat.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import numpy as np 4 | from pymatgen.core import Structure 5 | # pymatgen 2019.12.22 does not have SpeciesLike 6 | # from pymatgen.util.typing import SpeciesLike 7 | 8 | from abics.applications.latgas_abinitio_interface.naive_matcher import naive_mapping 9 | 10 | 11 | def map2perflat( 12 | perf_st: Structure, st: Structure, 13 | vac_spaceholder = {} #: dict[SpeciesLike, SpeciesLike] = {} 14 | ) -> Structure: 15 | """ 16 | 17 | Arguments 18 | ========= 19 | perf_st: Structure 20 | reference structure 21 | st: Structure 22 | input structure (configuration) 23 | vac_spaceholder: dict[str, str] 24 | - key 25 | - specy 'A' maybe removed 26 | - value 27 | - virtual specy implying vacancy of 'A' 28 | 29 | """ 30 | perf_st = perf_st.copy() 31 | N = perf_st.num_sites 32 | seldyn = np.array( 33 | perf_st.site_properties.get("seldyn", np.ones((N, 3))), dtype=np.float64 34 | ) 35 | perf_st.replace_species(vac_spaceholder) 36 | mapping = naive_mapping(st, perf_st) 37 | for i, j in enumerate(mapping): 38 | perf_st.replace(j, st[i].species_string, properties={"seldyn": seldyn[j]}) 39 | perf_st.sort(key=lambda site: site.species_string) 40 | return perf_st 41 | 42 | 43 | """ 44 | Testing 45 | """ 46 | if __name__ == "__main__": 47 | perf_st = Structure.from_file("../../POSCAR") 48 | st_in = Structure.from_file("./POSCAR") 49 | st = map2perflat(perf_st, st_in) 50 | st.remove_species(["N", "Li"]) 51 | st.to(fmt="POSCAR", filename="POSCAR.in") 52 | -------------------------------------------------------------------------------- /abics/applications/latgas_abinitio_interface/naive_matcher.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import numpy as np 4 | from pymatgen.core import Structure 5 | 6 | 7 | def naive_mapping(st0: Structure, st1: Structure) -> list[int]: 8 | """ 9 | 10 | Arguments 11 | ========= 12 | st0: Structure 13 | st1: Structure 14 | 15 | Returns 16 | ======= 17 | mapping: list[int] 18 | mapping atoms from st0 to st1. 19 | st0[i] corresponds to st1[mapping[i]] 20 | """ 21 | coords0 = st0.frac_coords 22 | coords1 = st1.frac_coords 23 | D = st1.lattice.get_all_distances(coords0, coords1) 24 | rows = D.min(axis=1).argsort() 25 | cols = D.argmin(axis=1)[rows] 26 | mapping = cols[rows.argsort()] 27 | return mapping 28 | 29 | 30 | """ 31 | Testing 32 | """ 33 | if __name__ == "__main__": 34 | st0 = Structure.from_file("MgAl2O4.vasp") 35 | st1 = Structure.from_file("0/structure.0.vasp") 36 | for i, j in enumerate(naive_mapping(st0, st1)): 37 | st0.replace(i, st1[j].species_string) 38 | st0.sort() 39 | st0.to(fmt="POSCAR", filename="testnaivemap.vasp") 40 | -------------------------------------------------------------------------------- /abics/applications/lattice_model/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/abics/applications/lattice_model/__init__.py -------------------------------------------------------------------------------- /abics/exception.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | class Error(Exception): 18 | """Base class for exceptions in abICS""" 19 | pass 20 | 21 | 22 | class InputError(Error): 23 | """Exception raised for errors in the input 24 | 25 | Attributes 26 | ---------- 27 | message: str 28 | explanation 29 | """ 30 | def __init__(self, message: str): 31 | self.message = message 32 | 33 | 34 | class MatrixParseError(Error): 35 | """Exception raised for matrix parse errors 36 | 37 | Attributes 38 | ---------- 39 | message: str 40 | explanation 41 | """ 42 | def __init__(self, message: str): 43 | self.message = message 44 | -------------------------------------------------------------------------------- /abics/loggers/README.txt: -------------------------------------------------------------------------------- 1 | Logger module 2 | originally developed for DeepMD-kit 3 | by Han Wang, Linfeng Zhang, Jiequn Han, and Weinan E. 4 | "DeePMD-kit: A deep learning package for many-body potential energy representation 5 | and molecular dynamics." Computer Physics Communications 228 (2018): 178-184 6 | licensed under GNU LGPLv3.0. 7 | See https://github.com/deepmodeling/deepmd-kit for details. 8 | 9 | -------------------------------------------------------------------------------- /abics/loggers/__init__.py: -------------------------------------------------------------------------------- 1 | """Module taking care of logging duties.""" 2 | 3 | from .loggers import set_log_handles 4 | 5 | __all__ = ["set_log_handles"] 6 | -------------------------------------------------------------------------------- /abics/mc.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from abics.sampling.mc import MCAlgorithm, CanonicalMonteCarlo, WeightedCanonicalMonteCarlo, RandomSampling 18 | from abics.observer import ObserverBase 19 | from abics.model import Model 20 | -------------------------------------------------------------------------------- /abics/mc_mpi.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from abics.mlref import RefParams 18 | from abics.sampling.mc_mpi import ParallelMC, RX_MPI_init 19 | from abics.sampling.pamc import PopulationAnnealing, PAMCParams 20 | from abics.sampling.rxmc import RXParams, TemperatureRX_MPI 21 | from abics.sampling.simple_parallel import EmbarrassinglyParallelSampling, ParallelRandomParams 22 | -------------------------------------------------------------------------------- /abics/sampling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/abics/sampling/__init__.py -------------------------------------------------------------------------------- /abics/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/abics/scripts/__init__.py -------------------------------------------------------------------------------- /abics/scripts/input_template.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 3 | nprocs_per_replica = 4 | 5 | kTstart = 6 | kTend = 7 | 8 | nsteps = 9 | RXtrial_frequency = 10 | sample_frequency = 11 | print_frequency = 12 | reload = false 13 | 14 | [sampling.solver] 15 | type = 16 | path = 17 | base_input_dir = 18 | perturb = 19 | run_scheme = 20 | 21 | # [mlref] 22 | # nreplicas = 23 | # ndata = 24 | 25 | # [mlref.solver] 26 | # type = 27 | # path = 28 | # base_input_dir = 29 | # perturb = 30 | # run_scheme = 31 | 32 | [observer] 33 | type = 'default' 34 | -------------------------------------------------------------------------------- /abics/scripts/main.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from typing import MutableMapping 18 | 19 | import sys 20 | import datetime 21 | 22 | import toml 23 | 24 | from abics import __version__ 25 | 26 | import logging 27 | import abics.loggers as loggers 28 | # from pathlib import Path 29 | 30 | logger = logging.getLogger("main") 31 | 32 | def main_impl(params: MutableMapping): 33 | solver_type = params["sampling"]["solver"]["type"] 34 | if solver_type == "potts": 35 | import abics.scripts.main_potts 36 | abics.scripts.main_potts.main_potts(params) 37 | else: 38 | import abics.scripts.main_dft_latgas 39 | abics.scripts.main_dft_latgas.main_dft_latgas(params) 40 | 41 | 42 | def main(): 43 | now = datetime.datetime.now() 44 | 45 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 46 | params = toml.load(tomlfile) 47 | 48 | loggers.set_log_handles( 49 | app_name = "sampling", 50 | level = logging.INFO, 51 | logfile_path = None, 52 | logfile_mode = "master", 53 | params=params.get("log", {})) 54 | 55 | logger.info(f"Running abics_sampling (abICS v{__version__}) on {now}") 56 | logger.info("-Reading input from: {}".format(tomlfile)) 57 | 58 | main_impl(params) 59 | 60 | 61 | if __name__ == "__main__": 62 | main() 63 | -------------------------------------------------------------------------------- /abics/scripts/mocksolver.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | """ 18 | Mock for energy calculator 19 | """ 20 | 21 | from abics.applications.latgas_abinitio_interface.mocksolver import MockSolver 22 | 23 | def main_impl(output_dir): 24 | solver = MockSolver() 25 | solver.calc_energy("", output_dir) 26 | 27 | def main(): 28 | import sys 29 | output_dir = sys.argv[1] if len(sys.argv) > 1 else "." 30 | main_impl(output_dir) 31 | 32 | if __name__ == "__main__": 33 | main() 34 | -------------------------------------------------------------------------------- /abics/scripts/postproc.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from typing import MutableMapping 18 | 19 | import sys 20 | import datetime 21 | 22 | import toml 23 | 24 | from abics import __version__ 25 | 26 | import logging 27 | import abics.loggers as loggers 28 | # from pathlib import Path 29 | 30 | logger = logging.getLogger("main") 31 | 32 | def main_impl(params: MutableMapping): 33 | solver_type = params["sampling"]["solver"]["type"] 34 | if solver_type == "potts": 35 | raise NotImplementedError("Potts solver is not implemented yet.") 36 | else: 37 | import abics.scripts.postproc_dft_latgas 38 | abics.scripts.postproc_dft_latgas.postproc_dft_latgas(params) 39 | 40 | 41 | def main(): 42 | now = datetime.datetime.now() 43 | 44 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 45 | params = toml.load(tomlfile) 46 | 47 | loggers.set_log_handles( 48 | app_name = "postproc", 49 | level = logging.INFO, 50 | logfile_path = None, 51 | logfile_mode = "master", 52 | params=params.get("log", {})) 53 | 54 | logger.info(f"Running abics_postproc (abICS v{__version__}) on {now}") 55 | logger.info("-Reading input from: {}".format(tomlfile)) 56 | 57 | main_impl(params) 58 | 59 | 60 | if __name__ == "__main__": 61 | main() 62 | -------------------------------------------------------------------------------- /docs/api/.gitignore: -------------------------------------------------------------------------------- 1 | *.rst 2 | !index.rst 3 | -------------------------------------------------------------------------------- /docs/api/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/api/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # http://www.sphinx-doc.org/en/master/config 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | 16 | sys.path.insert(0, "../../") 17 | 18 | 19 | # -- Project information ----------------------------------------------------- 20 | 21 | project = "abICS API" 22 | copyright = "2020-, ISSP, UTokyo" 23 | author = "abICS Developer team" 24 | 25 | 26 | # -- General configuration --------------------------------------------------- 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [ 32 | "sphinx.ext.autodoc", 33 | "sphinx.ext.viewcode", 34 | "sphinx.ext.todo", 35 | "sphinx.ext.napoleon", 36 | ] 37 | 38 | # Add any paths that contain templates here, relative to this directory. 39 | templates_path = ["_templates"] 40 | 41 | # The language for content autogenerated by Sphinx. Refer to documentation 42 | # for a list of supported languages. 43 | # 44 | # This is also used if you do content translation via gettext catalogs. 45 | # Usually you set "language" from the command line for these cases. 46 | language = "en" 47 | 48 | # List of patterns, relative to source directory, that match files and 49 | # directories to ignore when looking for source files. 50 | # This pattern also affects html_static_path and html_extra_path. 51 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 52 | 53 | 54 | # -- Options for HTML output ------------------------------------------------- 55 | 56 | # The theme to use for HTML and HTML Help pages. See the documentation for 57 | # a list of builtin themes. 58 | # 59 | html_theme = "sphinx_rtd_theme" 60 | # html_theme = "alabaster" 61 | 62 | # Add any paths that contain custom static files (such as style sheets) here, 63 | # relative to this directory. They are copied after the builtin static files, 64 | # so a file named "default.css" will overwrite the builtin "default.css". 65 | html_static_path = ["_static"] 66 | 67 | 68 | # -- Extension configuration ------------------------------------------------- 69 | 70 | # -- Options for todo extension ---------------------------------------------- 71 | 72 | # If true, `todo` and `todoList` produce output, else they produce nothing. 73 | todo_include_todos = True 74 | 75 | autoclass_content = 'both' 76 | 77 | napoleon_include_init_with_doc = True 78 | 79 | -------------------------------------------------------------------------------- /docs/api/index.rst: -------------------------------------------------------------------------------- 1 | .. abics documentation master file, created by 2 | sphinx-quickstart on Mon Jan 13 15:34:54 2020. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to abics's API documentation! 7 | ====================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 4 11 | :caption: Contents: 12 | 13 | abics 14 | 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /docs/api/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/make.sh: -------------------------------------------------------------------------------- 1 | DOCROOT=`pwd` 2 | 3 | # user's manual 4 | cd ${DOCROOT}/sphinx/ja 5 | make html 6 | make latexpdf 7 | cd ${DOCROOT}/sphinx/en 8 | make html 9 | make latexpdf 10 | 11 | # api 12 | cd $DOCROOT 13 | sphinx-apidoc -f -e -o ./api ../abics 14 | cd api 15 | make html 16 | 17 | -------------------------------------------------------------------------------- /docs/sphinx/.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *~ 3 | doctrees 4 | latex 5 | -------------------------------------------------------------------------------- /docs/sphinx/en/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = pyMC 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/sphinx/en/source/about/index.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | About abICS 7 | =========================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | info 13 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/acknowledge/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | Acknowledgement 3 | *************************** 4 | 5 | The development of this software has been supported by various funding bodies and computer resource providers over the years. 6 | 7 | - Priority Issue on Post-K computer (Development of new fundamental technologies for high-efficiency energy creation, conversion/storage and use) 8 | - Joint-use Supercomputer System at Institute for Solid State Physics, the University of Tokyo 9 | - Leading Initiative for Excellent Young Researchers (LEADER) by Ministry of Education, Culture, Science, and Technology (MEXT) of Japan. 10 | - KAKENHI (No. JP18H05519, No. 19K15287) by MEXT 11 | - Core Research for Evolutional Science and Technology (CREST) by Japan Science and Technology Agency (No. JPMJCR15Q3, No. 19K15287) 12 | - New Energy and Industrial Technology Development Organization 13 | 14 | We would also like to express our thanks for the support of the \"*Project for advancement of software usability in materials science*\" of The Institute for Solid State Physics, The University of Tokyo, for the development of abICS. 15 | 16 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/contact/index.rst: -------------------------------------------------------------------------------- 1 | .. TeNeS documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Contacts 7 | ========================================= 8 | 9 | - About Bugs 10 | 11 | Please report all problems and bugs on `the GitHub Issues page `_ 12 | 13 | To resolve bugs early, please follow these guidelines when reporting: 14 | 15 | - Please specify the version of abICS you are using. 16 | 17 | - If there are problems for installation, please inform us about your operating system and the compiler, and include the input / output. 18 | 19 | - If a problem occurs during execution, please provide the input file used for execution and its output. 20 | 21 | Thank you for your cooperation. 22 | 23 | - Others 24 | 25 | If you have any questions about topics related to your research that are difficult to consult at Issues on GitHub, 26 | please contact the developer team by email. 27 | 28 | E-mail: ``abics-dev__at__issp.u-tokyo.ac.jp`` (replace _at_ by @) 29 | 30 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/index.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:10:39 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to abICS's documentation! 7 | ================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :numbered: 3 12 | :caption: Contents: 13 | 14 | about/index 15 | install/index 16 | how_to_use/index 17 | tutorial/index 18 | inputfiles/index 19 | outputfiles/index 20 | tools/index 21 | algorithm/index 22 | acknowledge/index 23 | contact/index 24 | 25 | Indices and tables 26 | ================== 27 | 28 | * :ref:`genindex` 29 | * :ref:`modindex` 30 | * :ref:`search` 31 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/inputfiles/index.rst: -------------------------------------------------------------------------------- 1 | .. _input_format: 2 | 3 | *************************** 4 | Input Files Format 5 | *************************** 6 | 7 | The input file of abICS is constructed by the following five sections: 8 | 9 | 1. [sampling] section specifies the parameters of the replica exchange Monte Carlo part, such as the number of replicas, the temperature range, and the number of Monte Carlo steps. In addition, [sampling.solver] subsection specifies the parameters for the (first principle calculation) solver, including the type of solver (VASP, QE,...), the path to the solver, and the directory containing immutable input files. 10 | 11 | 2. [mlref] section specifies options for extracting only atomic configurations from the sampling results in order to evaluate the accuracy of the neural network model and to expand the training data. In addition, for generating training data, [mlref.solver] subsection specifies the parameters for the (first principle calculation) solver, including the type of solver (VASP, QE,...), the path to the solver, and the directory containing immutable input files. This section is used for ``abics_mlref`` . 12 | 13 | 3. [train] section specifies optinons for making a trainer to learn a placement energy prediction model from training data. This section is used for ``abics_train`` . 14 | 15 | 4. [observer] section specifies the type of physical quantity to be calculated. 16 | 17 | 5. [config] section specifies the configuration of the alloy, etc. 18 | 19 | 6. [log] section specifies the settings of logging. 20 | 21 | The following sections describe the detail of each section. 22 | 23 | .. toctree:: 24 | :maxdepth: 1 25 | 26 | parameter_sampling 27 | parameter_mlref 28 | parameter_solver 29 | parameter_train 30 | parameter_observer 31 | parameter_config 32 | parameter_log 33 | 34 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/inputfiles/parameter_log.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [log] section 4 | ------------- 5 | 6 | This section specifies the log file name and the log level. 7 | 8 | 9 | Input Format 10 | ^^^^^^^^^^^^ 11 | Keywords and their values are specified by a keyword and its value in the form ``keyword = value``. 12 | Comments can also be entered by adding # (Subsequent characters are ignored). 13 | 14 | Keywords 15 | ^^^^^^^^^^ 16 | 17 | - ``level`` 18 | 19 | **Format :** str 20 | 21 | **Description :** 22 | Logging level. The following levels are available. 23 | 24 | - ``debug`` 25 | - ``info`` 26 | - ``warning`` 27 | - ``error`` 28 | 29 | - ``console`` 30 | 31 | **Format :** str 32 | 33 | **Description :** 34 | console output mode. 35 | 36 | - ``default`` will examine if MPI environment is available or not. 37 | - ``mpi`` for parallel environment in which rank numbers are shown in error log. 38 | - ``serial`` for serial environment. 39 | - ``none`` suppresses console output. 40 | 41 | - ``console_level`` 42 | 43 | **Format :** str 44 | 45 | **Description :** 46 | Logging level for console output. 47 | 48 | - ``logfile_path`` 49 | 50 | **Format :** str 51 | 52 | **Description :** 53 | Path to the log file. If not specified, logs will be send only to console. 54 | The parent directories will be automatically created if they are not present. 55 | 56 | - ``logfile_mode`` 57 | 58 | **Format :** str 59 | 60 | **Description :** 61 | MPI log type. 62 | 63 | - ``master`` will output logs to fiile only from rank=0. 64 | - ``collect`` will write messages from all ranks to one file. 65 | - ``workers`` will open one log file for each process designated by its rank. 66 | - ``serial`` will not consider parallel environment. 67 | 68 | - ``logfile_level`` 69 | 70 | **Format :** str 71 | 72 | **Description :** 73 | Logging level for log file output. 74 | 75 | - ``logfile_rank`` 76 | 77 | **Format :** int or list of int 78 | 79 | **Description :** 80 | MPI ranks from which logs are written to file. 81 | If not specified, all ranks are taken account of. 82 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/inputfiles/parameter_mlref.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [mlref] section 4 | ------------------------------- 5 | 6 | Set options for retrieving only atomic configurations from the results of RXMC calculations. 7 | This is used, for example, to evaluate the accuracy of neural network models and to extend the training data. 8 | The file format is as follows. 9 | 10 | :: 11 | 12 | [mlref] 13 | nreplicas = 3 14 | ndata = 50 15 | 16 | Input Format 17 | ^^^^^^^^^^^^^ 18 | 19 | Keywords and their values are specified by a keyword and its value in the form ``keyword = value``. 20 | Comments can also be entered by adding # (Subsequent characters are ignored). 21 | 22 | Key words 23 | ^^^^^^^^^^ 24 | 25 | - About replica 26 | 27 | - ``nreplicas`` 28 | 29 | **Format :** int (natural number) 30 | 31 | **Description :** The number of replicas. 32 | 33 | - ``ndata`` 34 | 35 | **Format :** int (natural number) 36 | 37 | **Description :** The number of data (configuration) to be sampled 38 | 39 | - ``sampler`` 40 | 41 | **Format :** string (default: "linspace") 42 | 43 | **Description :** The method to extract :math:`N_\text{data}` samples from :math:`N` samples generated by Monte Carlo method. 44 | 45 | - "linspace" 46 | 47 | Extract equilispaced samples by 48 | ``numpy.linspace(0, N-1, num=ndata, dtype=int)`` 49 | 50 | - "random" 51 | 52 | Random sampling by 53 | ``numpy.random.choice(range(N), size=ndata, replace=False)`` 54 | 55 | .. - Others 56 | .. 57 | .. - ``output_frequency`` 58 | .. 59 | .. **Format :** List of int (natural number) 60 | .. 61 | .. **Description :** The interval at which the placement is extracted is specified in the form of a list of [ ``nsteps`` , ``sample_frequency`` ]. Here, ``nsteps`` specifies the number of steps to be taken out of the number of configurations output by the RXMC calculation (the value of ``nsteps/sample_frequency`` in the ``[replica]`` section) and ``sample_frequency`` specifies the interval at which the configurations are taken out (the first number of steps to be taken out is fixed at 0). The input files for the ab initio solver corresponding to that arrangement are created in the respective folders. 62 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/inputfiles/parameter_observer.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [observer] section 4 | ------------------------------- 5 | 6 | This section specifies the physical quantity to be calculated. 7 | An example is shown as follows: 8 | 9 | :: 10 | 11 | [observer] 12 | [observer.similarity] 13 | reference_structure = './MgAl2O4.vasp' 14 | ignored_species = ["O"] 15 | 16 | [[observer.solver]] 17 | name = "magnetization" 18 | type = 'aenet' 19 | path= '~/opt/aenet/bin/predict.x_serial' 20 | base_input_dir = './baseinput_mag' 21 | perturb = 0.0 22 | run_scheme = 'subprocess' 23 | ignore_species = ["O"] 24 | 25 | Input Format 26 | ^^^^^^^^^^^^^ 27 | 28 | Keywords and their values are specified by a keyword and its value in the form ``keyword = value``. 29 | Comments can also be entered by adding # (Subsequent characters are ignored). 30 | 31 | Key words 32 | ^^^^^^^^^^ 33 | 34 | - ``[[observer.solver]]`` 35 | 36 | This section specifies a physical quantity to be calculated. 37 | This section can be specified multiple times. 38 | This section is the same as the ``sampling.solver`` section except for the ``name`` keyword. 39 | 40 | The quantity with the name ``energy`` is automatically calculated by using ``sampling.solver`` . 41 | 42 | - ``name`` 43 | 44 | **Format :** str 45 | 46 | **Description :** 47 | The name of the physical quantity to be calculated. 48 | After the calculation is completed, the expected value is output as a file named ``.dat``. 49 | 50 | - ``[observer.similarity]`` 51 | 52 | "Similarity" is a physical quantity that the ratio of the number of atoms of each element in the same place as the reference state. 53 | After the calculation is completed, the expected value is output as a file named ``similarity_X.dat`` (``X`` is the element symbol). 54 | When the ``reference_structure`` keyword is not specified, the similarity is not calculated. 55 | 56 | - ``reference_structure`` 57 | 58 | **Format :** str 59 | 60 | **Description :** 61 | Filename of the structure file of the reference state. 62 | 63 | - ``ignored_species`` 64 | 65 | **Format :** list 66 | 67 | **Description :** 68 | The atom species to be ignored when calculating the similarity. 69 | For example, if you want to ignore the similarity of oxygen atoms, specify ``["O"]``. 70 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/inputfiles/parameter_train.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [train] section 4 | ------------------------------- 5 | 6 | ``abics_train`` creates and trains a regression model from configurations to energies. 7 | Indeed, ``abics_train`` uses an external program to train the model. 8 | In the current version, Aenet, Nequip, and MLIP-3 are supported as an external program. 9 | For software-specific notes (such as input file names), see :ref:`trainer_specific_notes`. 10 | 11 | The input information for ``abics_train`` is described in the ``[trainer]`` section. The description of each parameter is as follows. 12 | An example is shown as follows: 13 | 14 | :: 15 | 16 | [trainer] # Configure the model trainer. 17 | type = 'aenet' 18 | base_input_dir = '. /aenet_train_input' 19 | exe_command = ['~/git/aenet/bin/generate.x-2.0.4-ifort_serial', 20 | 'srun ~/git/aenet/bin/train.x-2.0.4-ifort_intelmpi'] 21 | ignore_species = ["O"] 22 | 23 | Input Format 24 | ^^^^^^^^^^^^^ 25 | 26 | Keywords and their values are specified by a keyword and its value in the form ``keyword = value``. 27 | Comments can also be entered by adding # (Subsequent characters are ignored). 28 | 29 | Key words 30 | ^^^^^^^^^^ 31 | 32 | - ``type`` 33 | 34 | **Format :** str 35 | 36 | **Description :** The trainer to generate the neural network potential (currently 'aenet', 'nequip', and 'mlip_3' are available). 37 | 38 | - ``base_input_dir`` 39 | 40 | **Format :** str 41 | 42 | **Description :** 43 | Path of the directory containing the input files that the learner refers to. 44 | 45 | - ``exe_command`` 46 | 47 | **Format :** dict 48 | 49 | **Description :** 50 | List of commands to execute; if you use aenet, you need to specify the path to ``generate.x`` and ``train.x``. 51 | 52 | - ``type = 'aenet'`` 53 | 54 | - ``generate`` and ``train`` keys are required. 55 | - ``generate`` 56 | 57 | - Specify the path to ``generate.x`` of aenet. 58 | 59 | - ``train`` 60 | 61 | - Specify the path to ``train.x`` of aenet. 62 | - The MPI parallel version is available. In that case, set the command to execute MPI (e.g., ``srun``, ``mpirun``) . 63 | 64 | - Array format is supported for compatibility with abICS 2.0 and earlier. 65 | The first element is ``generate``, and the second element is ``train``. 66 | 67 | - ``type = 'nequip'`` 68 | 69 | - ``train`` 70 | 71 | - Specify the path to ``nequip-train``. 72 | 73 | - ``type = 'mlip_3'`` 74 | 75 | - ``train`` 76 | 77 | - Specify the path to ``mlp``. 78 | 79 | 80 | - ``ignore_species`` 81 | 82 | **Format :** list 83 | 84 | **Description :** 85 | Same as ``ignore_species`` in [sampling.solver] section. Specify atomic species to "ignore" in neural network models such as ``aenet``. For those that always have an occupancy of 1, it is computationally more efficient to ignore their presence when training and evaluating neural network models. 86 | 87 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/install/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | Install 3 | *************************** 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | install 8 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/install/install.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | Prerequisites 4 | ~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | abICS requires Python3 (>=3.9). 7 | 8 | The following Python packages are required. 9 | 10 | - numpy 11 | - scipy 12 | - toml 13 | - mpi4py 14 | - pymatgen (>=2019.12.3) 15 | - qe-tools 16 | 17 | These are installed automatically but mpi4py and pymatgen need extra software-packages before installing them. 18 | 19 | - mpi4py needs one of the MPI implementations, e.g., Open MPI. 20 | - pymatgen needs Cython:: 21 | 22 | $ pip3 install cython 23 | 24 | .. To use VASP as a solver, a patch must be applied to use MPI_COMM_SPAWN. If you wish to use it, please contact us (the e-mail address is written in :doc:`../contact/index` ). 25 | 26 | Install from PyPI 27 | ~~~~~~~~~~~~~~~~~~~~ 28 | 29 | Since abICS is registered in PyPI users can install abICS easily:: 30 | 31 | $ pip3 install abics 32 | 33 | If you want to install abICS locally because, for example, you have no permission to write files, the following command:: 34 | 35 | $ pip3 install --user abics 36 | 37 | installs abICS below a directory ``~/.local`` . 38 | If you want to install abICS into another directory, use the ``--prefix=DIRECTORY`` option (``DIRECTORY`` is the path to the directory where abICS will be installed) . 39 | 40 | Install from source 41 | ~~~~~~~~~~~~~~~~~~~~~~ 42 | 43 | Download 44 | .............. 45 | 46 | The source codes of abICS can be obtained from `GitHub page `_ . 47 | 48 | ``$ git clone https://github.com/issp-center-dev/abICS`` 49 | 50 | 51 | Directory structure 52 | ....................... 53 | 54 | The directory structure of abICS is given as follows: 55 | 56 | :: 57 | 58 | . 59 | |-- COPYING 60 | |-- README.md 61 | |-- abics/ 62 | | |-- __init__.py 63 | | |-- applications/ 64 | | |-- exception.py 65 | | |-- mc.py 66 | | |-- mc_mpi.py 67 | | |-- replica_params.py 68 | | |-- scripts/ 69 | | |-- util.py 70 | |-- docs/ 71 | | |-- sphinx/ 72 | |-- examples/ 73 | |-- pyproject.toml 74 | |-- test/ 75 | |-- tests/ 76 | 77 | 78 | A set of python modules are located in the ``abics`` directory. 79 | 80 | 81 | 82 | Install 83 | ........... 84 | 85 | - Pass the location of the root directory of abICS as an argument of ``pip3 install`` : 86 | 87 | $ pip3 install ./abICS 88 | 89 | Uninstall 90 | ~~~~~~~~~~ 91 | 92 | - ``pip3 uninstall abics`` uninstalls abics from your machine. 93 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/tools/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | Miscellaneous tools 3 | *************************** 4 | 5 | abICS comes with a few tools for facilitating typical workflows. 6 | 7 | * ``st2abics`` for preparing an abICS input file from a structure file. 8 | 9 | * ``abicsRXsepT`` for postprocessing of replica exchange Monte Carlo run. 10 | 11 | The following sections describe how to use each of these tools. 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | 16 | tools_st2abics 17 | tools_abicsRXsepT 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/tools/tools_abicsRXsepT.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | abicsRXsepT 4 | ------------------------------- 5 | 6 | This tool is for reordering the resulting structures and energies at each sampling step of 7 | a RXMC run by temperature. It is used after an abICS RXMC run is finished as:: 8 | 9 | $ mpiexec -np NPROCS abicsRXsepT input.toml NSKIP 10 | 11 | ``NPROCS`` should be equal to or larger than the number of replicas, and ``input.toml`` 12 | should be replaced by the abICS input file that was used for this run. 13 | ``NSKIP`` is an optional parameter and is used for specifying the number of thermalization steps to skip when calculating the energy averages at each temperature (default value is 0). 14 | The results are stored in the ``Tseparate`` directory, and energy averages vs. temperature are stored in ``Tseparate/energies_T.dat`` 15 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/tutorial/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | Tutorial 3 | *************************** 4 | 5 | In this tutorial, we demonstrate the calculation of the degree of inversion of Mg and Al atoms 6 | in an ionic crystal :math:`{\rm Mg}{\rm Al}_2 {\rm O}_4`. 7 | Input files are provided in ``examples/active_learning_qe/`` . 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | aenet 13 | other_models 14 | -------------------------------------------------------------------------------- /docs/sphinx/en/source/tutorial/vasp.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | Example by using VASP 4 | ===================== 5 | 6 | Preparing the input files for abICS 7 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | The input file of abICS is ``input_vasp.toml`` . 10 | Below, ``input_vasp.toml`` in ``examples/spinel`` is explained as an example. 11 | Only the ``[sampling.solver]`` section is differnt from that of QuantumESPRESSO. 12 | The ``[sampling.solver]`` section is specified as follows: 13 | 14 | :: 15 | 16 | [sampling.solver] 17 | type = 'vasp' 18 | path = './vasp' 19 | base_input_dir = './baseinput' 20 | perturb = 0.0 21 | run_scheme = 'mpi_spawn_ready' 22 | 23 | This examples sets ``type`` as ``vasp`` in order to use VASP. 24 | ``path`` specifies the path to ``vasp``. 25 | The directory that contains the input parameter files specific to each solver is given as ``./baseinput`` using ``base_input_dir``. 26 | ``perturb`` is a random parameter that shifts atomic positions for structural optimization, but in this example it is set to 0 not to perform structural optimization. 27 | 28 | abICS starts ``vasp`` with ``MPI_Comm_spawn``, so give ``mpi_spawn_ready`` as ``run_scheme`` .To use VASP as a solver, a patch must be applied to use MPI_COMM_SPAWN. If you wish to use it, please contact us (the e-mail address is written in :doc:`../contact/index` . 29 | 30 | Preparing the input file of VASP 31 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 | 33 | abICS generates the input files of the solver from the internal atomic structure, but information other than the structure, such as pseudopotential information, must be supplied by the user. 34 | In the case of VASP, such information is specified by ``INCAR``, ``POSCAR``, ``KPOINTS`` and ``POTCAR`` in ``base_input_dir``. Here, ``POTCAR`` file is not contained in the ``base_input_dir`` due to the VASP license. Before the calculation, generate ``POTCAR`` file from the ``O, Al, Mg`` pesudo potential files. 35 | Based on these files, an input file with unit cells and atomic structure is automatically generated. 36 | 37 | - Notes 38 | 39 | - The coordinate information of ``POSCAR`` will be overwritten by the input information of abICS, but it must be described. 40 | - In ``POTCAR`` file, please list pseudo potentials in alphabetical order of atoms. 41 | 42 | Execution and analysis 43 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | 45 | The procedures of execution and analysis are same as those of QE. 46 | If you do with 17 replicas and 1000 steps same as the exapmle of QE, the following result will be obtained 47 | 48 | .. image:: ../../../image/doi_vasp.png 49 | :width: 400px 50 | :align: center 51 | 52 | You can see that DOI increases as the temperature increases. 53 | -------------------------------------------------------------------------------- /docs/sphinx/image/al_scheme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/al_scheme.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/al_scheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/al_scheme.png -------------------------------------------------------------------------------- /docs/sphinx/image/alg_sampling.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/alg_sampling.eps -------------------------------------------------------------------------------- /docs/sphinx/image/alg_sampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/alg_sampling.png -------------------------------------------------------------------------------- /docs/sphinx/image/doi_17.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_17.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/doi_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_17.png -------------------------------------------------------------------------------- /docs/sphinx/image/doi_2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_2.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/doi_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_2.png -------------------------------------------------------------------------------- /docs/sphinx/image/doi_aenet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_aenet.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/doi_aenet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_aenet.png -------------------------------------------------------------------------------- /docs/sphinx/image/doi_qe.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_qe.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/doi_qe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_qe.png -------------------------------------------------------------------------------- /docs/sphinx/image/doi_vasp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_vasp.pdf -------------------------------------------------------------------------------- /docs/sphinx/image/doi_vasp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/doi_vasp.png -------------------------------------------------------------------------------- /docs/sphinx/image/schmatic_AR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/docs/sphinx/image/schmatic_AR.png -------------------------------------------------------------------------------- /docs/sphinx/ja/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = pyMC 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/sphinx/ja/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=python -msphinx 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | set SPHINXPROJ=pyMC 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The Sphinx module was not found. Make sure you have Sphinx installed, 20 | echo.then set the SPHINXBUILD environment variable to point to the full 21 | echo.path of the 'sphinx-build' executable. Alternatively you may add the 22 | echo.Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/about/index.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | abICS とは? 7 | =========================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | info 13 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/about/info.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 概要 7 | ------------------------------------------ 8 | abICSは、第一原理計算を再現する機械学習モデルを訓練し、 9 | 不規則系での統計熱力学サンプリングを高速に 10 | 実行するためのソフトウェアフレームワークです。 11 | 金属や酸化物合金などの多成分固体系に特に重点を置いています。 12 | 現在はaenetで実装されているニューラルネットワークポテンシャルを 13 | 機械学習モデルとして利用することができます。 14 | 機械学習の基となる第一原理計算用入力ファイルの自動生成にも対応しており、 15 | Quantum Espresso, VASP, OpenMXを利用することができます。 16 | サンプリングアルゴリズムは、拡張モンテカルロ法であるレプリカ交換モンテカルロ法(RXMC)とポピュレーションアニーリング・モンテカルロ法(PAMC)を実装しています。また、β版としてグランドカノニカルサンプリングに対応しています。 17 | 18 | 19 | 開発者 20 | ------------------------------------------ 21 | abICSは以下のメンバーで開発しています. 22 | 23 | - ver. 2.0- 24 | - 笠松 秀輔 (山形大学 学術研究院(理学部主担当)) 25 | - 本山 裕一 (東京大学 物性研究所) 26 | - 青山 龍美 (東京大学 物性研究所) 27 | - 吉見 一慶 (東京大学 物性研究所) 28 | - 杉野 修 (東京大学 物性研究所) 29 | 30 | - ver. 1.0 31 | - 笠松 秀輔 (山形大学 学術研究院(理学部主担当)) 32 | - 本山 裕一 (東京大学 物性研究所) 33 | - 吉見 一慶 (東京大学 物性研究所) 34 | - 山本 良幸 (東京大学 物性研究所) 35 | - 杉野 修 (東京大学 物性研究所) 36 | - 尾崎 泰助 (東京大学 物性研究所) 37 | 38 | 39 | バージョン履歴 40 | ------------------------------------------ 41 | 42 | - ver.2.2.1 : 2024/12/06. 43 | - ver.2.2.0 : 2024/11/07. 44 | - ver.2.1.0 : 2023/06/12. 45 | - ver.2.0.1 : 2022/11/04. 46 | - ver.2.0 : 2022/06/24. 47 | - ver.1.0 : 2020/05/01. 48 | - ver.1.0-beta : 2020/03/31. 49 | - ver.0.1 : 2019/12/09. 50 | 51 | 52 | ライセンス 53 | -------------- 54 | 本ソフトウェアのプログラムパッケージおよびソースコード一式はGNU General Public License version 3 (GPL v3) に準じて配布されています。 55 | 56 | abICSを引用する際は, 以下の文献を引用してください。 57 | 58 | Shusuke Kasamatsu, Yuichi Motoyama, Kazuyoshi Yoshimi, Tatsumi Aoyama, “Configuration sampling in multi-component multi-sublattice systems enabled by ab Initio Configuration Sampling Toolkit (abICS)”, `accepted in STAM: Methods `_ (`arXiv:2309.04769 `_). 59 | 60 | Bibtex:: 61 | 62 | @article{kasamatsu2023configuration, 63 | author = {Shusuke Kasamatsu, Yuichi Motoyama, Kazuyoshi Yoshimi and Tatsumi Aoyama}, 64 | title = {Configuration sampling in multi-component multi-sublattice systems enabled by ab initio Configuration sampling toolkit ({abICS})}, 65 | journal = {Science and Technology of Advanced Materials: Methods}, 66 | volume = {0}, 67 | number = {ja}, 68 | pages = {2284128}, 69 | year = {2023}, 70 | publisher = {Taylor & Francis}, 71 | doi = {10.1080/27660400.2023.2284128}, 72 | URL = {https://doi.org/10.1080/27660400.2023.2284128}, 73 | eprint = {https://doi.org/10.1080/27660400.2023.2284128} 74 | 75 | コピーライト 76 | ------------------ 77 | 78 | *(c) 2019- The University of Tokyo. All rights reserved.* 79 | 80 | 本ソフトウェアは2019, 2022年度 東京大学物性研究所 ソフトウェア高度化プロジェクトの支援を受け開発されており、その著作権は東京大学が所持しています。 81 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/acknowledge/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | 謝辞 3 | *************************** 4 | 5 | このソフトウェアの開発は, 様々なプロジェクトとコンピューター資源の提供によりサポートされてきました。この場を借りて感謝します。 6 | 7 | - ポスト「京」重点課題5 8 | - 東京大学物性研究所スーパーコンピュータ共同利用 9 | - 文部科学省卓越研究員事業 10 | - 科学研究費補助金(No. JP18H05519, No. 19K15287) 11 | - JST CREST (No. JPMJCR15Q3, No. 19K15287) 12 | - NEDO 13 | 14 | また, abICS は東京大学物性研究所 ソフトウェア高度化プロジェクト (2019,2022年度) の支援を受け開発されました。この場を借りて感謝します。 15 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/contact/index.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | お問い合わせ 7 | ========================================= 8 | 9 | abICS に関するお問い合わせはこちらにお寄せください。 10 | 11 | - バグ報告 12 | 13 | abICS のバグ関連の報告は `GitHubのIssues `_ で受け付けています。 14 | 15 | バグを早期に解決するため、報告時には次のガイドラインに従ってください。 16 | 17 | - 使用している abICS のバージョンを指定してください。 18 | 19 | - インストールに問題がある場合には、使用しているオペレーティングシステムとコンパイラの情報についてお知らせください. 20 | 21 | - 実行に問題が生じた場合は, 実行に使用した入力ファイルとその出力を記載してください。 22 | 23 | - その他 24 | 25 | 研究に関連するトピックなどGitHubのIssuesで相談しづらいことを問い合わせる際には, 以下の連絡先にコンタクトをしてください。 26 | 27 | E-mail: ``abics-dev__at__issp.u-tokyo.ac.jp`` (_at_を@に変更してください) 28 | 29 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/index.rst: -------------------------------------------------------------------------------- 1 | .. pyMC documentation master file, created by 2 | sphinx-quickstart on Wed Jul 31 13:13:22 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to abICS's documentation! 7 | ========================================= 8 | 9 | Contents 10 | -------- 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :numbered: 3 15 | 16 | about/index 17 | install/index 18 | how_to_use/index 19 | tutorial/index 20 | inputfiles/index 21 | outputfiles/index 22 | tools/index 23 | algorithm/index 24 | acknowledge/index 25 | contact/index 26 | 27 | Indices and tables 28 | ================== 29 | 30 | * :ref:`genindex` 31 | * :ref:`modindex` 32 | * :ref:`search` 33 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/inputfiles/index.rst: -------------------------------------------------------------------------------- 1 | .. _input-format: 2 | 3 | *************************** 4 | 入力ファイルフォーマット 5 | *************************** 6 | 7 | abICSの入力ファイルは, 以下の5つのセクションから構成されます. 8 | 9 | 1. [sampling] セクション 10 | 11 | レプリカ数や温度の幅, モンテカルロステップ数など,レプリカ交換モンテカルロ部分のパラメータを指定します.また、利用するソルバーの種類 (VASP, QE, ...)、ソルバーへのパス、不変な入力ファイルのあるディレクトリなど(第一原理計算)ソルバーのパラメータを指定します. 12 | 13 | 2. [mlref] セクション 14 | 15 | ニューラルネットワークモデルの精度評価と訓練データの拡張などを行うため、サンプリングの結果から原子配置のみを取り出す際のオプションを設定します. ``abics_mlref`` のみで使用されます. また、訓練データを作成するために利用するソルバーの種類 (VASP, QE, ...)、ソルバーへのパス、不変な入力ファイルのあるディレクトリなど(第一原理計算)ソルバーのパラメータを指定します. 16 | 17 | 3. [train] セクション 18 | 19 | 訓練データから配置エネルギー予測モデルを学習する学習器の設定を行います. ``abics_train`` のみで使用されます. 20 | 21 | 4. [observer] セクション 22 | 23 | 取得する物理量の種類などを指定します. 24 | 25 | 5. [config] セクション 26 | 27 | 合金の配位などを指定します. 28 | 29 | 6. [log] セクション 30 | 31 | ログの出力先などを指定します. 32 | 33 | 34 | 以下, 順に各セクションの詳細について説明します. 35 | 36 | .. toctree:: 37 | :maxdepth: 1 38 | 39 | parameter_sampling 40 | parameter_mlref 41 | parameter_solver 42 | parameter_train 43 | parameter_observer 44 | parameter_config 45 | parameter_log 46 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/inputfiles/parameter_log.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [log] セクション 4 | ---------------- 5 | 6 | このセクションはログファイル名とログレベルを指定します。 7 | 8 | 9 | 入力形式 10 | ^^^^^^^^^^^^ 11 | ``keyword = values`` の形式でキーワードとその値を指定します. 12 | また, #をつけることでコメントを入力することができます(それ以降の文字は無視されます). 13 | 14 | キーワード 15 | ^^^^^^^^^^ 16 | 17 | - ``level`` 18 | 19 | **形式 :** str 20 | 21 | **説明 :** 22 | ログレベルを指定します. 以下のレベルが利用可能です. 23 | 24 | - ``debug`` 25 | - ``info`` 26 | - ``warning`` 27 | - ``error`` 28 | 29 | - ``console`` 30 | 31 | **形式 :** str 32 | 33 | **説明 :** 34 | コンソールに出力するかどうかを指定します. 選択可能な値は以下の通りです. 35 | 36 | - ``default`` はMPI環境が利用可能かどうかを自動判定します. 37 | - ``mpi`` はMPI環境であることを明示的に指定します. 38 | - ``serial`` はMPI環境でないことを明示的に指定します. 39 | - ``none`` はコンソールに出力しません. 40 | 41 | - ``console_level`` 42 | 43 | **形式 :** str 44 | 45 | **説明 :** 46 | コンソールに出力するログレベルを指定します. 47 | 48 | - ``logfile_path`` 49 | 50 | **形式 :** str 51 | 52 | **説明 :** 53 | ログファイルのパスを指定します. 指定しない場合はコンソールに出力します. 54 | ディレクトリが存在しない場合は自動的に作成されます. 55 | 56 | - ``logfile_mode`` 57 | 58 | **形式 :** str 59 | 60 | **説明 :** 61 | MPI 環境でのログファイル出力方法を指定します. 62 | 63 | - ``master`` はランク0のみログをファイルに出力します. 64 | - ``collect`` は全ランクのログを一つのファイルに出力します. 65 | - ``workers`` は各ランクごとにファイルを作成します. 66 | - ``serial`` はMPI環境を考慮しません. 67 | 68 | - ``logfile_level`` 69 | 70 | **形式 :** str 71 | 72 | **説明 :** 73 | ログファイル出力するログレベルを指定します. 74 | 75 | - ``logfile_rank`` 76 | 77 | **形式 :** int or list of int 78 | 79 | **説明 :** 80 | ログファイルに出力するMPIランクを指定します. 81 | 指定しない場合、全ランクが対象となります. 82 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/inputfiles/parameter_mlref.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [mlref] セクション 4 | ------------------------------- 5 | 6 | MC計算の結果から原子配置のみを取り出す際のオプションを設定します. 7 | 例えばニューラルネットワークモデルの精度評価と訓練データの拡張などに利用します. 8 | 9 | 以下のようなファイルフォーマットをしています. 10 | 11 | :: 12 | 13 | [mlref] 14 | nreplicas = 3 15 | ndata = 50 16 | 17 | 18 | 入力形式 19 | ^^^^^^^^^^^^ 20 | ``keyword = value`` の形式でキーワードとその値を指定します. 21 | また, #をつけることでコメントを入力することができます(それ以降の文字は無視されます). 22 | 23 | キーワード 24 | ^^^^^^^^^^ 25 | 26 | - レプリカに関する指定 27 | 28 | - ``nreplicas`` 29 | 30 | **形式 :** int型 (自然数) 31 | 32 | **説明 :** レプリカ数を指定します. 33 | 34 | - ``ndata`` 35 | 36 | **形式 :** int型 (自然数) 37 | 38 | **説明 :** 取り出すデータ(原子配位)の数 39 | 40 | - ``sampler`` 41 | 42 | **形式 :** 文字列 ("linspace" or "random", デフォルトは "linspace") 43 | 44 | **説明 :** :math:`N` 個生成されている MC サンプルから :math:`N_\text{data}` のデータをどのようにして取り出すか. 45 | 46 | - "linspace" 47 | 48 | ``numpy.linspace(0, N-1, num=ndata, dtype=int)`` を用いて等間隔に取り出す 49 | 50 | - "random" 51 | 52 | ``numpy.random.choice(range(N), size=ndata, replace=False)`` を用いたランダムサンプリング 53 | 54 | .. - その他 55 | .. 56 | .. - ``output_frequency`` 57 | .. 58 | .. **形式 :** list型 (自然数) 59 | .. 60 | .. **説明 :** ``nsteps`` をRXMC計算で出力される配置の数( ``[replica]`` セクションの ``nsteps/sample_frequency`` の値)のうち何ステップまでを取り出すかのステップ数、 ``sample_frequency`` を配置を抜き出してくる間隔として、 [ ``nsteps`` , ``sample_frequency`` ] のlist形式で配置を抜き出す間隔を指定します(抜き出す最初のステップ数は0に固定しています)。その配置に対応する第一原理計算ソルバーの入力ファイルが各フォルダ内に作成されます。 61 | 62 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/inputfiles/parameter_observer.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [observer] セクション 4 | ------------------------------- 5 | 6 | 計算する物理量を指定します. 7 | 以下のようなファイルフォーマットをしています. 8 | 9 | :: 10 | 11 | [observer] 12 | [observer.similarity] 13 | reference_structure = './MgAl2O4.vasp' 14 | ignored_species = ["O"] 15 | 16 | [[observer.solver]] 17 | name = "magnetization" 18 | type = 'aenet' 19 | path= '~/opt/aenet/bin/predict.x_serial' 20 | base_input_dir = './baseinput_mag' 21 | perturb = 0.0 22 | run_scheme = 'subprocess' 23 | ignore_species = ["O"] 24 | 25 | 26 | 入力形式 27 | ^^^^^^^^^^^^ 28 | ``keyword = value`` の形式でキーワードとその値を指定します. 29 | また, #をつけることでコメントを入力することができます(それ以降の文字は無視されます). 30 | 31 | キーワード 32 | ^^^^^^^^^^ 33 | 34 | - ``[[observer.solver]]`` 35 | 36 | 物理量を計算するためのオプションを指定します. 37 | 本セクションは複数指定することができます. 38 | ``name`` を除き, ``sampling.solver`` セクションと同様の形式で指定します. 39 | 40 | なお、 ``name = "energy"`` という物理量については、 ``sampling.solver`` セクションで指定したものが自動的に適用されます. 41 | 42 | - ``name`` 43 | 44 | **形式 :** str型 45 | 46 | **説明 :** 47 | 物理量の名前を指定します. 48 | 計算終了後、温度ごとの期待値として, ``.dat`` というファイルが出力されます. 49 | 50 | - ``[observer.similarity]`` 51 | 52 | 原子配置の「類似度(similarity)」を計算するためのオプションを指定します. 53 | 類似度は元素種ごとに、参照状態と同じ場所にある原子の割合として計算されます. 54 | 計算終了後、温度ごとの期待値として ``similarity_X.dat`` というファイルが出力されます (``X`` は元素記号). 55 | 本サブセクションが指定されていない場合は、類似度は計算されません. 56 | 57 | - ``reference_structure`` 58 | 59 | **形式 :** str型 60 | 61 | **説明 :** 62 | 参照状態の構造ファイルを指定します. 63 | 64 | - ``ignored_species`` 65 | 66 | **形式 :** list型 67 | 68 | **説明 :** 69 | 類似度を計算する際に無視する原子種を指定します. 70 | 例えば, 酸素を固定した計算の場合には、このキーワードに ``["O"]`` を指定します. 71 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/inputfiles/parameter_train.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | [train] セクション 4 | ------------------------------- 5 | 6 | 訓練データから配置エネルギー予測モデルを学習する学習器の設定を行います。 7 | 8 | 予測モデルの作成・学習には外部のプログラムを利用します。 9 | 現在はaenet, NequIP, MLIP-3に対応しています。 10 | ソフトウェア固有の注意事項(入力ファイル名など)は :ref:`trainer_specific_notes` を参照してください. 11 | 12 | 本セクションは以下のようなファイルフォーマットをしています. 13 | 14 | .. code-block:: toml 15 | 16 | [train] # モデル学習器の設定 17 | type = 'aenet' 18 | base_input_dir = './aenet_train_input' 19 | ignore_species = ["O"] 20 | [train.exe_command] 21 | generate = '~/git/aenet/bin/generate.x-2.0.4-ifort_serial' 22 | train = 'srun ~/git/aenet/bin/train.x-2.0.4-ifort_intelmpi' 23 | 24 | 25 | 入力形式 26 | ^^^^^^^^^^^^ 27 | ``keyword = value`` の形式でキーワードとその値を指定します. 28 | また, #をつけることでコメントを入力することができます(それ以降の文字は無視されます). 29 | 30 | キーワード 31 | ^^^^^^^^^^ 32 | 33 | - ``type`` 34 | 35 | **形式 :** str型 36 | 37 | **説明 :** 38 | 訓練データから配置エネルギー予測モデルを学習する学習器の設定を行います. 39 | aenet, nequip, mlip_3を利用できます. 40 | 41 | 42 | - ``base_input_dir`` 43 | 44 | **形式 :** str型 45 | 46 | **説明 :** 47 | 設定したディレクトリの中に、学習器の設定ファイルを設置します. 48 | 49 | 50 | - ``exe_command`` 51 | 52 | **形式 :** 辞書型 53 | 54 | **説明 :** 55 | 学習器で使う実行コマンドを指定します. 56 | コマンドライン引数も指定できますが, それぞれの学習機の入力ファイル (``input.yaml`` など)は含めないようにしてください. 57 | 58 | - ``type = 'aenet'`` 59 | 60 | - ``generate`` と ``train`` の2つのキーを持ちます. 61 | - ``generate`` 62 | 63 | - aenetの ``generate.x`` へのパスを指定します. 64 | 65 | - ``train`` 66 | 67 | - aenetの ``train.x`` へのパスを指定します. 68 | - MPI並列版が利用可能です. その場合、上の例で示すように、MPI実行するためのコマンド( ``srun`` 、 ``mpirun`` など)を合わせて設定してください。 69 | 70 | - abICS 2.0 以前との互換性のために、配列形式もサポートしています. 71 | 最初の要素が ``generate``, 2番目の要素が ``train`` です. 72 | 73 | - ``type = 'nequip'`` 74 | 75 | - ``train`` 76 | 77 | - ``nequip-train`` へのパスを指定します. 78 | 79 | - ``type = 'mlip_3'`` 80 | 81 | - ``train`` 82 | 83 | - ``mlp`` へのパスを指定します. 84 | 85 | 86 | - ``ignore_species`` 87 | 88 | **形式 :** list型 89 | 90 | **説明 :** 91 | ``aenet`` などのニューラルネットワークモデルで「無視」する原子種を指定します. 常に占有率が1のものについては、ニューラルネットワークモデルの訓練および評価時に存在を無視した方が、計算効率が高くなります. 92 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/install/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | インストール方法 3 | *************************** 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | install 8 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/install/install.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | 必要なライブラリ・環境 4 | ~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | abICS をインストール・実行するには、 バージョン3.9 以上の Python が必要です。 7 | また、以下の Python パッケージが必要です。 8 | 9 | - numpy 10 | - scipy 11 | - toml 12 | - mpi4py 13 | - pymatgen (>=2019.12.3) 14 | - qe-tools 15 | 16 | これらのライブラリは自動でインストールされますが、 mpi4py と pymatgen はあらかじめ関連ソフトウェアが必要です。 17 | 18 | - mpi4py をインストールするには、なんらかのMPI 環境をあらかじめインストールしておく必要があります。 19 | - pymatgen をインストールするには、 Cython をインストールしておく必要があります。:: 20 | 21 | $ pip3 install cython 22 | 23 | .. VASPをソルバーとして利用する際には、MPI_COMM_SPAWNを利用するためのパッチをあてる必要があります。利用されたい場合には、:doc:`../contact/index` のその他に記載された連絡先までご連絡ください。 24 | 25 | 26 | PyPI からインストールする 27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 | 29 | abICS は PyPI に登録されているため、 ``pip`` コマンドで簡単にインストールできます。:: 30 | 31 | $ pip3 install abics 32 | 33 | 書き込み権限がないなどで、ユーザローカルのディレクトリにインストールする場合には ``--user`` オプションを追加してください。 34 | この場合、 ``~/.local/`` 以下に実行可能スクリプトやライブラリがインストールされます。 35 | また、インストールディレクトリを指定したい場合には、 ``--prefix=DIRECTORY`` ( ``DIRECTORY`` はインストールしたいディレクトリ) オプションを指定してください: 36 | 37 | ``$ pip3 install --user abics`` 38 | 39 | 40 | ソースからインストールする 41 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | 43 | 多くの場合には PyPI からインストールすれば良いですが、機能追加する場合などはソースからインストールしてください。 44 | 45 | ダウンロード 46 | .................. 47 | 48 | abICS のソースコードは `GitHub page `_ からダウンロードできます。 49 | 50 | ``$ git clone https://github.com/issp-center-dev/abICS`` 51 | 52 | 53 | ディレクトリ構成 54 | ....................... 55 | 56 | abICSのディレクトリ構成は以下のようになっています. 57 | pythonモジュールは ``abics`` ディレクトリ以下に一式格納されています. 58 | 59 | :: 60 | 61 | . 62 | |-- COPYING 63 | |-- README.md 64 | |-- abics/ 65 | | |-- __init__.py 66 | | |-- applications/ 67 | | |-- exception.py 68 | | |-- mc.py 69 | | |-- mc_mpi.py 70 | | |-- replica_params.py 71 | | |-- scripts/ 72 | | |-- util.py 73 | |-- docs/ 74 | | |-- sphinx/ 75 | |-- examples/ 76 | |-- pyproject.toml 77 | |-- test/ 78 | |-- tests/ 79 | 80 | 81 | 82 | 83 | インストール 84 | ................. 85 | 86 | - ``pip3 install`` の引数に abICS のルートディレクトリを渡すことでインストール可能です :: 87 | 88 | $ pip3 install ./abICS 89 | 90 | 91 | アンインストール 92 | ~~~~~~~~~~~~~~~~~ 93 | 94 | - ``pip3 uninstall abics`` でアンインストールできます. 95 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/tools/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | 付属ツール 3 | *************************** 4 | 5 | abICSには、典型的なワークフローを容易にするためのツールがいくつか付属しています。 6 | 7 | * 原子構造ファイルからabICS入力ファイルを作成するための ``st2abics`` 8 | 9 | * レプリカ交換モンテカルロ計算実行の後処理を行うための ``abicsRXsepT`` 10 | 11 | 以下のセクションでは、これらのツールのそれぞれの使用方法を説明します。 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | 16 | tools_st2abics 17 | tools_abicsRXsepT 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/tools/tools_abicsRXsepT.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | abicsRXsepT 4 | ------------------------------- 5 | 6 | このツールは、RXMC実行の各サンプリングステップで得られる構造とエネルギーを 7 | 温度ごとに並べ替えるためのツールです。abICSのRXMC実行が終了した後に使用します:: 8 | 9 | $ mpiexec -np NPROCS abicsRXsepT input.toml NSKIP 10 | 11 | ``NPROCS`` はレプリカの数と同じかそれ以上でなければならず、``input.toml`` はabICSの実行に使用された 12 | abICS入力ファイルに置き換える必要があります。 13 | ``NSKIP`` はオプションのパラメータで、 14 | 各温度でのエネルギー平均を計算する際にスキップする初期ステップ数を指定します(デフォルト値は0)。 15 | 結果は ``Tseparate`` ディレクトリに保存され、温度ごとのエネルギー平均は ``Tseparate/energies_T.dat`` に保存されます。 16 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/tutorial/index.rst: -------------------------------------------------------------------------------- 1 | *************************** 2 | チュートリアル 3 | *************************** 4 | 5 | このチュートリアルでは多元系イオン結晶 :math:`{\rm Mg}{\rm Al}_2 {\rm O}_4` の Mg, Al 原子の反転度計算を例に、abICSの利用方法について説明します。 6 | 入力ファイルは ``examples/active_learning_qe/`` にあります。 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | aenet 12 | other_models 13 | -------------------------------------------------------------------------------- /docs/sphinx/ja/source/tutorial/vasp.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: none 2 | 3 | VASP を用いた例 4 | ============================ 5 | 6 | abICS の入力ファイルの準備 7 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | abICS の入力ファイルは ``input_vasp.toml`` です。 10 | 以下、 ``examples/spinel`` にある ``input_vasp.toml`` を例に説明します。 11 | ``[sampling.solver]`` セクションのみ、QuantumESPRESSOと異なり、以下のように指定しています。 12 | 13 | :: 14 | 15 | [sampling.solver] 16 | type = 'vasp' 17 | path = './vasp' 18 | base_input_dir = './baseinput' 19 | perturb = 0.0 20 | run_scheme = 'mpi_spawn_ready' 21 | 22 | VASP を用いるために ``type`` を ``'vasp'`` にしています。 23 | また、VASP のエネルギー計算ソルバー ``vasp`` が、実行箇所にあることを ``path`` で指定しています(シンボリックリンクでも構いません)。 24 | ソルバーごとに固有の入力パラメータファイルが収められたディレクトリとして、 ``base_input_dir`` を用いて ``./baseinput`` を指定しています。 25 | ``perturb`` は構造最適化のために原子位置を乱数でずらすパラメータですが、今回は構造最適化を行わないために 0 にしてあります。 26 | abICS は ``vasp`` を ``MPI_Comm_spawn`` で起動するため、 ``run_scheme`` として ``mpi_spawn_ready`` を与えます(VASPをソルバーとして利用する際には、MPI_COMM_SPAWNを利用するためのパッチをあてる必要があります。利用されたい場合には、:doc:`../contact/index` のその他に記載された連絡先までご連絡ください)。 27 | 28 | VASP の入力ファイルの準備 29 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | 31 | abICS では、内部で保持した原子座標をもとに VASP の入力ファイルを生成します。それ以外の情報は、ユーザが与える必要があります。 32 | この情報は ``base_input_dir`` で指定したディレクトリの中に ``INCAR`` 、 ``POSCAR`` 、 ``KPOINTS`` があります。 33 | 上記のファイル以外にも、 ``POTCAR`` がVASPの実行には必要となりますが、ライセンスの関係上、サンプルファイルにはおいてありません。 34 | 実行前には ``O, Al, Mg`` の擬ポテンシャルファイルから ``POTCAR`` ファイルを作成してください。 35 | これらのファイルをもとに、ユニットセルや原子座標などを書き換えた入力ファイルが自動生成されます。 36 | 37 | - 注意点 38 | 39 | - ``POSCAR`` の座標情報はabICSの入力情報で上書きされますが、内部処理を行うために記載する必要があるのでご注意ください。 40 | - ``POTCAR`` は原子のアルファベット順に記載してください。 41 | 42 | 43 | 実行・解析 44 | ~~~~~~~~~~~~~~~~~~ 45 | 46 | 実行・解析の手順はQEの場合と同様です. 47 | QEの例と同じように、17 レプリカ、1000 ステップで計算をすると 48 | 49 | .. image:: ../../../image/doi_vasp.png 50 | :width: 400px 51 | :align: center 52 | 53 | といった結果が得られ、同様の結果が得られることがわかります。 54 | -------------------------------------------------------------------------------- /examples/active_learning_qe/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 8 4 | #SBATCH -n 1024 5 | #SBATCH -J spinel 6 | #SBATCH -c 1 7 | #SBATCH --time=0:30:00 8 | 9 | # Run reference DFT calc. 10 | # module purge 11 | # module load intel_compiler/2019.5.281 12 | # module load openmpi/4.0.4-intel-2019.5.281 13 | 14 | # source XXX 15 | 16 | echo start AL sample 17 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 18 | 19 | echo start parallel_run 1 20 | sh parallel_run.sh 21 | 22 | echo start AL final 23 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 24 | 25 | #train 26 | # module purge 27 | # module load intel_compiler/2020.2.254 28 | # module load intel_mpi/2020.2.254 29 | 30 | echo start training 31 | abics_train input.toml >> abics_train.out 32 | 33 | echo Done 34 | -------------------------------------------------------------------------------- /examples/active_learning_qe/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 1 4 | #SBATCH -n 8 5 | #SBATCH --time=00:30:00 6 | 7 | # module purge 8 | # module load intel_compiler/2019.5.281 9 | # module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | # source XXX 12 | 13 | #sleep 30 14 | srun -n 8 abics_sampling input.toml >> abics_sampling.out 15 | 16 | echo Done 17 | -------------------------------------------------------------------------------- /examples/active_learning_qe/aenet_train_input/generate/Al.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Al 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_qe/aenet_train_input/generate/Mg.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Mg 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_qe/aenet_train_input/generate/generate.in.head: -------------------------------------------------------------------------------- 1 | OUTPUT aenet.train 2 | 3 | TYPES 4 | 2 5 | Al -0.0 ! eV 6 | Mg -0.0 ! eV 7 | 8 | SETUPS 9 | Al Al.fingerprint.stp 10 | Mg Mg.fingerprint.stp 11 | 12 | -------------------------------------------------------------------------------- /examples/active_learning_qe/aenet_train_input/predict/predict.in: -------------------------------------------------------------------------------- 1 | TYPES 2 | 2 3 | Mg 4 | Al 5 | 6 | 7 | NETWORKS 8 | Mg Mg.15t-15t.nn 9 | Al Al.15t-15t.nn 10 | 11 | 12 | VERBOSITY low 13 | 14 | -------------------------------------------------------------------------------- /examples/active_learning_qe/aenet_train_input/train/train.in: -------------------------------------------------------------------------------- 1 | TRAININGSET aenet.train 2 | TESTPERCENT 10 3 | ITERATIONS 500 4 | 5 | MAXENERGY 10000 6 | 7 | TIMING 8 | 9 | !SAVE_ENERGIES 10 | 11 | METHOD 12 | !lm batchsize=4000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 13 | bfgs 14 | 15 | !METHOD 2 Steepest Descent 16 | !online_sd gamma=5.0d-7 alpha=0.25d0 17 | !online_sd gamma=1.0d-8 alpha=0.25d0 18 | ! 19 | !METHOD 3 Extended Kalman Filter 20 | !ekf 21 | ! 22 | !METHOD 4 Levenberg-Marquardt 23 | !lm batchsize=8000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 24 | 25 | NETWORKS 26 | ! atom network hidden 27 | ! types file-name layers nodes:activation 28 | Al Al.15t-15t.nn 2 15:tanh 15:tanh 29 | Mg Mg.15t-15t.nn 2 15:tanh 15:tanh -------------------------------------------------------------------------------- /examples/active_learning_qe/allegro_train_input/train/input.yaml: -------------------------------------------------------------------------------- 1 | root: results/spinel 2 | run_name: run 3 | seed: 123 4 | dataset_seed: 456 5 | 6 | # network 7 | AllegroBesselBasis_trainable: true 8 | bessel_frequency_cutoff: 4 9 | PolynomialCutoff_p: 6 10 | l_max: 1 11 | r_max: 8.0 12 | parity: o3_full 13 | num_layers: 2 14 | 15 | num_tensor_features: 16 16 | tensors_mixing_mode: p 17 | two_body_latent_mlp_latent_dimensions: [32, 64] 18 | two_body_latent_mlp_nonlinearity: silu 19 | latent_mlp_latent_dimensions: [64, 64] 20 | latent_mlp_nonlinearity: silu 21 | latent_mlp_initialization: uniform 22 | latent_resnet: true 23 | env_embed_mlp_latent_dimensions: [] 24 | env_embed_mlp_nonlinearity: null 25 | env_embed_mlp_initialization: uniform 26 | edge_eng_mlp_latent_dimensions: [16] 27 | edge_eng_mlp_nonlinearity: null 28 | edge_eng_mlp_initialization: uniform 29 | 30 | model_builders: 31 | - allegro.model.Allegro 32 | - PerSpeciesRescale 33 | - RescaleEnergyEtc 34 | 35 | 36 | dataset: ase 37 | dataset_file_name: structure.xyz 38 | chemical_symbols: 39 | - Mg 40 | - Al 41 | 42 | # logging 43 | wandb: false 44 | # verbose: debug 45 | 46 | # training 47 | n_train: 80% 48 | n_val: 20% 49 | batch_size: 5 50 | train_val_split: random 51 | #shuffle: true 52 | metrics_key: validation_loss 53 | use_ema: true 54 | ema_decay: 0.99 55 | ema_use_num_updates: true 56 | max_epochs: 100 57 | learning_rate: 0.01 58 | # loss function 59 | loss_coeffs: total_energy 60 | -------------------------------------------------------------------------------- /examples/active_learning_qe/baseinput_ref/download_pp.sh: -------------------------------------------------------------------------------- 1 | mkdir -p pseudo 2 | for file in \ 3 | Al.pbe-nl-kjpaw_psl.1.0.0.UPF \ 4 | Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF \ 5 | O.pbe-n-kjpaw_psl.1.0.0.UPF 6 | do 7 | wget https://pseudopotentials.quantum-espresso.org/upf_files/$file 8 | mv $file pseudo 9 | done 10 | -------------------------------------------------------------------------------- /examples/active_learning_qe/baseinput_ref/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'relax' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = './pseudo' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-8 18 | electron_maxstep = 100 19 | / 20 | &ions 21 | / 22 | ATOMIC_SPECIES 23 | Al 26.981 Al.pbe-nl-kjpaw_psl.1.0.0.UPF 24 | Mg 24.305 Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 25 | O 16.000 O.pbe-n-kjpaw_psl.1.0.0.UPF 26 | ATOMIC_POSITIONS crystal 27 | 28 | K_POINTS gamma 29 | -------------------------------------------------------------------------------- /examples/active_learning_qe/calc_DOI.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | from pymatgen.core import Structure 19 | from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator 20 | import os, sys 21 | import numpy as np 22 | import scipy.constants as constants 23 | from abics.mc_mpi import RXParams 24 | 25 | throwout = 1 26 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 27 | rxparams = RXParams.from_toml(tomlfile) 28 | nreplicas = rxparams.nreplicas 29 | comm = MPI.COMM_WORLD 30 | 31 | spinel_struct = Structure.from_file("MgAl2O4.vasp") 32 | Asite_struct = spinel_struct.copy() 33 | Asite_struct.remove_species(["Al", "O"]) 34 | 35 | 36 | matcher = StructureMatcher( 37 | ltol=0.1, 38 | primitive_cell=False, 39 | allow_subset=True, 40 | comparator=FrameworkComparator(), 41 | ignored_species=["O"], 42 | ) 43 | 44 | 45 | def calc_DOI(structure): 46 | asites = matcher.get_mapping(structure, Asite_struct) 47 | x = 0 48 | species = [str(sp) for sp in structure.species] 49 | for i in asites: 50 | if species[i] == "Al": 51 | x += 1 52 | x /= float(len(asites)) 53 | return x 54 | 55 | 56 | myT = comm.Get_rank() 57 | kTs = np.load(open("./kTs.npy", "rb")) 58 | 59 | if myT < nreplicas: 60 | Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb")) 61 | nstep = len(Trank_hist) 62 | os.chdir("Tseparate/{}".format(myT)) 63 | DOI = [] 64 | for i in range(nstep): 65 | DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i)))) 66 | DOI = np.array(DOI) 67 | np.savetxt("DOI.dat", DOI) 68 | DOImean = DOI[throwout:].mean() 69 | os.chdir("..") 70 | myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K") 71 | 72 | for i in range(len(kTs)): 73 | comm.Barrier() 74 | if myT != i: 75 | continue 76 | outfi = open("DOI_T.dat", "a") 77 | outfi.write("{:6.1f} \t".format(myT_kelvin)) 78 | outfi.write("{}\n".format(DOImean)) 79 | outfi.close() 80 | 81 | -------------------------------------------------------------------------------- /examples/active_learning_qe/mlip-3_train_input/train/input.almtp: -------------------------------------------------------------------------------- 1 | MTP 2 | version = 1.1.0 3 | potential_name = MTP1m 4 | species_count = 3 5 | potential_tag = 6 | radial_basis_type = RBChebyshev 7 | min_dist = 2.3 8 | max_dist = 5 9 | radial_basis_size = 8 10 | radial_funcs_count = 2 11 | alpha_moments_count = 8 12 | alpha_index_basic_count = 5 13 | alpha_index_basic = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}} 14 | alpha_index_times_count = 5 15 | alpha_index_times = {{0, 0, 1, 5}, {1, 1, 1, 6}, {2, 2, 1, 6}, {3, 3, 1, 6}, {0, 5, 1, 7}} 16 | alpha_scalar_moments = 5 17 | alpha_moment_mapping = {0, 4, 5, 6, 7} -------------------------------------------------------------------------------- /examples/active_learning_qe/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 8 4 | #SBATCH -n 1024 5 | #SBATCH -J spinel 6 | #SBATCH -c 1 7 | #SBATCH --time=0:30:00 8 | 9 | RESTART=OFF # ON or OFF 10 | if [ "_$RESTART" = "_ON" ]; then 11 | RESUME_OPT=--resume-failed 12 | else 13 | RESUME_OPT="" 14 | fi 15 | 16 | parallel --delay 0.2 -j 32 --joblog runtask.log $RESUME_OPT \ 17 | -a rundirs.txt "/bin/sh ./run_pw.sh" 18 | sleep 30 19 | -------------------------------------------------------------------------------- /examples/active_learning_qe/run_pw.sh: -------------------------------------------------------------------------------- 1 | # specify program 2 | 3 | source /home/issp/materiapps/intel/espresso/espressovars.sh 4 | 5 | pwd 6 | srun --exclusive --mem-per-cpu=1840 -n 32 -c 1 -N 1 pw.x -in $1/scf.in > $1/stdout 2>&1 7 | echo "$1" finished 8 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 8 4 | #SBATCH -n 1024 5 | #SBATCH -J spinel 6 | #SBATCH -c 1 7 | #SBATCH --time=0:30:00 8 | 9 | # Run reference DFT calc. 10 | # module purge 11 | # module load intel_compiler/2019.5.281 12 | # module load openmpi/4.0.4-intel-2019.5.281 13 | 14 | # source XXX 15 | 16 | echo start AL sample 17 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 18 | 19 | echo start parallel_run 1 20 | sh parallel_run.sh 21 | 22 | echo start AL final 23 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 24 | 25 | #train 26 | # module purge 27 | # module load intel_compiler/2020.2.254 28 | # module load intel_mpi/2020.2.254 29 | 30 | echo start training 31 | abics_train input.toml >> abics_train.out 32 | 33 | echo Done 34 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 1 4 | #SBATCH -n 8 5 | #SBATCH --time=00:30:00 6 | 7 | # module purge 8 | # module load intel_compiler/2019.5.281 9 | # module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | # source XXX 12 | 13 | #sleep 30 14 | srun -n 8 abics_sampling input.toml >> abics_sampling.out 15 | 16 | echo Done 17 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/aenet_train_input/generate/Al.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Al 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/aenet_train_input/generate/Mg.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Mg 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/aenet_train_input/generate/generate.in.head: -------------------------------------------------------------------------------- 1 | OUTPUT aenet.train 2 | 3 | TYPES 4 | 2 5 | Al -0.0 ! eV 6 | Mg -0.0 ! eV 7 | 8 | SETUPS 9 | Al Al.fingerprint.stp 10 | Mg Mg.fingerprint.stp 11 | 12 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/aenet_train_input/predict/in.lammps: -------------------------------------------------------------------------------- 1 | #atom_style atomic 2 | #units metal 3 | #boundary p p p 4 | 5 | #read_data BZ.data 6 | 7 | pair_style aenet 8 | pair_coeff * * v00 Al Mg 15t-15t.nn Al Mg 9 | 10 | neighbor 0.1 bin 11 | 12 | #thermo_style custom step etotal pe ke temp press 13 | #thermo 50 14 | 15 | #reset_timestep 0 16 | #timestep 0.0005 17 | 18 | #velocity all create 750 12345 dist gaussian 19 | 20 | #dump d1 all cfg 100 run*.cfg mass type xs ys zs 21 | #dump_modify d1 element O Sc Zr 22 | 23 | #fix f1 all nve 24 | #run 0 25 | 26 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/aenet_train_input/train/train.in: -------------------------------------------------------------------------------- 1 | TRAININGSET aenet.train 2 | TESTPERCENT 10 3 | ITERATIONS 500 4 | 5 | MAXENERGY 10000 6 | 7 | TIMING 8 | 9 | !SAVE_ENERGIES 10 | 11 | METHOD 12 | !lm batchsize=4000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 13 | bfgs 14 | 15 | !METHOD 2 Steepest Descent 16 | !online_sd gamma=5.0d-7 alpha=0.25d0 17 | !online_sd gamma=1.0d-8 alpha=0.25d0 18 | ! 19 | !METHOD 3 Extended Kalman Filter 20 | !ekf 21 | ! 22 | !METHOD 4 Levenberg-Marquardt 23 | !lm batchsize=8000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 24 | 25 | NETWORKS 26 | ! atom network hidden 27 | ! types file-name layers nodes:activation 28 | Al Al.15t-15t.nn 2 15:tanh 15:tanh 29 | Mg Mg.15t-15t.nn 2 15:tanh 15:tanh -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/baseinput_ref/download_pp.sh: -------------------------------------------------------------------------------- 1 | mkdir -p pseudo 2 | for file in \ 3 | Al.pbe-nl-kjpaw_psl.1.0.0.UPF \ 4 | Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF \ 5 | O.pbe-n-kjpaw_psl.1.0.0.UPF 6 | do 7 | wget https://pseudopotentials.quantum-espresso.org/upf_files/$file 8 | mv $file pseudo 9 | done 10 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/baseinput_ref/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'relax' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = './pseudo' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-8 18 | electron_maxstep = 100 19 | / 20 | &ions 21 | / 22 | ATOMIC_SPECIES 23 | Al 26.981 Al.pbe-nl-kjpaw_psl.1.0.0.UPF 24 | Mg 24.305 Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 25 | O 16.000 O.pbe-n-kjpaw_psl.1.0.0.UPF 26 | ATOMIC_POSITIONS crystal 27 | 28 | K_POINTS gamma 29 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/calc_DOI.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | from pymatgen.core import Structure 19 | from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator 20 | import os, sys 21 | import numpy as np 22 | import scipy.constants as constants 23 | from abics.mc_mpi import RXParams 24 | 25 | throwout = 1 26 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 27 | rxparams = RXParams.from_toml(tomlfile) 28 | nreplicas = rxparams.nreplicas 29 | comm = MPI.COMM_WORLD 30 | 31 | spinel_struct = Structure.from_file("MgAl2O4.vasp") 32 | Asite_struct = spinel_struct.copy() 33 | Asite_struct.remove_species(["Al", "O"]) 34 | 35 | 36 | matcher = StructureMatcher( 37 | ltol=0.1, 38 | primitive_cell=False, 39 | allow_subset=True, 40 | comparator=FrameworkComparator(), 41 | ignored_species=["O"], 42 | ) 43 | 44 | 45 | def calc_DOI(structure): 46 | asites = matcher.get_mapping(structure, Asite_struct) 47 | x = 0 48 | species = [str(sp) for sp in structure.species] 49 | for i in asites: 50 | if species[i] == "Al": 51 | x += 1 52 | x /= float(len(asites)) 53 | return x 54 | 55 | 56 | myT = comm.Get_rank() 57 | kTs = np.load(open("./kTs.npy", "rb")) 58 | 59 | if myT < nreplicas: 60 | Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb")) 61 | nstep = len(Trank_hist) 62 | os.chdir("Tseparate/{}".format(myT)) 63 | DOI = [] 64 | for i in range(nstep): 65 | DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i)))) 66 | DOI = np.array(DOI) 67 | np.savetxt("DOI.dat", DOI) 68 | DOImean = DOI[throwout:].mean() 69 | os.chdir("..") 70 | myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K") 71 | 72 | for i in range(len(kTs)): 73 | comm.Barrier() 74 | if myT != i: 75 | continue 76 | outfi = open("DOI_T.dat", "a") 77 | outfi.write("{:6.1f} \t".format(myT_kelvin)) 78 | outfi.write("{}\n".format(DOImean)) 79 | outfi.close() 80 | 81 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 8 4 | #SBATCH -n 1024 5 | #SBATCH -J spinel 6 | #SBATCH -c 1 7 | #SBATCH --time=0:30:00 8 | 9 | RESTART=OFF # ON or OFF 10 | if [ "_$RESTART" = "_ON" ]; then 11 | RESUME_OPT=--resume-failed 12 | else 13 | RESUME_OPT="" 14 | fi 15 | 16 | parallel --delay 0.2 -j 32 --joblog runtask.log $RESUME_OPT \ 17 | -a rundirs.txt "/bin/sh ./run_pw.sh" 18 | sleep 30 19 | -------------------------------------------------------------------------------- /examples/active_learning_qe_lammps/run_pw.sh: -------------------------------------------------------------------------------- 1 | # specify program 2 | 3 | source /home/issp/materiapps/intel/espresso/espressovars.sh 4 | 5 | pwd 6 | srun --exclusive --mem-per-cpu=1840 -n 32 -c 1 -N 1 pw.x -in $1/scf.in > $1/stdout 2>&1 7 | echo "$1" finished 8 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu #パーティションを指定 3 | #SBATCH -N 8 4 | #SBATCH -n 512 5 | #SBATCH -J spinel 6 | #SBATCH -c 2 7 | #SBATCH --time=0:30:00 8 | 9 | # Run reference DFT calc. 10 | #module purge 11 | #module load intel_compiler/2019.5.281 12 | #module load openmpi/4.0.4-intel-2019.5.281 13 | 14 | for i in {1..2} # 2 runs set in baseinput 15 | do 16 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 17 | sh parallel_run.sh 18 | done 19 | 20 | srun -n 8 abics_mlref input.toml >> abics_mlref.out 21 | 22 | #train 23 | module purge 24 | module load intel_compiler/2020.2.254 25 | module load intel_mpi/2020.2.254 26 | abics_train input.toml >> abics_train.out 27 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p F144cpu #パーティションを指定 3 | #SBATCH -N 144 4 | #SBATCH -n 9216 5 | #SBATCH -J spinel 6 | #SBATCH -c 2 7 | #SBATCH --time=3:00:00 8 | 9 | # Run reference DFT calc. 10 | #module purge 11 | #module load intel_compiler/2019.5.281 12 | #module load openmpi/4.0.4-intel-2019.5.281 13 | 14 | for i in {1..3} # 2 runs set in baseinput 15 | do 16 | srun -n 15 abics_mlref input.toml >> abics_mlref.out 17 | sh parallel_run.sh 18 | done 19 | 20 | srun -n 15 abics_mlref input.toml >> abics_mlref.out 21 | 22 | #train 23 | module purge 24 | module load intel_compiler/2020.2.254 25 | module load intel_mpi/2020.2.254 26 | abics_train input.toml >> abics_train.out 27 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu #パーティションを指定 3 | #SBATCH -N 1 4 | #SBATCH -n 15 5 | #SBATCH --time=00:30:00 6 | 7 | #module purge 8 | #module load intel_compiler/2019.5.281 9 | #module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | #sleep 30 12 | srun -n 15 abics_sampling input.toml >> abics_sampling.out 13 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/aenet_train_input/generate/Al.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Al 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/aenet_train_input/generate/Mg.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Mg 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/aenet_train_input/generate/generate.in.head: -------------------------------------------------------------------------------- 1 | OUTPUT aenet.train 2 | 3 | TYPES 4 | 2 5 | Al -0.0 ! eV 6 | Mg -0.0 ! eV 7 | 8 | SETUPS 9 | Al Al.fingerprint.stp 10 | Mg Mg.fingerprint.stp 11 | 12 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/aenet_train_input/predict/predict.in: -------------------------------------------------------------------------------- 1 | TYPES 2 | 2 3 | Mg 4 | Al 5 | 6 | 7 | NETWORKS 8 | Mg Mg.15t-15t.nn 9 | Al Al.15t-15t.nn 10 | 11 | 12 | VERBOSITY low 13 | 14 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/aenet_train_input/train/train.in: -------------------------------------------------------------------------------- 1 | TRAININGSET aenet.train 2 | TESTPERCENT 10 3 | ITERATIONS 500 4 | 5 | MAXENERGY 10000 6 | 7 | TIMING 8 | 9 | !SAVE_ENERGIES 10 | 11 | METHOD 12 | !lm batchsize=4000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 13 | bfgs 14 | 15 | !METHOD 2 Steepest Descent 16 | !online_sd gamma=5.0d-7 alpha=0.25d0 17 | !online_sd gamma=1.0d-8 alpha=0.25d0 18 | ! 19 | !METHOD 3 Extended Kalman Filter 20 | !ekf 21 | ! 22 | !METHOD 4 Levenberg-Marquardt 23 | !lm batchsize=8000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 24 | 25 | NETWORKS 26 | ! atom network hidden 27 | ! types file-name layers nodes:activation 28 | Al Al.15t-15t.nn 2 15:tanh 15:tanh 29 | Mg Mg.15t-15t.nn 2 15:tanh 15:tanh -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/baseinput_ref/INCAR: -------------------------------------------------------------------------------- 1 | SYSTEM = spinel 2 | 3 | Electronic minimisation 4 | ENCUT = 400 eV ! energy cut-off for the calculation (optional) 5 | #ENAUG = 350.00 eV ! energy cut-off for the augmentation charges 6 | 7 | # NBANDS=36 8 | 9 | Spin 10 | # ISPIN = 2 11 | # MAGMOM = 1 1 -1 -1 12 | # ISTART = 1 13 | ICHARG = 1 14 | #NELMDL = -10 15 | NELM = 200 16 | NELMIN = 4 17 | MIXING 18 | # AMIN = 0.05 19 | #BMIX = 0.0001 20 | # LMAXMIX = 6 21 | #IMIX = 1 22 | #AMIX = 0.001 23 | #BMIX = 0.0001 24 | #ADDGRID=.TRUE. 25 | MAXMIX=40 26 | 27 | Accuracy 28 | PREC = Normal #Accurate 29 | EDIFF = 1e-5 30 | 31 | Smearing 32 | ISMEAR = 0 # 33 | SIGMA = 0.05 34 | LREAL = Auto 35 | ALGO = Fast 36 | 37 | Relaxation and MD 38 | NSW = 100 39 | EDIFFG = -0.04 40 | IBRION = 1 41 | POTIM = 0.3 42 | # SMASS = -1 43 | # NFREE = 20 44 | #NELECT = 760 45 | #LVTOT = True 46 | # ISYM = 0 47 | ISIF=3 48 | 49 | #EMIN = -3 50 | #EMAX = 15 51 | NEDOS = 1000 52 | 53 | #LPARD = .TRUE. 54 | IBAND = 171 172 173 174 55 | KPUSE = 1 56 | LSEPB = .TRUE. 57 | LSEPK = .TRUE. 58 | 59 | 60 | #EFIELD = 0.005 61 | #LDIPOL = .TRUE. 62 | #IDIPOL= 3 63 | # LDIPOL = .TRUE. 64 | # IDIPOL = 3 65 | # DIPOL = 0.0 0.0 0.5 66 | 67 | 68 | LVTOT = .FALSE. 69 | LVHAR = .FALSE. 70 | #DEFERMI = 0.6 71 | #OPALR = 0.3 0.72 72 | NCORE = 8 73 | # KPAR = 3 74 | 75 | 76 | LWAVE=.FALSE. 77 | LCHARG=.FALSE. 78 | # LORBIT=10 79 | # LDAU = .TRUE. 80 | # LDAUTYPE = 2 81 | # LDAUL = 1 82 | # LDAUU = 5 83 | # LDAUJ = 0 84 | # LUSE_VDW = .TRUE. 85 | # AGGAC = 0.0000 86 | # GGA = RE 87 | #LDAUU = 0 88 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/baseinput_ref/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic mesh 2 | 0 3 | G 4 | 1 1 1 5 | 0. 0. 0. 6 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/baseinput_ref/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'scf' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-8 18 | electron_maxstep = 100 19 | / 20 | ATOMIC_SPECIES 21 | Al 26.981 Al.pbesol-nl-kjpaw_psl.1.0.0.UPF 22 | Mg 24.305 Mg.pbesol-spnl-kjpaw_psl.1.0.0.UPF 23 | O 16.000 O.pbesol-n-kjpaw_psl.1.0.0.UPF 24 | ATOMIC_POSITIONS crystal 25 | 26 | K_POINTS automatic 27 | 1 1 1 0 0 0 28 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/calc_DOI.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | from pymatgen import Structure 19 | #from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator 20 | import os, sys 21 | import numpy as np 22 | import scipy.constants as constants 23 | from abics.mc_mpi import RXParams 24 | import naive_matcher 25 | 26 | mapper = naive_matcher.naive_mapping 27 | 28 | throwout = 0 29 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 30 | rxparams = RXParams.from_toml(tomlfile) 31 | nreplicas = rxparams.nreplicas 32 | comm = MPI.COMM_WORLD 33 | 34 | spinel_struct = Structure.from_file("MgAl2O4.vasp") 35 | spinel_struct.make_supercell([2,2,2]) 36 | Asite_struct = spinel_struct.copy() 37 | Asite_struct.remove_species(["Al", "O"]) 38 | 39 | 40 | #matcher = StructureMatcher( 41 | # ltol=0.1, 42 | # primitive_cell=False, 43 | # allow_subset=True, 44 | # comparator=FrameworkComparator(), 45 | # ignored_species=["O"], 46 | #) 47 | 48 | asite_ids = spinel_struct.indices_from_symbol("Mg") 49 | def calc_DOI(structure): 50 | mapping = mapper(spinel_struct, structure) 51 | x = 0 52 | species = structure.species 53 | species = [str(sp) for sp in species] 54 | for i in asite_ids: 55 | if species[mapping[i]] == "Al": 56 | x += 1 57 | x /= float(len(asite_ids)) 58 | return x 59 | 60 | 61 | myT = comm.Get_rank() 62 | kTs = np.load(open("./kTs.npy", "rb")) 63 | 64 | if myT < nreplicas: 65 | Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb")) 66 | nstep = len(Trank_hist) 67 | os.chdir("Tseparate/{}".format(myT)) 68 | DOI = [] 69 | for i in range(throwout,nstep): 70 | DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i)))) 71 | DOI = np.array(DOI) 72 | np.savetxt("DOI.dat", DOI) 73 | DOImean = DOI.mean() 74 | os.chdir("..") 75 | myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K") 76 | 77 | for i in range(len(kTs)): 78 | comm.Barrier() 79 | if myT != i: 80 | continue 81 | outfi = open("DOI_T.dat", "a") 82 | outfi.write("{:6.1f} \t".format(myT_kelvin)) 83 | outfi.write("{}\n".format(DOImean)) 84 | outfi.close() 85 | 86 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ##SBATCH -p F144cpu #パーティションを指定 3 | ##SBATCH -N 144 4 | ##SBATCH -n 9216 5 | ##SBATCH -c 2 6 | ##SBATCH --time=00:30:00 7 | module purge 8 | module load intel_compiler/2019.5.281 9 | module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | parallel --delay 0.2 -j 72 --joblog runtask.log \ 12 | -a rundirs.txt ./run_vasp.sh 13 | sleep 30 14 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/LARGE/run_vasp.sh: -------------------------------------------------------------------------------- 1 | # specify program 2 | prog="srun --exclusive --mem-per-cpu=1840 -n 128 -c 2 -N 2 /home/k0306/k030600/src/vasp.5.4.4.pl2/bin/vasp_gam" 3 | 4 | cd $1 5 | $prog > stdout 6 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SBATCH -p i8cpu 3 | #SBATCH -N 1 4 | #SBATCH -n 8 5 | #SBATCH --time=00:30:00 6 | 7 | # module purge 8 | # module load intel_compiler/2019.5.281 9 | # module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | # source XXX 12 | 13 | #sleep 30 14 | srun -n 8 abics_sampling input.toml >> abics_sampling.out 15 | 16 | echo Done 17 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/aenet_train_input/generate/Al.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Al 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/aenet_train_input/generate/Mg.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Mg 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/aenet_train_input/generate/generate.in.head: -------------------------------------------------------------------------------- 1 | OUTPUT aenet.train 2 | 3 | TYPES 4 | 2 5 | Al -0.0 ! eV 6 | Mg -0.0 ! eV 7 | 8 | SETUPS 9 | Al Al.fingerprint.stp 10 | Mg Mg.fingerprint.stp 11 | 12 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/aenet_train_input/predict/predict.in: -------------------------------------------------------------------------------- 1 | TYPES 2 | 2 3 | Mg 4 | Al 5 | 6 | 7 | NETWORKS 8 | Mg Mg.15t-15t.nn 9 | Al Al.15t-15t.nn 10 | 11 | 12 | VERBOSITY low 13 | 14 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/aenet_train_input/train/train.in: -------------------------------------------------------------------------------- 1 | TRAININGSET aenet.train 2 | TESTPERCENT 10 3 | ITERATIONS 500 4 | 5 | MAXENERGY 10000 6 | 7 | TIMING 8 | 9 | !SAVE_ENERGIES 10 | 11 | METHOD 12 | !lm batchsize=4000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 13 | bfgs 14 | 15 | !METHOD 2 Steepest Descent 16 | !online_sd gamma=5.0d-7 alpha=0.25d0 17 | !online_sd gamma=1.0d-8 alpha=0.25d0 18 | ! 19 | !METHOD 3 Extended Kalman Filter 20 | !ekf 21 | ! 22 | !METHOD 4 Levenberg-Marquardt 23 | !lm batchsize=8000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 24 | 25 | NETWORKS 26 | ! atom network hidden 27 | ! types file-name layers nodes:activation 28 | Al Al.15t-15t.nn 2 15:tanh 15:tanh 29 | Mg Mg.15t-15t.nn 2 15:tanh 15:tanh -------------------------------------------------------------------------------- /examples/active_learning_vasp/baseinput_ref/INCAR: -------------------------------------------------------------------------------- 1 | SYSTEM = spinel 2 | 3 | Electronic minimisation 4 | ENCUT = 400 eV ! energy cut-off for the calculation (optional) 5 | #ENAUG = 350.00 eV ! energy cut-off for the augmentation charges 6 | 7 | # NBANDS=36 8 | 9 | Spin 10 | # ISPIN = 2 11 | # MAGMOM = 1 1 -1 -1 12 | # ISTART = 1 13 | ICHARG = 1 14 | #NELMDL = -10 15 | NELM = 200 16 | NELMIN = 4 17 | MIXING 18 | # AMIN = 0.05 19 | #BMIX = 0.0001 20 | # LMAXMIX = 6 21 | #IMIX = 1 22 | #AMIX = 0.001 23 | #BMIX = 0.0001 24 | #ADDGRID=.TRUE. 25 | MAXMIX=40 26 | 27 | Accuracy 28 | PREC = Normal #Accurate 29 | EDIFF = 1e-5 30 | 31 | Smearing 32 | ISMEAR = 0 # 33 | SIGMA = 0.05 34 | LREAL = Auto 35 | ALGO = Fast 36 | 37 | Relaxation and MD 38 | NSW = 100 39 | EDIFFG = -0.04 40 | IBRION = 1 41 | POTIM = 0.3 42 | # SMASS = -1 43 | # NFREE = 20 44 | #NELECT = 760 45 | #LVTOT = True 46 | # ISYM = 0 47 | ISIF=3 48 | 49 | #EMIN = -3 50 | #EMAX = 15 51 | NEDOS = 1000 52 | 53 | #LPARD = .TRUE. 54 | IBAND = 171 172 173 174 55 | KPUSE = 1 56 | LSEPB = .TRUE. 57 | LSEPK = .TRUE. 58 | 59 | 60 | #EFIELD = 0.005 61 | #LDIPOL = .TRUE. 62 | #IDIPOL= 3 63 | # LDIPOL = .TRUE. 64 | # IDIPOL = 3 65 | # DIPOL = 0.0 0.0 0.5 66 | 67 | 68 | LVTOT = .FALSE. 69 | LVHAR = .FALSE. 70 | #DEFERMI = 0.6 71 | #OPALR = 0.3 0.72 72 | NCORE = 8 73 | # KPAR = 3 74 | 75 | 76 | LWAVE=.FALSE. 77 | LCHARG=.FALSE. 78 | # LORBIT=10 79 | # LDAU = .TRUE. 80 | # LDAUTYPE = 2 81 | # LDAUL = 1 82 | # LDAUU = 5 83 | # LDAUJ = 0 84 | # LUSE_VDW = .TRUE. 85 | # AGGAC = 0.0000 86 | # GGA = RE 87 | #LDAUU = 0 88 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/baseinput_ref/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic mesh 2 | 0 3 | G 4 | 1 1 1 5 | 0. 0. 0. 6 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/baseinput_ref/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'scf' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-8 18 | electron_maxstep = 100 19 | / 20 | ATOMIC_SPECIES 21 | Al 26.981 Al.pbesol-nl-kjpaw_psl.1.0.0.UPF 22 | Mg 24.305 Mg.pbesol-spnl-kjpaw_psl.1.0.0.UPF 23 | O 16.000 O.pbesol-n-kjpaw_psl.1.0.0.UPF 24 | ATOMIC_POSITIONS crystal 25 | 26 | K_POINTS automatic 27 | 1 1 1 0 0 0 28 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/calc_DOI.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | from pymatgen.core import Structure 19 | from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator 20 | import os, sys 21 | import numpy as np 22 | import scipy.constants as constants 23 | from abics.mc_mpi import RXParams 24 | 25 | throwout = 1 26 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 27 | rxparams = RXParams.from_toml(tomlfile) 28 | nreplicas = rxparams.nreplicas 29 | comm = MPI.COMM_WORLD 30 | 31 | spinel_struct = Structure.from_file("MgAl2O4.vasp") 32 | Asite_struct = spinel_struct.copy() 33 | Asite_struct.remove_species(["Al", "O"]) 34 | 35 | 36 | matcher = StructureMatcher( 37 | ltol=0.1, 38 | primitive_cell=False, 39 | allow_subset=True, 40 | comparator=FrameworkComparator(), 41 | ignored_species=["O"], 42 | ) 43 | 44 | 45 | def calc_DOI(structure): 46 | asites = matcher.get_mapping(structure, Asite_struct) 47 | x = 0 48 | species = [str(sp) for sp in structure.species] 49 | for i in asites: 50 | if species[i] == "Al": 51 | x += 1 52 | x /= float(len(asites)) 53 | return x 54 | 55 | 56 | myT = comm.Get_rank() 57 | kTs = np.load(open("./kTs.npy", "rb")) 58 | 59 | if myT < nreplicas: 60 | Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb")) 61 | nstep = len(Trank_hist) 62 | os.chdir("Tseparate/{}".format(myT)) 63 | DOI = [] 64 | for i in range(nstep): 65 | DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i)))) 66 | DOI = np.array(DOI) 67 | np.savetxt("DOI.dat", DOI) 68 | DOImean = DOI[throwout:].mean() 69 | os.chdir("..") 70 | myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K") 71 | 72 | for i in range(len(kTs)): 73 | comm.Barrier() 74 | if myT != i: 75 | continue 76 | outfi = open("DOI_T.dat", "a") 77 | outfi.write("{:6.1f} \t".format(myT_kelvin)) 78 | outfi.write("{}\n".format(DOImean)) 79 | outfi.close() 80 | 81 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ##SBATCH -p F144cpu #パーティションを指定 3 | ##SBATCH -N 144 4 | ##SBATCH -n 9216 5 | ##SBATCH -c 2 6 | ##SBATCH --time=00:30:00 7 | module purge 8 | module load intel_compiler/2019.5.281 9 | module load openmpi/4.0.4-intel-2019.5.281 10 | 11 | parallel --delay 0.2 -j 16 --joblog runtask.log \ 12 | -a rundirs.txt ./run_vasp.sh 13 | sleep 30 14 | -------------------------------------------------------------------------------- /examples/active_learning_vasp/run_vasp.sh: -------------------------------------------------------------------------------- 1 | # specify program 2 | prog="srun --exclusive --mem-per-cpu=1840 -n 32 -c 2 -N 1 vasp_gam" 3 | 4 | cd $1 5 | $prog > stdout 6 | -------------------------------------------------------------------------------- /examples/lattice_gas/input.toml: -------------------------------------------------------------------------------- 1 | [config] 2 | L = [ 5, 5 ] 3 | T = 300 # K 4 | Eads = -0.4 # eV 5 | J = 0.0 # eV 6 | 7 | [sampling] 8 | thermalization_steps = 100 # 1000 9 | sample_steps = 100 # 1000 10 | sample_frequency = 1 11 | print_frequency = 1 12 | 13 | p_start = 1.0e4 14 | p_end = 1.0e-4 15 | p_steps = 20 16 | p_scale = 'linear' 17 | # p_scale = 'log' 18 | 19 | conf_start = 1.0 20 | 21 | random_seed = 123456789 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/lattice_gas/plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/examples/lattice_gas/plot.png -------------------------------------------------------------------------------- /examples/potts/L16/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 8 3 | nprocs_per_replica = 1 4 | kTstart = 0.9 5 | kTend = 1.3 6 | nsteps = 8192 # Number of steps for sampling 7 | RXtrial_frequency = 64 8 | sample_frequency = 8 9 | print_frequency = 1 10 | reload = false 11 | 12 | [sampling.solver] 13 | type = 'potts' 14 | 15 | [config] 16 | Q = 2 17 | L = [16,16] 18 | -------------------------------------------------------------------------------- /examples/potts/L24/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 8 3 | nprocs_per_replica = 1 4 | kTstart = 0.9 5 | kTend = 1.3 6 | nsteps = 8192 # Number of steps for sampling 7 | RXtrial_frequency = 64 8 | sample_frequency = 8 9 | print_frequency = 1 10 | reload = false 11 | 12 | [sampling.solver] 13 | type = 'potts' 14 | 15 | [config] 16 | Q = 2 17 | L = [24,24] 18 | -------------------------------------------------------------------------------- /examples/potts/L8/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 8 3 | nprocs_per_replica = 1 4 | kTstart = 0.9 5 | kTend = 1.3 6 | nsteps = 8192 # Number of steps for sampling 7 | RXtrial_frequency = 64 8 | sample_frequency = 8 9 | print_frequency = 1 10 | reload = false 11 | 12 | [sampling.solver] 13 | type = 'potts' 14 | 15 | [config] 16 | Q = 2 17 | L = [8,8] 18 | -------------------------------------------------------------------------------- /examples/potts/calc_observables.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | 4 | 5 | def calc(ene, ms, T: float, nbootstrap: int = 10): 6 | N: int = ms.size 7 | nskip = N//2 8 | e2s = ene**2 9 | m2s = ms**2 10 | m4s = m2s**2 11 | 12 | obs = np.zeros((nbootstrap, 6)) 13 | 14 | for ib in range(nbootstrap): 15 | idx = np.random.randint(nskip, N, size=N-nskip) 16 | e = np.mean(ene[idx]) 17 | e2 = np.mean(e2s[idx]) 18 | spec = (e2 - e * e) / (T * T) 19 | m = np.mean(ms[idx]) 20 | m2 = np.mean(m2s[idx]) 21 | m4 = np.mean(m4s[idx]) 22 | u = m4 / (m2**2) 23 | # chi = (m2) / T 24 | chi = (m2 - m * m) / T 25 | obs[ib, :] = [e, spec, m, m2, chi, u] 26 | obs_mean = np.mean(obs, axis=0) 27 | obs_std = np.std(obs, axis=0) 28 | return obs_mean, obs_std 29 | 30 | 31 | print("# 1: T") 32 | for i, n in enumerate(["e", "spec", "m", "m2", "chi", "u"]): 33 | j = i+1 34 | print(f"# {2*j},{2*j+1}: {n}") 35 | 36 | Ts = np.load("kTs.npy") 37 | for irep, T in enumerate(Ts): 38 | A = np.loadtxt(os.path.join("Tseparate", str(irep), "energies.dat")) 39 | obs_mean, obs_std = calc(A[:, 0], A[:, 1], T) 40 | print(f"{T}", end="") 41 | for i in range(len(obs_mean)): 42 | print(f" {obs_mean[i]} {obs_std[i]}", end="") 43 | print() 44 | -------------------------------------------------------------------------------- /examples/potts_pamc/L16/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | sampler = "PAMC" 3 | nreplicas = 4 4 | nprocs_per_replica = 1 5 | kTstart = 2.0 6 | kTend = 0.5 7 | kTnum = 16 8 | nsteps = 16384 9 | resample_frequency = 4 10 | sample_frequency = 128 11 | print_frequency = 1 12 | reload = false 13 | 14 | [sampling.solver] 15 | type = 'potts' 16 | 17 | [config] 18 | Q = 2 19 | L = [16, 16] 20 | -------------------------------------------------------------------------------- /examples/potts_pamc/L8/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | sampler = "PAMC" 3 | nreplicas = 4 4 | nprocs_per_replica = 1 5 | kTstart = 2.0 6 | kTend = 0.5 7 | kTnum = 16 8 | nsteps = 16384 9 | resample_frequency = 4 10 | sample_frequency = 128 11 | print_frequency = 1 12 | reload = false 13 | 14 | [sampling.solver] 15 | type = 'potts' 16 | 17 | [config] 18 | Q = 2 19 | L = [8, 8] 20 | -------------------------------------------------------------------------------- /examples/spinel/ISSP_sysB.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #QSUB -queue i18cpu 4 | #QSUB -node 18 5 | #QSUB -over false 6 | 7 | #PBS -l walltime=0:30:00 8 | #PBS -N spinel 9 | #PBS -j oe 10 | #PBS -m abe 11 | 12 | cd ${PBS_O_WORKDIR} 13 | 14 | export MPI_IB_CONGESTED=enabled 15 | mpijob -spawn -np 24 abics issp_qe.toml >> stdout.log 16 | -------------------------------------------------------------------------------- /examples/spinel/analyze_result.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from py_mc.mc import binning 18 | import numpy as np 19 | import sys 20 | from mpi4py import MPI 21 | 22 | nreplicas = int(sys.argv[1]) 23 | comm = MPI.COMM_WORLD 24 | if comm.Get_size() != nreplicas: 25 | print("please run with the same number of processes as the number of replicas") 26 | sys.exit() 27 | 28 | 29 | myreplica = comm.Get_rank() 30 | obs = np.load(open(str(myreplica) + "/obs_save.npy", "rb")) 31 | Trank_hist = np.load(open(str(myreplica) + "/Trank_hist.npy", "rb")) 32 | kT_hist = np.load(open(str(myreplica) + "/kT_hist.npy", "rb")) 33 | kTs = np.load("kTs.npy") 34 | nsamples = obs.shape[0] 35 | throwout = 100 # int(nsamples*0.5) 36 | nobs = obs.shape[1] 37 | # bin_level = int(np.log2(nsamples//30)) 38 | if myreplica == 0: 39 | rcvbuffer = np.empty(obs.shape[0]) 40 | binning_fi = open("binning.dat", "w") 41 | obs_fi = open("obs_mean.dat", "w") 42 | 43 | 44 | i_sample = 0 45 | for i in range(nreplicas): # we work on one T at a time 46 | # if myreplica == 0: print("working on Temp. "+str(i)+"\n") 47 | if myreplica == 0: 48 | print(kTs[i], end="\t", file=obs_fi) 49 | for j in range(nobs): 50 | obs_T = np.where(Trank_hist == i, obs[:, j], 0.0) 51 | # print(obs_T[0], "test") 52 | if myreplica == 0: 53 | comm.Reduce(obs_T, rcvbuffer, op=MPI.SUM, root=0) 54 | 55 | print(rcvbuffer[throwout:].mean(), end="\t", file=obs_fi) 56 | # print(rcvbuffer) 57 | # bin_data = binning(rcvbuffer, bin_level) 58 | # print(np.max(bin_data), end='\t', file=obs_fi) 59 | # binning_fi.write("# "+str(i) + "," + str(j) + "\n") 60 | # binning_fi.write("\n".join([str(x) for x in bin_data])+"\n\n\n") 61 | 62 | else: 63 | comm.Reduce(obs_T, None, op=MPI.SUM, root=0) 64 | if myreplica == 0: 65 | print(file=obs_fi) 66 | -------------------------------------------------------------------------------- /examples/spinel/baseinput/Al.15t-15t.nn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/examples/spinel/baseinput/Al.15t-15t.nn -------------------------------------------------------------------------------- /examples/spinel/baseinput/INCAR: -------------------------------------------------------------------------------- 1 | SYSTEM = spinel 2 | 3 | Electronic minimisation 4 | ENCUT = 300 eV ! energy cut-off for the calculation (optional) 5 | #ENAUG = 350.00 eV ! energy cut-off for the augmentation charges 6 | 7 | # NBANDS=36 8 | 9 | Spin 10 | # ISPIN = 2 11 | # MAGMOM = 1 1 -1 -1 12 | # ISTART = 1 13 | ICHARG = 1 14 | #NELMDL = -10 15 | NELM = 200 16 | NELMIN = 4 17 | MIXING 18 | # AMIN = 0.05 19 | #BMIX = 0.0001 20 | # LMAXMIX = 6 21 | #IMIX = 1 22 | #AMIX = 0.001 23 | #BMIX = 0.0001 24 | #ADDGRID=.TRUE. 25 | MAXMIX=40 26 | 27 | Accuracy 28 | PREC = Normal #Accurate 29 | EDIFF = 1e-4 30 | 31 | Smearing 32 | ISMEAR = 0 # 33 | SIGMA = 0.05 34 | LREAL = Auto 35 | ALGO = Fast 36 | 37 | Relaxation and MD 38 | NSW = 100 39 | EDIFFG = -0.04 40 | IBRION = 1 41 | POTIM = 0.3 42 | # SMASS = -1 43 | # NFREE = 20 44 | #NELECT = 760 45 | #LVTOT = True 46 | # ISYM = 0 47 | # ISIF=3 48 | 49 | #EMIN = -3 50 | #EMAX = 15 51 | NEDOS = 1000 52 | 53 | #LPARD = .TRUE. 54 | IBAND = 171 172 173 174 55 | KPUSE = 1 56 | LSEPB = .TRUE. 57 | LSEPK = .TRUE. 58 | 59 | 60 | #EFIELD = 0.005 61 | #LDIPOL = .TRUE. 62 | #IDIPOL= 3 63 | # LDIPOL = .TRUE. 64 | # IDIPOL = 3 65 | # DIPOL = 0.0 0.0 0.5 66 | 67 | 68 | LVTOT = .FALSE. 69 | LVHAR = .FALSE. 70 | #DEFERMI = 0.6 71 | #OPALR = 0.3 0.72 72 | NCORE = 24 73 | # KPAR = 3 74 | 75 | 76 | LWAVE=.FALSE. 77 | 78 | # LORBIT=10 79 | # LDAU = .TRUE. 80 | # LDAUTYPE = 2 81 | # LDAUL = 1 82 | # LDAUU = 5 83 | # LDAUJ = 0 84 | # LUSE_VDW = .TRUE. 85 | # AGGAC = 0.0000 86 | # GGA = RE 87 | #LDAUU = 0 88 | -------------------------------------------------------------------------------- /examples/spinel/baseinput/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic mesh 2 | 0 3 | G 4 | 1 1 1 5 | 0. 0. 0. 6 | -------------------------------------------------------------------------------- /examples/spinel/baseinput/Mg.15t-15t.nn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/examples/spinel/baseinput/Mg.15t-15t.nn -------------------------------------------------------------------------------- /examples/spinel/baseinput/predict.in: -------------------------------------------------------------------------------- 1 | TYPES 2 | 2 3 | Mg 4 | Al 5 | 6 | 7 | NETWORKS 8 | Mg Mg.15t-15t.nn 9 | Al Al.15t-15t.nn 10 | 11 | 12 | VERBOSITY low 13 | 14 | #FILES 15 | #1 16 | #structure.xsf 17 | -------------------------------------------------------------------------------- /examples/spinel/baseinput/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'relax' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-8 18 | electron_maxstep = 100 19 | / 20 | &ions 21 | / 22 | ATOMIC_SPECIES 23 | Al 26.981 Al.pbe-nl-kjpaw_psl.1.0.0.UPF 24 | Mg 24.305 Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 25 | O 16.000 O.pbe-n-kjpaw_psl.1.0.0.UPF 26 | ATOMIC_POSITIONS crystal 27 | 28 | K_POINTS gamma 29 | -------------------------------------------------------------------------------- /examples/spinel/calc_DOI.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | from pymatgen.core import Structure 19 | from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator 20 | import os, sys 21 | import numpy as np 22 | import scipy.constants as constants 23 | from abics.mc_mpi import RXParams 24 | 25 | throwout = 1 26 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 27 | rxparams = RXParams.from_toml(tomlfile) 28 | nreplicas = rxparams.nreplicas 29 | comm = MPI.COMM_WORLD 30 | 31 | spinel_struct = Structure.from_file("MgAl2O4.vasp") 32 | Asite_struct = spinel_struct.copy() 33 | Asite_struct.remove_species(["Al", "O"]) 34 | 35 | 36 | matcher = StructureMatcher( 37 | ltol=0.1, 38 | primitive_cell=False, 39 | allow_subset=True, 40 | comparator=FrameworkComparator(), 41 | ignored_species=["O"], 42 | ) 43 | 44 | 45 | def calc_DOI(structure): 46 | asites = matcher.get_mapping(structure, Asite_struct) 47 | x = 0 48 | species = [str(sp) for sp in structure.species] 49 | for i in asites: 50 | if species[i] == "Al": 51 | x += 1 52 | x /= float(len(asites)) 53 | return x 54 | 55 | 56 | myT = comm.Get_rank() 57 | kTs = np.load(open("./kTs.npy", "rb")) 58 | 59 | if myT < nreplicas: 60 | Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb")) 61 | nstep = len(Trank_hist) 62 | os.chdir("Tseparate/{}".format(myT)) 63 | DOI = [] 64 | for i in range(nstep): 65 | DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i)))) 66 | DOI = np.array(DOI) 67 | np.savetxt("DOI.dat", DOI) 68 | DOImean = DOI[throwout:].mean() 69 | os.chdir("..") 70 | myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K") 71 | 72 | for i in range(len(kTs)): 73 | comm.Barrier() 74 | if myT != i: 75 | continue 76 | outfi = open("DOI_T.dat", "a") 77 | outfi.write("{:6.1f} \t".format(myT_kelvin)) 78 | outfi.write("{}\n".format(DOImean)) 79 | outfi.close() 80 | 81 | -------------------------------------------------------------------------------- /examples/spinel/separateT.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | from mpi4py import MPI 18 | import shutil 19 | import os, sys 20 | import datetime 21 | from pymatgen.core import Structure 22 | from abics.mc_mpi import RXParams 23 | import numpy as np 24 | 25 | tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml" 26 | rxparams = RXParams.from_toml(tomlfile) 27 | nreplicas = rxparams.nreplicas 28 | 29 | comm = MPI.COMM_WORLD 30 | if comm.Get_size() < nreplicas: 31 | if comm.Get_rank() == 0: 32 | print("please run with at least as many processes as the number of replicas") 33 | sys.exit() 34 | 35 | myreplica = comm.Get_rank() 36 | 37 | if myreplica == 0: 38 | if os.path.exists("Tseparate"): 39 | shutil.move("Tseparate", "Tseparate.bak.{}".format(datetime.datetime.now())) 40 | os.mkdir("Tseparate") 41 | comm.Barrier() 42 | 43 | if myreplica < nreplicas: 44 | os.mkdir("Tseparate/{}".format(myreplica)) 45 | Trank_hist = np.load(open(str(myreplica) + "/Trank_hist.npy", "rb")) 46 | os.chdir(str(myreplica)) 47 | for j in range(len(Trank_hist)): 48 | shutil.copy( 49 | "structure." + str(j) + ".vasp", "../Tseparate/" + str(Trank_hist[j]) 50 | ) 51 | 52 | -------------------------------------------------------------------------------- /examples/st2abics/BaZrO3.vasp: -------------------------------------------------------------------------------- 1 | Ba1 Zr1 O3 2 | 1.0 3 | 4.246667 0.000000 0.000000 4 | 0.000000 4.246667 0.000000 5 | 0.000000 0.000000 4.246667 6 | Ba O Zr 7 | 1 3 1 8 | direct 9 | 0.500000 0.500000 0.500000 Ba 10 | 0.500000 0.000000 0.000000 O 11 | 0.000000 0.500000 0.000000 O 12 | 0.000000 0.000000 0.500000 O 13 | 0.000000 0.000000 0.000000 Zr 14 | -------------------------------------------------------------------------------- /examples/st2abics/CuZn.vasp: -------------------------------------------------------------------------------- 1 | cu zn 2 | 1.0 3 | 2.9519999027 0.0000000000 0.0000000000 4 | 0.0000000000 2.9519999027 0.0000000000 5 | 0.0000000000 0.0000000000 2.9519999027 6 | Zn Cu 7 | 1 1 8 | Direct 9 | 0.500000000 0.500000000 0.500000000 10 | 0.000000000 0.000000000 0.000000000 11 | -------------------------------------------------------------------------------- /examples/st2abics/st2abics_BZY.toml: -------------------------------------------------------------------------------- 1 | supercell = [2,2,2] 2 | 3 | [base_structure] 4 | species = ['Ba'] 5 | fix = false 6 | 7 | [[defect_structure]] 8 | site_center_species = ['Zr'] 9 | [[defect_structure.groups]] 10 | name = 'Zr' 11 | num = 6 12 | [[defect_structure.groups]] 13 | name = 'Y' 14 | num = 2 15 | 16 | [[defect_structure]] 17 | site_center_species = ['O'] 18 | [[defect_structure.groups]] 19 | name = 'O' 20 | num = 23 21 | [[defect_structure.groups]] 22 | name = 'VO' 23 | species = [] 24 | num = 1 25 | 26 | 27 | # atom groups residing on site centers are determined from input 28 | # structure by default, although they can be controlled as follows 29 | 30 | #[[defect_structure.groups]] 31 | #name = 'Mg' 32 | #species = ['Mg'] 33 | #coords = [[[0,0,0]]] 34 | #num = 64 35 | 36 | #[[defect_structure.groups]] 37 | #name = 'Al' 38 | #species = ['Al'] 39 | #coords = [[[0,0,0]]] 40 | #num = 128 41 | -------------------------------------------------------------------------------- /examples/st2abics/st2abics_CuZn.toml: -------------------------------------------------------------------------------- 1 | supercell = [2,2,2] 2 | 3 | [base_structure] 4 | species = [] 5 | fix = false 6 | 7 | [[defect_structure]] 8 | site_center_species = ['Cu', 'Zn'] 9 | 10 | 11 | # atom groups residing on site centers are determined from input 12 | # structure by default, although they can be controlled as follows 13 | 14 | #[[defect_structure.groups]] 15 | #name = 'Mg' 16 | #species = ['Mg'] 17 | #coords = [[[0,0,0]]] 18 | #num = 64 19 | 20 | #[[defect_structure.groups]] 21 | #name = 'Al' 22 | #species = ['Al'] 23 | #coords = [[[0,0,0]]] 24 | #num = 128 25 | -------------------------------------------------------------------------------- /examples/st2abics/st2abics_MgAl2O4.toml: -------------------------------------------------------------------------------- 1 | supercell = [2,2,2] 2 | 3 | [base_structure] 4 | species = ['O'] 5 | fix = false 6 | 7 | [[defect_structure]] 8 | site_center_species = ['Mg', 'Al'] 9 | 10 | 11 | # atom groups residing on site centers are determined from input 12 | # structure by default, although they can be controlled as follows 13 | 14 | #[[defect_structure.groups]] 15 | #name = 'Mg' 16 | #species = ['Mg'] 17 | #coords = [[[0,0,0]]] 18 | #num = 64 19 | 20 | #[[defect_structure.groups]] 21 | #name = 'Al' 22 | #species = ['Al'] 23 | #coords = [[[0,0,0]]] 24 | #num = 128 25 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "abics" 3 | version = "2.2.1" 4 | description = "ab-Initio Configuration Sampling tool kit" 5 | authors = ["abICS developers "] 6 | license = "GPL-3.0-or-later" 7 | 8 | readme = "README.md" 9 | repository = "https://github.com/issp-center-dev/abICS" 10 | 11 | packages = [ 12 | { include = "abics" } 13 | ] 14 | 15 | [tool.poetry.dependencies] 16 | python = "^3.9" 17 | numpy = "^1.20" 18 | toml = ">=0.10" 19 | scipy = "^1" 20 | mpi4py = "^3" 21 | pymatgen = ">=2022.1.20" 22 | qe_tools = "^1.1" 23 | nequip = {version=">=0.5.6", optional=true} 24 | 25 | [tool.poetry.extras] 26 | nequip = ["nequip"] 27 | 28 | [tool.poetry.dev-dependencies] 29 | Sphinx = "^4.5.0" 30 | sphinx-rtd-theme = "^1.0.0" 31 | 32 | [tool.poetry.scripts] 33 | abics_sampling = "abics.scripts.main:main" 34 | st2abics = "abics.scripts.st2abics_config:main" 35 | abicsRXsepT = "abics.scripts.abicsRXsepT:main" 36 | abics_mlref = "abics.scripts.activelearn:main" 37 | abics_train = "abics.scripts.train:main" 38 | abics_postproc = "abics.scripts.postproc:main" 39 | 40 | [tool.mypy] 41 | files = "abics" 42 | ignore_missing_imports = true 43 | 44 | [build-system] 45 | requires = ["poetry-core>=1.0.0"] 46 | build-backend = "poetry.core.masonry.api" 47 | -------------------------------------------------------------------------------- /test/openmx/sample/base.dat: -------------------------------------------------------------------------------- 1 | # 2 | # File Name 3 | # 4 | 5 | System.CurrrentDirectory ./ # default=./ 6 | System.Name met 7 | level.of.stdout 1 # default=1 (1-3) 8 | level.of.fileout 1 # default=1 (0-2) 9 | 10 | # 11 | # Definition of Atomic Species 12 | # 13 | 14 | Species.Number 2 15 | 19 | 20 | # 21 | # Atoms 22 | # 23 | 24 | Atoms.Number 5 25 | Atoms.SpeciesAndCoordinates.Unit Ang # Ang|AU 26 | 33 | # 34 | # SCF or Electronic System 35 | # 36 | 37 | scf.XcType GGA-PBE # LDA|LSDA-CA|LSDA-PW|GGA-PBE 38 | scf.SpinPolarization off # On|Off|NC 39 | scf.ElectronicTemperature 300.0 # default=300 (K) 40 | scf.energycutoff 120.0 # default=150 (Ry) 41 | scf.maxIter 100 # default=40 42 | scf.EigenvalueSolver cluster # DC|GDC|Cluster|Band 43 | scf.Kgrid 1 1 1 # means n1 x n2 x n3 44 | scf.Mixing.Type rmm-diis # Simple|Rmm-Diis|Gr-Pulay|Kerker|Rmm-Diisk 45 | scf.Init.Mixing.Weight 0.200 # default=0.30 46 | scf.Min.Mixing.Weight 0.001 # default=0.001 47 | scf.Max.Mixing.Weight 0.200 # default=0.40 48 | scf.Mixing.History 7 # default=5 49 | scf.Mixing.StartPulay 4 # default=6 50 | scf.criterion 1.0e-10 # default=1.0e-6 (Hartree) 51 | scf.lapack.dste dstevx # dstevx|dstedc|dstegr,default=dstevx 52 | 53 | # 54 | # MD or Geometry Optimization 55 | # 56 | 57 | MD.Type nomd # Nomd|Opt|NVE|NVT_VS|NVT_NH 58 | # Constraint_Opt|DIIS 59 | MD.maxIter 1 # default=1 60 | MD.TimeStep 1.0 # default=0.5 (fs) 61 | MD.Opt.criterion 1.0e-4 # default=1.0e-4 (Hartree/bohr) 62 | DATA.PATH /Users/yomichi/build/openmx3.9/DFT_DATA19 63 | 64 | -------------------------------------------------------------------------------- /test/openmx/test_openmx_io.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | import os 4 | 5 | 6 | 7 | if __name__ == '__main__': 8 | sys.path.append('../../') 9 | from abics.applications.latgas_abinitio_interface.openmx import OpenMXSolver 10 | #Set solver 11 | # path_to_solver = "openmx" 12 | path_to_solver = os.path.expanduser("~/build/openmx3.9/work/openmx") 13 | solver = OpenMXSolver(path_to_solver) 14 | print ("solver name is {}. ".format(solver.name())) 15 | 16 | #base_dir = "/Users/k-yoshimi/Dropbox/PycharmProjects/abICS/test/openmx/sample" 17 | base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "sample") 18 | #Read base file 19 | print("Read base file.") 20 | input = solver.input 21 | input.from_directory(base_dir) 22 | #Execute OpenMX 23 | print("Write input file.") 24 | input_dir = "test" 25 | input.write_input(input_dir) 26 | print("Execute OpenMX.") 27 | cmd = "{} {}.dat".format(path_to_solver, os.path.join(input_dir, input.base_openmx_input["System.Name"][0])) 28 | # subprocess.call(cmd.split()) 29 | 30 | #Read Output file 31 | print("Read Output file.") 32 | output = solver.output 33 | phys = output.get_results("./") 34 | print("Update input file.") 35 | input.update_info_by_structure(phys.structure) 36 | print("Write input file.") 37 | input_dir = "test1" 38 | input.write_input(input_dir) 39 | print("Execute OpenMX.") 40 | cmd = "{} {}.dat".format(path_to_solver, os.path.join(input_dir, input.base_openmx_input["System.Name"][0])) 41 | # subprocess.call(cmd.split()) 42 | #Check the results of test/met.dat# and test1/met.dat# are almost same. 43 | 44 | #Check seldyn_arr 45 | print("Add seldyn_arr and check the result using subprocess scheme") 46 | phys.structure.add_site_property("seldyn", [[False, False, False]] * len(phys.structure.sites)) 47 | input.update_info_by_structure(phys.structure) 48 | # test subprocess mode and seldyn 49 | from abics.applications.latgas_abinitio_interface.run_base_mpi import Runner 50 | from mpi4py import MPI 51 | nprocs_per_replica = 1 52 | energy_calculator = Runner( 53 | base_input_dir=base_dir, 54 | Solver=solver, 55 | nprocs_per_solver=nprocs_per_replica, 56 | comm=MPI.COMM_SELF, 57 | solver_run_scheme = "mpi_spawn_wrapper" 58 | ) 59 | # output_base_dir = "/Users/k-yoshimi/Dropbox/PycharmProjects/abICS/test/openmx" 60 | output_base_dir = os.path.abspath(os.path.dirname(__file__)) 61 | print(output_base_dir) 62 | energy_calculator.submit(structure=phys.structure, output_dir=os.path.join(output_base_dir, "test2")) 63 | # Check the coordinates of test1/met.dat# and test2/met.dat# are same. 64 | -------------------------------------------------------------------------------- /test/qe/baseinput/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'relax' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-4 18 | electron_maxstep = 100 19 | scf_must_converge = .false. 20 | / 21 | &IONS 22 | / 23 | ATOMIC_SPECIES 24 | Al 26.981 Al.pbesol-nl-kjpaw_psl.1.0.0.UPF 25 | Mg 24.305 Mg.pbesol-spnl-kjpaw_psl.1.0.0.UPF 26 | O 16.000 O.pbesol-n-kjpaw_psl.1.0.0.UPF 27 | ATOMIC_POSITIONS crystal 28 | 29 | K_POINTS gamma 30 | -------------------------------------------------------------------------------- /test/qe/fulltest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | import shutil 4 | import sys 5 | 6 | from mpi4py import MPI 7 | import numpy as np 8 | 9 | sys.path.append("../../") 10 | 11 | from abics.scripts.main import main_impl 12 | 13 | 14 | class TestAbics(unittest.TestCase): 15 | def test_hoge(self): 16 | if MPI.COMM_WORLD.Get_rank() == 0: 17 | for i in (0, 1): 18 | filename = os.path.join(str(i), "obs.dat") 19 | if os.path.exists(filename): 20 | os.remove(filename) 21 | MPI.COMM_WORLD.Barrier() 22 | main_impl("input.toml") 23 | if MPI.COMM_WORLD.Get_rank() == 0: 24 | ref_T = np.array([[0.1034076, 0.1034076], [0.086173, 0.086173]]) 25 | ref_E = np.array( 26 | [ 27 | [-10419.036175663292, -10419.035269568985], 28 | [-10419.036103615686, -10419.034404077389], 29 | ] 30 | ) 31 | 32 | T = np.zeros((2, 2)) 33 | E = np.zeros((2, 2)) 34 | for i in (0, 1): 35 | with open(os.path.join(str(i), "obs.dat")) as f: 36 | for j, line in enumerate(f): 37 | words = line.split() 38 | T[i, j] = float(words[1]) 39 | E[i, j] = float(words[2]) 40 | if j == 1: 41 | break 42 | self.assertTrue(np.allclose(T, ref_T)) 43 | self.assertTrue(np.allclose(E, ref_E)) 44 | 45 | 46 | if __name__ == "__main__": 47 | unittest.main() 48 | -------------------------------------------------------------------------------- /test/qe/input.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | seed = 12345 13 | 14 | [solver] 15 | type = 'qe' 16 | path= '~/qe/bin/pw.x' 17 | base_input_dir = './baseinput' 18 | perturb = 0.1 19 | run_scheme = 'mpi_spawn' 20 | 21 | [config] 22 | unitcell = """ 23 | 4.056800 4.056800 0.000000 24 | 4.056800 0.000000 -4.056800 25 | 0.000000 4.056800 -4.056800 26 | """ 27 | supercell = [1,1,1] 28 | 29 | [[config.base_structure]] 30 | type = "O" 31 | coords = """ 32 | 0.712200 0.762600 0.762600 33 | 0.287800 0.237400 0.237400 34 | 0.262600 0.762600 0.762600 35 | 0.737400 0.237400 0.237400 36 | 0.262600 0.762600 0.212200 37 | 0.737400 0.237400 0.787800 38 | 0.262600 0.212200 0.762600 39 | 0.737400 0.787800 0.237400 40 | """ 41 | 42 | [[config.defect_structure]] 43 | coords = """ 44 | 1.000000 0.000000 0.000000 45 | 0.500000 0.000000 0.000000 46 | 0.500000 0.000000 0.500000 47 | 0.500000 0.500000 0.000000 48 | 0.125000 0.625000 0.625000 49 | 0.875000 0.375000 0.375000 50 | """ 51 | [[config.defect_structure.groups]] 52 | name = 'Al' 53 | num = 4 54 | [[config.defect_structure.groups]] 55 | name = 'Mg' 56 | num = 2 57 | 58 | [observer] 59 | ignored_species = ['O'] 60 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/tests/__init__.py -------------------------------------------------------------------------------- /tests/data/aenet/baseinput/predict.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/tests/data/aenet/baseinput/predict.in -------------------------------------------------------------------------------- /tests/data/aenet/stdout: -------------------------------------------------------------------------------- 1 | Cartesian atomic coordinates (input): 2 | 3 | x y z 4 | (Ang) (Ang) (Ang) 5 | -------------------------------------------- 6 | Al 0.000000 0.000000 0.000000 7 | Al 2.000000 2.000000 2.000000 8 | 9 | Cohesive energy : -395.21023888 eV 10 | Total energy : -395.21023888 eV 11 | -------------------------------------------------------------------------------- /tests/data/aenet/structure.xsf: -------------------------------------------------------------------------------- 1 | CRYSTAL 2 | # Primitive lattice vectors in Angstrom 3 | PRIMVEC 4 | 4.00000000000000 0.00000000000000 0.00000000000000 5 | 0.00000000000000 4.00000000000000 0.00000000000000 6 | 0.00000000000000 0.00000000000000 4.00000000000000 7 | # Cartesian coordinates in Angstrom. 8 | PRIMCOORD 9 | 2 1 10 | Al 0.00000000000000 0.00000000000000 0.00000000000000 0.0 0.0 0.0 11 | Al 2.00000000000000 2.00000000000000 2.00000000000000 0.0 0.0 0.0 -------------------------------------------------------------------------------- /tests/data/input/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 3 10 | sample_frequency = 4 11 | print_frequency = 5 12 | seed = 12345 13 | 14 | [sampling.solver] 15 | type = 'qe' 16 | path= './pw.x' 17 | base_input_dir = './baseinput' 18 | perturb = 0.0 19 | run_scheme = 'mpi_spawn' 20 | 21 | [config] 22 | unitcell = [[2.0, 0.0, 0.0], 23 | [0.0, 1.0, 0.0], 24 | [0.0, 0.0, 0.5]] 25 | supercell = [2,1,1] 26 | 27 | [[config.base_structure]] 28 | type = "O" 29 | coords = [ 30 | [0.0, 0.0, 0.0], 31 | [0.5, 0.5, 0.5], 32 | ] 33 | relaxation = [ 34 | [true, true, false], 35 | [true, false, true], 36 | ] 37 | 38 | [[config.base_structure]] 39 | type = "Se" 40 | coords = """ 41 | 0.0 0.5 0.5 42 | 0.5 0.0 0.5 43 | 0.5 0.5 0.0 44 | """ 45 | relaxation = """ 46 | 1 0 1 47 | 0 0 0 48 | 1 1 1 49 | """ 50 | 51 | [[config.defect_structure]] 52 | coords = """ 53 | 0.5 0.0 0.0 54 | 0.0 0.5 0.0 55 | 0.0 0.0 0.5 56 | """ 57 | 58 | [[config.defect_structure.groups]] 59 | name = 'Al' 60 | # species = ['Al'] # default 61 | # coords = [[0,0,0]] # default 62 | num = 4 63 | [[config.defect_structure.groups]] 64 | name = 'OH' 65 | species = ['O', 'H'] 66 | coords = [ 67 | [ 68 | [0,0,0], 69 | [0.1,0.1,0.1] 70 | ] 71 | ] 72 | num = 2 73 | 74 | 75 | [observer] 76 | ignored_species = ['O'] 77 | -------------------------------------------------------------------------------- /tests/data/openmx/DFT_DATA19/README.md: -------------------------------------------------------------------------------- 1 | `vps_info.txt` is taken from OpenMX. This is re-distributed under the GNU GPLv3. 2 | See http://www.openmx-square.org/download.html 3 | -------------------------------------------------------------------------------- /tests/data/openmx/baseinput/base.dat: -------------------------------------------------------------------------------- 1 | # 2 | # File Name 3 | # 4 | 5 | System.CurrrentDirectory ./ # default=./ 6 | System.Name Al 7 | level.of.stdout 1 # default=1 (1-3) 8 | level.of.fileout 1 # default=1 (0-2) 9 | 10 | # 11 | # Definition of Atomic Species 12 | # 13 | 14 | Species.Number 1 15 | 18 | 19 | # 20 | # Atoms 21 | # 22 | 23 | Atoms.Number 2 24 | Atoms.SpeciesAndCoordinates.Unit Ang # Ang|AU 25 | 29 | # 30 | # SCF or Electronic System 31 | # 32 | 33 | scf.XcType GGA-PBE # LDA|LSDA-CA|LSDA-PW|GGA-PBE 34 | scf.SpinPolarization off # On|Off|NC 35 | scf.ElectronicTemperature 300.0 # default=300 (K) 36 | scf.energycutoff 120.0 # default=150 (Ry) 37 | scf.maxIter 100 # default=40 38 | scf.EigenvalueSolver cluster # DC|GDC|Cluster|Band 39 | scf.Kgrid 1 1 1 # means n1 x n2 x n3 40 | scf.Mixing.Type rmm-diis # Simple|Rmm-Diis|Gr-Pulay|Kerker|Rmm-Diisk 41 | scf.Init.Mixing.Weight 0.200 # default=0.30 42 | scf.Min.Mixing.Weight 0.001 # default=0.001 43 | scf.Max.Mixing.Weight 0.200 # default=0.40 44 | scf.Mixing.History 7 # default=5 45 | scf.Mixing.StartPulay 4 # default=6 46 | scf.criterion 1.0e-10 # default=1.0e-6 (Hartree) 47 | scf.lapack.dste dstevx # dstevx|dstedc|dstegr,default=dstevx 48 | 49 | # 50 | # MD or Geometry Optimization 51 | # 52 | 53 | MD.Type nomd # Nomd|Opt|NVE|NVT_VS|NVT_NH 54 | # Constraint_Opt|DIIS 55 | MD.maxIter 1 # default=1 56 | MD.TimeStep 1.0 # default=0.5 (fs) 57 | MD.Opt.criterion 1.0e-4 # default=1.0e-4 (Hartree/bohr) 58 | -------------------------------------------------------------------------------- /tests/data/openmx/bin/openmx.dummy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | true 4 | -------------------------------------------------------------------------------- /tests/data/openmx/input/Al.dat: -------------------------------------------------------------------------------- 1 | System.CurrrentDirectory ./ 2 | System.Name Al 3 | level.of.stdout 1 4 | level.of.fileout 1 5 | Species.Number 1 6 | 9 | Atoms.Number 2 10 | Atoms.SpeciesAndCoordinates.Unit FRAC 11 | 15 | scf.XcType GGA-PBE 16 | scf.SpinPolarization off 17 | scf.ElectronicTemperature 300.0 18 | scf.energycutoff 120.0 19 | scf.maxIter 100 20 | scf.EigenvalueSolver cluster 21 | scf.Kgrid 1 1 1 22 | scf.Mixing.Type rmm-diis 23 | scf.Init.Mixing.Weight 0.200 24 | scf.Min.Mixing.Weight 0.001 25 | scf.Max.Mixing.Weight 0.200 26 | scf.Mixing.History 7 27 | scf.Mixing.StartPulay 4 28 | scf.criterion 1.0e-10 29 | scf.lapack.dste dstevx 30 | MD.Type nomd 31 | MD.maxIter 1 32 | MD.TimeStep 1.0 33 | MD.Opt.criterion 1.0e-4 34 | DATA.PATH /Users/yomichi/Dropbox/source/github.com/issp-center-dev/abICS/tests/data/openmx/bin/../DFT_DATA19 35 | Atoms.UnitVectors.Unit Ang 36 | 41 | 45 | -------------------------------------------------------------------------------- /tests/data/openmx/output/Al.dat#: -------------------------------------------------------------------------------- 1 | System.CurrrentDirectory ./ 2 | System.Name Al 3 | level.of.stdout 1 4 | level.of.fileout 1 5 | Species.Number 1 6 | 9 | Atoms.Number 2 10 | Atoms.SpeciesAndCoordinates.Unit FRAC 11 | 15 | scf.XcType GGA-PBE 16 | scf.SpinPolarization off 17 | scf.ElectronicTemperature 300.0 18 | scf.energycutoff 120.0 19 | scf.maxIter 100 20 | scf.EigenvalueSolver cluster 21 | scf.Kgrid 1 1 1 22 | scf.Mixing.Type rmm-diis 23 | scf.Init.Mixing.Weight 0.200 24 | scf.Min.Mixing.Weight 0.001 25 | scf.Max.Mixing.Weight 0.200 26 | scf.Mixing.History 7 27 | scf.Mixing.StartPulay 4 28 | scf.criterion 1.0e-10 29 | scf.lapack.dste dstevx 30 | MD.Type nomd 31 | MD.maxIter 1 32 | MD.TimeStep 1.0 33 | MD.Opt.criterion 1.0e-4 34 | DATA.PATH /Users/yomichi/Dropbox/source/github.com/issp-center-dev/abICS/tests/data/openmx/bin/../DFT_DATA19 35 | Atoms.UnitVectors.Unit Ang 36 | 41 | 42 | 43 | scf.restart on 44 | 45 | 46 | scf.fixed.grid 0.00000000000000 0.00000000000000 0.00000000000000 47 | 48 | 49 | MD.Current.Iter 1 50 | 51 | 52 | 57 | 58 | 59 | 64 | -------------------------------------------------------------------------------- /tests/data/openmx/output/Al.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | 3 | Al 0.00000 0.00000 0.00000 -0.000000000232674 -0.000000000044903 0.000000000302157 4 | Al 2.00000 2.00000 2.00000 0.000000000187093 0.000000000098149 -0.000000000293812 5 | -------------------------------------------------------------------------------- /tests/data/pos.vasp: -------------------------------------------------------------------------------- 1 | Al2 2 | 1.0 3 | 4.0 0.0 0.0 4 | 0.0 4.0 0.0 5 | 0.0 0.0 4.0 6 | Al 7 | 2 8 | direct 9 | 0.0 0.0 0.0 Al 10 | 0.5 0.5 0.5 Al 11 | -------------------------------------------------------------------------------- /tests/data/qe/baseinput/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = "scf" 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = "~/qe/pot" 6 | disk_io = "low" 7 | wf_collect = .false. 8 | prefix = "pwscf" 9 | outdir = "work" 10 | / 11 | &SYSTEM 12 | ecutwfc = 60.0 13 | occupations = "smearing" 14 | smearing = "gauss" 15 | degauss = 0.01 16 | ibrav = 0 17 | a = 1.0 18 | ntyp = 1 19 | nat = 1 20 | / 21 | &ELECTRONS 22 | mixing_beta = 0.7 23 | conv_thr = 0.0001 24 | electron_maxstep = 3 25 | / 26 | CELL_PARAMETERS alat 27 | 4.0 0.0 0.0 28 | 0.0 4.0 0.0 29 | 0.0 0.0 4.0 30 | ATOMIC_SPECIES 31 | Al 26.981 Al.pbesol-nl-kjpaw_psl.1.0.0.UPF 32 | ATOMIC_POSITIONS crystal 33 | Al 0.000000 0.000000 0.000000 1 1 1 34 | K_POINTS automatic 35 | 1 1 1 0 0 0 36 | -------------------------------------------------------------------------------- /tests/data/qe/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = "scf" 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = "/Users/yomichi/qe/pot" 6 | disk_io = "low" 7 | wf_collect = .false. 8 | prefix = "pwscf" 9 | outdir = "work" 10 | / 11 | &SYSTEM 12 | ecutwfc = 60.0 13 | occupations = "smearing" 14 | smearing = "gauss" 15 | degauss = 0.01 16 | ibrav = 0 17 | a = 1.0 18 | ntyp = 1 19 | nat = 2 20 | / 21 | &ELECTRONS 22 | mixing_beta = 0.7 23 | conv_thr = 0.0001 24 | electron_maxstep = 3 25 | / 26 | CELL_PARAMETERS alat 27 | 4.0 0.0 0.0 28 | 0.0 4.0 0.0 29 | 0.0 0.0 4.0 30 | ATOMIC_SPECIES 31 | Al 26.981 Al.pbesol-nl-kjpaw_psl.1.0.0.UPF 32 | ATOMIC_POSITIONS crystal 33 | Al 0.000000 0.000000 0.000000 1 1 0 34 | Al 0.500000 0.500000 0.500000 1 0 1 35 | K_POINTS automatic 36 | 1 1 1 0 0 0 37 | -------------------------------------------------------------------------------- /tests/data/vasp/baseinput/INCAR: -------------------------------------------------------------------------------- 1 | SYSTEM = spinel 2 | 3 | Electronic minimisation 4 | ENCUT = 300 eV ! energy cut-off for the calculation (optional) 5 | #ENAUG = 350.00 eV ! energy cut-off for the augmentation charges 6 | 7 | # NBANDS=36 8 | 9 | Spin 10 | # ISPIN = 2 11 | # MAGMOM = 1 1 -1 -1 12 | # ISTART = 1 13 | ICHARG = 1 14 | #NELMDL = -10 15 | NELM = 200 16 | NELMIN = 4 17 | MIXING 18 | # AMIN = 0.05 19 | #BMIX = 0.0001 20 | # LMAXMIX = 6 21 | #IMIX = 1 22 | #AMIX = 0.001 23 | #BMIX = 0.0001 24 | #ADDGRID=.TRUE. 25 | MAXMIX=40 26 | 27 | Accuracy 28 | PREC = Normal #Accurate 29 | EDIFF = 1e-4 30 | 31 | Smearing 32 | ISMEAR = 0 # 33 | SIGMA = 0.05 34 | LREAL = Auto 35 | ALGO = Fast 36 | 37 | Relaxation and MD 38 | NSW = 100 39 | EDIFFG = -0.04 40 | IBRION = 1 41 | POTIM = 0.3 42 | # SMASS = -1 43 | # NFREE = 20 44 | #NELECT = 760 45 | #LVTOT = True 46 | # ISYM = 0 47 | # ISIF=3 48 | 49 | #EMIN = -3 50 | #EMAX = 15 51 | NEDOS = 1000 52 | 53 | #LPARD = .TRUE. 54 | IBAND = 171 172 173 174 55 | KPUSE = 1 56 | LSEPB = .TRUE. 57 | LSEPK = .TRUE. 58 | 59 | 60 | #EFIELD = 0.005 61 | #LDIPOL = .TRUE. 62 | #IDIPOL= 3 63 | # LDIPOL = .TRUE. 64 | # IDIPOL = 3 65 | # DIPOL = 0.0 0.0 0.5 66 | 67 | 68 | LVTOT = .FALSE. 69 | LVHAR = .FALSE. 70 | #DEFERMI = 0.6 71 | #OPALR = 0.3 0.72 72 | NCORE = 24 73 | # KPAR = 3 74 | 75 | 76 | LWAVE=.FALSE. 77 | 78 | # LORBIT=10 79 | # LDAU = .TRUE. 80 | # LDAUTYPE = 2 81 | # LDAUL = 1 82 | # LDAUU = 5 83 | # LDAUJ = 0 84 | # LUSE_VDW = .TRUE. 85 | # AGGAC = 0.0000 86 | # GGA = RE 87 | #LDAUU = 0 88 | -------------------------------------------------------------------------------- /tests/data/vasp/baseinput/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic mesh 2 | 0 3 | G 4 | 1 1 1 5 | 0. 0. 0. 6 | -------------------------------------------------------------------------------- /tests/data/vasp/baseinput/POSCAR: -------------------------------------------------------------------------------- 1 | Al2 2 | 1.0 3 | 4.0 0.0 0.0 4 | 0.0 4.0 0.0 5 | 0.0 0.0 4.0 6 | Al 7 | 2 8 | Selective dynamics 9 | direct 10 | 0.500000 0.500000 0.500000 T T T Al 11 | 0.000000 0.000000 0.000000 T T T Al 12 | -------------------------------------------------------------------------------- /tests/data/vasp/input/INCAR: -------------------------------------------------------------------------------- 1 | SYSTEM = spinel 2 | 3 | Electronic minimisation 4 | ENCUT = 300 eV ! energy cut-off for the calculation (optional) 5 | #ENAUG = 350.00 eV ! energy cut-off for the augmentation charges 6 | 7 | # NBANDS=36 8 | 9 | Spin 10 | # ISPIN = 2 11 | # MAGMOM = 1 1 -1 -1 12 | # ISTART = 1 13 | ICHARG = 1 14 | #NELMDL = -10 15 | NELM = 200 16 | NELMIN = 4 17 | MIXING 18 | # AMIN = 0.05 19 | #BMIX = 0.0001 20 | # LMAXMIX = 6 21 | #IMIX = 1 22 | #AMIX = 0.001 23 | #BMIX = 0.0001 24 | #ADDGRID=.TRUE. 25 | MAXMIX=40 26 | 27 | Accuracy 28 | PREC = Normal #Accurate 29 | EDIFF = 1e-4 30 | 31 | Smearing 32 | ISMEAR = 0 # 33 | SIGMA = 0.05 34 | LREAL = Auto 35 | ALGO = Fast 36 | 37 | Relaxation and MD 38 | NSW = 100 39 | EDIFFG = -0.04 40 | IBRION = 1 41 | POTIM = 0.3 42 | # SMASS = -1 43 | # NFREE = 20 44 | #NELECT = 760 45 | #LVTOT = True 46 | # ISYM = 0 47 | # ISIF=3 48 | 49 | #EMIN = -3 50 | #EMAX = 15 51 | NEDOS = 1000 52 | 53 | #LPARD = .TRUE. 54 | IBAND = 171 172 173 174 55 | KPUSE = 1 56 | LSEPB = .TRUE. 57 | LSEPK = .TRUE. 58 | 59 | 60 | #EFIELD = 0.005 61 | #LDIPOL = .TRUE. 62 | #IDIPOL= 3 63 | # LDIPOL = .TRUE. 64 | # IDIPOL = 3 65 | # DIPOL = 0.0 0.0 0.5 66 | 67 | 68 | LVTOT = .FALSE. 69 | LVHAR = .FALSE. 70 | #DEFERMI = 0.6 71 | #OPALR = 0.3 0.72 72 | NCORE = 24 73 | # KPAR = 3 74 | 75 | 76 | LWAVE=.FALSE. 77 | 78 | # LORBIT=10 79 | # LDAU = .TRUE. 80 | # LDAUTYPE = 2 81 | # LDAUL = 1 82 | # LDAUU = 5 83 | # LDAUJ = 0 84 | # LUSE_VDW = .TRUE. 85 | # AGGAC = 0.0000 86 | # GGA = RE 87 | #LDAUU = 0 88 | -------------------------------------------------------------------------------- /tests/data/vasp/input/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic mesh 2 | 0 3 | G 4 | 1 1 1 5 | 0. 0. 0. 6 | -------------------------------------------------------------------------------- /tests/data/vasp/input/POSCAR: -------------------------------------------------------------------------------- 1 | Al2 2 | 1.0 3 | 4.0 0.0 0.0 4 | 0.0 4.0 0.0 5 | 0.0 0.0 4.0 6 | Al 7 | 2 8 | Selective dynamics 9 | direct 10 | 0.000000 0.000000 0.000000 T T F Al 11 | 0.500000 0.500000 0.500000 T F T Al 12 | -------------------------------------------------------------------------------- /tests/data/vasp/output/CONTCAR: -------------------------------------------------------------------------------- 1 | Al2 2 | 1.00000000000000 3 | 4.0000000000000000 0.0000000000000000 0.0000000000000000 4 | 0.0000000000000000 4.0000000000000000 0.0000000000000000 5 | 0.0000000000000000 0.0000000000000000 4.0000000000000000 6 | Al 7 | 2 8 | Selective dynamics 9 | Direct 10 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 T T T 11 | 0.5000000000000000 0.5000000000000000 0.5000000000000000 T T T 12 | 13 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 14 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 15 | -------------------------------------------------------------------------------- /tests/data/vasp/output/DOSCAR: -------------------------------------------------------------------------------- 1 | 2 2 0 0 2 | 0.3200000E+02 0.4000000E-09 0.4000000E-09 0.4000000E-09 0.3000000E-15 3 | 1.000000000000000E-004 4 | CAR 5 | Spinel 6 | -------------------------------------------------------------------------------- /tests/data/vasp/output/EIGENVAL: -------------------------------------------------------------------------------- 1 | 2 2 100 1 2 | 0.3200000E+02 0.4000000E-09 0.4000000E-09 0.4000000E-09 0.3000000E-15 3 | 1.000000000000000E-004 4 | CAR 5 | Spinel 6 | 6 1 7 7 | 8 | 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.1000000E+01 9 | 1 -4.483741 10 | 2 3.006481 11 | 3 4.046773 12 | 4 4.046773 13 | 5 4.046773 14 | 6 6.502216 15 | 7 6.502216 16 | -------------------------------------------------------------------------------- /tests/data/vasp/output/IBZKPT: -------------------------------------------------------------------------------- 1 | Automatically generated mesh 2 | 1 3 | Reciprocal lattice 4 | 0.00000000000000 0.00000000000000 0.00000000000000 1 5 | -------------------------------------------------------------------------------- /tests/data/vasp/output/INCAR: -------------------------------------------------------------------------------- 1 | ALGO = Fast 2 | EDIFF = 0.0001 3 | EDIFFG = -0.04 4 | ENCUT = 300 5 | IBAND = 171 172 173 174 6 | IBRION = 1 7 | ICHARG = 1 8 | ISMEAR = 0 9 | KPUSE = 1 10 | LREAL = Auto 11 | LSEPB = True 12 | LSEPK = True 13 | LVHAR = False 14 | LVTOT = False 15 | LWAVE = False 16 | MAXMIX = 40 17 | NCORE = 24 18 | NEDOS = 1000 19 | NELM = 200 20 | NELMIN = 4 21 | NSW = 100 22 | POTIM = 0.3 23 | PREC = Normal 24 | SIGMA = 0.05 25 | SYSTEM = Spinel 26 | -------------------------------------------------------------------------------- /tests/data/vasp/output/KPOINTS: -------------------------------------------------------------------------------- 1 | Automatic kpoint scheme 2 | 0 3 | Gamma 4 | 1 1 1 5 | -------------------------------------------------------------------------------- /tests/data/vasp/output/OSZICAR: -------------------------------------------------------------------------------- 1 | N E dE d eps ncg rms rms(c) 2 | DAV: 1 0.644874941719E+01 0.64487E+01 -0.10881E+03 14 0.282E+02 3 | DAV: 2 0.525005883115E+00 -0.59237E+01 -0.58556E+01 28 0.304E+01 4 | DAV: 3 0.487304307959E+00 -0.37702E-01 -0.37355E-01 14 0.401E+00 5 | DAV: 4 0.487094334309E+00 -0.20997E-03 -0.20995E-03 14 0.365E-01 6 | DAV: 5 0.487092025836E+00 -0.23085E-05 -0.23086E-05 14 0.335E-02 0.996E-01 7 | RMM: 6 0.501492444442E+00 0.14400E-01 -0.87541E-03 14 0.726E-01 0.648E-01 8 | RMM: 7 0.502495194101E+00 0.10027E-02 -0.26720E-02 14 0.131E+00 0.116E-01 9 | RMM: 8 0.502266915707E+00 -0.22828E-03 -0.64796E-04 12 0.204E-01 0.144E-02 10 | RMM: 9 0.502272655168E+00 0.57395E-05 -0.15577E-05 7 0.428E-02 11 | 1 F= 0.50227266E+00 E0= 0.54083824E+00 d E =0.502273E+00 12 | -------------------------------------------------------------------------------- /tests/data/vasp/output/PCDAT: -------------------------------------------------------------------------------- 1 | 1 2 1 0 0.3200000E+02 0.1000000E-03 2 | CAR 3 | Spinel 4 | 0 0 0 5 | 1 1 6 | 256 256 256 7 | 256 8 | 0.1000000E-09 9 | 0.6250000E-11 10 | 1 11 | 0.3000000E-15 0.4000000E-09 0.4000000E-09 0.4000000E-09 12 | -------------------------------------------------------------------------------- /tests/data/vasp/output/POSCAR: -------------------------------------------------------------------------------- 1 | Al2 2 | 1.0 3 | 4.0 0.0 0.0 4 | 0.0 4.0 0.0 5 | 0.0 0.0 4.0 6 | Al 7 | 2 8 | Selective dynamics 9 | direct 10 | 0.000000 0.000000 0.000000 T T T Al 11 | 0.500000 0.500000 0.500000 T T T Al 12 | -------------------------------------------------------------------------------- /tests/data/vasp/output/WAVECAR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/tests/data/vasp/output/WAVECAR -------------------------------------------------------------------------------- /tests/data/vasp/output/XDATCAR: -------------------------------------------------------------------------------- 1 | Spinel 2 | 1 3 | 4.000000 0.000000 0.000000 4 | 0.000000 4.000000 0.000000 5 | 0.000000 0.000000 4.000000 6 | Al 7 | 2 8 | Direct configuration= 1 9 | 0.00000000 0.00000000 0.00000000 10 | 0.50000000 0.50000000 0.50000000 11 | -------------------------------------------------------------------------------- /tests/integration/README.md: -------------------------------------------------------------------------------- 1 | # Integration test 2 | 3 | These take ten or more minutes to finish. 4 | 5 | ## version information 6 | 7 | - QE : ver.6.5 8 | - OpenMX : ver.3.9 9 | 10 | - python package 11 | - scipy : ver.1.4.1 (Caution: values in ``constants`` are changed from ver.1.4) 12 | 13 | ## QE and QE-restart 14 | 1. Put binary `pw.x` into `~/opt/qe/bin` 15 | 2. Get the following pseudopotentials 16 | ``` 17 | Al.pbe-nl-kjpaw_psl.1.0.0.UPF 18 | Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 19 | O.pbe-n-kjpaw_psl.1.0.0.UPF 20 | ``` 21 | and put them into `~/opt/qe/pot` 22 | 23 | 3. Invoke `do_openmpi.sh` or `do_mpich.sh` 24 | 25 | ## OpenMX 26 | 1. Put binary `openmx` into `~/opt/openmx/bin` 27 | 2. Put datafiles `DFT_DATA19` into `~/opt/openmx/` 28 | 3. Invoke `do_openmpi.sh` or `do_mpich.sh` 29 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f active.out 3 | echo start AL sample 4 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 5 | echo start parallel_run 1 6 | sh parallel_run.sh 7 | sleep 5 8 | 9 | echo start AL final 10 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 11 | sleep 5 12 | 13 | #train 14 | echo start training 15 | abics_train input.toml 16 | echo 'cat train0/stdout' 17 | cat train0/stdout 18 | echo Done 19 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mpiexec -np 2 --oversubscribe abics_sampling input.toml 3 | echo Done 4 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/aenet_train_input/generate/Al.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Al 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/aenet_train_input/generate/Mg.fingerprint.stp: -------------------------------------------------------------------------------- 1 | DESCR 2 | N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150. 3 | N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96 (2017) 014112. 4 | END DESCR 5 | 6 | ATOM Mg 7 | 8 | ENV 2 9 | Al 10 | Mg 11 | 12 | RMIN 0.55d0 13 | 14 | BASIS type=Chebyshev 15 | radial_Rc = 8.0 radial_N = 16 angular_Rc = 6.5 angular_N = 4 16 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/aenet_train_input/generate/generate.in.head: -------------------------------------------------------------------------------- 1 | OUTPUT aenet.train 2 | 3 | TYPES 4 | 2 5 | Al -0.0 ! eV 6 | Mg -0.0 ! eV 7 | 8 | SETUPS 9 | Al Al.fingerprint.stp 10 | Mg Mg.fingerprint.stp 11 | 12 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/aenet_train_input/predict/predict.in: -------------------------------------------------------------------------------- 1 | TYPES 2 | 2 3 | Mg 4 | Al 5 | 6 | 7 | NETWORKS 8 | Mg Mg.15t-15t.nn 9 | Al Al.15t-15t.nn 10 | 11 | 12 | VERBOSITY low 13 | 14 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/aenet_train_input/train/train.in: -------------------------------------------------------------------------------- 1 | TRAININGSET aenet.train 2 | TESTPERCENT 10 3 | ITERATIONS 500 4 | 5 | TIMING 6 | 7 | !SAVE_ENERGIES 8 | 9 | METHOD 10 | !lm batchsize=4000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 11 | bfgs 12 | 13 | !METHOD 2 Steepest Descent 14 | !online_sd gamma=5.0d-7 alpha=0.25d0 15 | !online_sd gamma=1.0d-8 alpha=0.25d0 16 | ! 17 | !METHOD 3 Extended Kalman Filter 18 | !ekf 19 | ! 20 | !METHOD 4 Levenberg-Marquardt 21 | !lm batchsize=8000 learnrate=0.1d0 iter=3 conv=0.001 adjust=5.0 22 | 23 | NETWORKS 24 | ! atom network hidden 25 | ! types file-name layers nodes:activation 26 | Al Al.15t-15t.nn 2 15:tanh 15:tanh 27 | Mg Mg.15t-15t.nn 2 15:tanh 15:tanh 28 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/baseinput_ref/void: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/issp-center-dev/abICS/b70d5dbc38020d98b8cf05f91cc1045e66a3a750/tests/integration/active_learn_aenet/baseinput_ref/void -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/install_aenet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script installs aenet by using gfortran 4 | # generate.x_serial, train.x_mpi, and predict.x_serial will be copied 5 | # into ~/opt/aenet/bin 6 | # 7 | # NOTE: 8 | # For macOS, `gcc` (/usr/bin/gcc) does not mean GNU CC and hence the compilation will fail. 9 | # To use this script, make sure that `gcc` command invokes GNU CC by, for example, 10 | # ln -s `which gcc-11` ./gcc 11 | # PATH=`pwd`:$PATH sh ./install_aenet.sh 12 | 13 | set -ue 14 | 15 | VERSION=2.0.4 16 | 17 | URL=https://github.com/atomisticnet/aenet/archive/refs/tags/v${VERSION}.tar.gz 18 | wget $URL -O aenet.tar.gz 19 | rm -rf aenet 20 | mkdir aenet 21 | tar zxf aenet.tar.gz -C aenet --strip-components=1 22 | 23 | cd aenet/lib 24 | make 25 | cd ../src 26 | 27 | GFORTRAN_VERSION=$(gfortran -dumpversion | cut -d. -f1) 28 | if [ $GFORTRAN_VERSION -ge 10 ]; then 29 | LOCAL_FCFLAGS="-fallow-argument-mismatch -O2 -fexternal-blas \$(DEBUG)" 30 | else 31 | LOCAL_FCFLAGS="-O2 -fexternal-blas \$(DEBUG)" 32 | fi 33 | 34 | cd makefiles 35 | sed -i.orig "s/FCFLAGS *=.*/FCFLAGS = ${LOCAL_FCFLAGS}/" Makefile.gfortran_serial 36 | sed -i.orig "s/FCFLAGS *=.*/FCFLAGS = ${LOCAL_FCFLAGS} -DPARALLEL/" Makefile.gfortran_mpi 37 | cd .. 38 | 39 | make -f makefiles/Makefile.gfortran_serial 40 | 41 | cd ../bin 42 | mkdir -p ~/opt/aenet/bin 43 | cp generate.x-${VERSION}-gfortran_serial ~/opt/aenet/bin/generate.x_serial 44 | cp predict.x-${VERSION}-gfortran_serial ~/opt/aenet/bin/predict.x_serial 45 | 46 | cd ../src 47 | make clean 48 | make -f makefiles/Makefile.gfortran_mpi 49 | cd ../bin 50 | cp train.x-${VERSION}-gfortran_mpi ~/opt/aenet/bin/train.x_mpi 51 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/mock.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from pymatgen.core import Structure 5 | 6 | def calc_energy(st: Structure) -> float: 7 | ene = 0.0 8 | st_local = st.copy() 9 | dm = st_local.distance_matrix 10 | n = len(st_local) 11 | an_mean = 0.0 12 | for i in range(n): 13 | an_mean += st_local.species[i].number 14 | an_mean /= n 15 | for i in range(n): 16 | an_i = st_local.species[i].number - an_mean 17 | for j in range(i + 1, n): 18 | an_j = st_local.species[j].number - an_mean 19 | ene += (an_i * an_j) / (dm[i, j] ** 2) 20 | return ene 21 | 22 | if __name__ == "__main__": 23 | output_dir = sys.argv[1] if len(sys.argv) > 1 else "." 24 | stfile = os.path.join(output_dir, "structure.vasp") 25 | st = Structure.from_file(stfile) 26 | energy = calc_energy(st) 27 | with open(os.path.join(output_dir, "energy.dat"), "w") as f: 28 | f.write("{:.15f}\n".format(energy)) 29 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | parallel --delay 0.2 -j 8 --joblog runtask.log $RESUME_OPT \ 3 | -a rundirs.txt python3 ./mock.py 4 | sleep 5 5 | -------------------------------------------------------------------------------- /tests/integration/active_learn_aenet/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f ./ALloop.progress 8 | rm -f ./rundirs.txt 9 | rm -f ./runtask.log 10 | 11 | rm -rf ./AL0 12 | rm -rf ./AL1 13 | rm -rf ./MC0 14 | rm -rf ./MC1 15 | rm -rf ./aenetXSF 16 | rm -rf ./train0 17 | rm -rf ./generate0 18 | rm -rf ./baseinput 19 | 20 | sh ./AL.sh 21 | sh ./MC.sh 22 | sh ./AL.sh 23 | sh ./MC.sh 24 | 25 | if [ -e MC1/kTs.npy ] ; then 26 | echo OK 27 | exit 0 28 | else 29 | echo FAILED 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f active.out 3 | echo start AL sample 4 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 5 | echo start parallel_run 1 6 | sh parallel_run.sh 7 | sleep 5 8 | 9 | echo start AL final 10 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 11 | sleep 5 12 | 13 | #train 14 | echo start training 15 | abics_train input.toml 16 | echo 'cat train0/stdout' 17 | cat train0/stdout 18 | echo Done 19 | -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mpiexec -np 2 --oversubscribe abics_sampling input.toml 3 | echo Done 4 | -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/install_mlip3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script installs MLIP-3 4 | 5 | # NOTE for macOS users: 6 | # 1. macOS's `make` is GNU make 3.x, which is not supported by MLIP-3. 7 | # You need to install GNU make 4.x by `brew install make` and use `gmake` instead of `make` as 8 | # $ MAKE=gmake sh ./install_mlip3.sh 9 | # 2. `gcc` (/usr/bin/gcc) does not mean GNU CC and hence the compilation will fail. 10 | # To use this script, make sure that `gcc` command invokes GNU CC by, for example, 11 | # $ ln -s `which gcc-11` ./gcc 12 | # $ ln -s `which g++-11` ./g++ 13 | # $ PATH=`pwd`:$PATH sh ./install_mlip3.sh 14 | 15 | if [ -z ${MAKE} ]; then 16 | MAKE=make 17 | fi 18 | 19 | set -ue 20 | 21 | URL=https://gitlab.com/ashapeev/mlip-3/-/archive/main/mlip-3-main.tar.gz 22 | if [ ! -e mlip-3.tar.gz ]; then 23 | wget $URL -O mlip-3.tar.gz 24 | fi 25 | rm -rf mlip-3 26 | mkdir mlip-3 27 | tar zxf mlip-3.tar.gz -C mlip-3 --strip-components=1 28 | cd mlip-3 29 | 30 | ./configure --no-mpi --compiler=gnu 31 | 32 | cd make 33 | 34 | GFORTRAN_VERSION=$(gfortran -dumpversion | cut -d. -f1) 35 | if [ $GFORTRAN_VERSION -ge 10 ]; then 36 | echo "FFLAGS += -fallow-argument-mismatch" >> config.mk 37 | fi 38 | 39 | cd .. 40 | 41 | $MAKE mlp -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/mlip-3_train_input/train/input.almtp: -------------------------------------------------------------------------------- 1 | MTP 2 | version = 1.1.0 3 | potential_name = MTP1m 4 | species_count = 3 5 | potential_tag = 6 | radial_basis_type = RBChebyshev 7 | min_dist = 2.3 8 | max_dist = 5 9 | radial_basis_size = 8 10 | radial_funcs_count = 2 11 | alpha_moments_count = 8 12 | alpha_index_basic_count = 5 13 | alpha_index_basic = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}} 14 | alpha_index_times_count = 5 15 | alpha_index_times = {{0, 0, 1, 5}, {1, 1, 1, 6}, {2, 2, 1, 6}, {3, 3, 1, 6}, {0, 5, 1, 7}} 16 | alpha_scalar_moments = 5 17 | alpha_moment_mapping = {0, 4, 5, 6, 7} -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/mock.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from pymatgen.core import Structure 5 | 6 | def calc_energy(st: Structure) -> float: 7 | ene = 0.0 8 | st_local = st.copy() 9 | dm = st_local.distance_matrix 10 | n = len(st_local) 11 | an_mean = 0.0 12 | for i in range(n): 13 | an_mean += st_local.species[i].number 14 | an_mean /= n 15 | for i in range(n): 16 | an_i = st_local.species[i].number - an_mean 17 | for j in range(i + 1, n): 18 | an_j = st_local.species[j].number - an_mean 19 | ene += (an_i * an_j) / (dm[i, j] ** 2) 20 | return ene 21 | 22 | if __name__ == "__main__": 23 | output_dir = sys.argv[1] if len(sys.argv) > 1 else "." 24 | stfile = os.path.join(output_dir, "structure.vasp") 25 | st = Structure.from_file(stfile) 26 | energy = calc_energy(st) 27 | with open(os.path.join(output_dir, "energy.dat"), "w") as f: 28 | f.write("{:.15f}\n".format(energy)) 29 | -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | parallel --delay 0.2 -j 8 --joblog runtask.log $RESUME_OPT \ 3 | -a rundirs.txt python3 ./mock.py 4 | sleep 5 5 | -------------------------------------------------------------------------------- /tests/integration/active_learn_mlip3/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f ./ALloop.progress 8 | rm -f ./rundirs.txt 9 | rm -f ./runtask.log 10 | 11 | rm -rf ./AL0 12 | rm -rf ./AL1 13 | rm -rf ./MC0 14 | rm -rf ./MC1 15 | rm -rf ./mlip-3_XSF 16 | rm -rf ./train0 17 | rm -rf ./generate0 18 | rm -rf ./baseinput 19 | 20 | sh ./AL.sh 21 | sh ./MC.sh 22 | sh ./AL.sh 23 | sh ./MC.sh 24 | 25 | if [ -e MC1/kTs.npy ] ; then 26 | echo OK 27 | exit 0 28 | else 29 | echo FAILED 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/AL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f active.out 3 | echo start AL sample 4 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 5 | echo start parallel_run 1 6 | sh parallel_run.sh 7 | sleep 5 8 | 9 | echo start AL final 10 | mpiexec -np 2 --oversubscribe abics_mlref input.toml 11 | sleep 5 12 | 13 | #train 14 | echo start training 15 | abics_train input.toml 16 | 17 | # for debug 18 | echo '== cat train0/stdout ==' 19 | cat train0/stdout 20 | echo '== end of train0/stdout ==' 21 | 22 | echo Done 23 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/MC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mpiexec -np 2 --oversubscribe abics_sampling input.toml 3 | echo Done 4 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/allegro_train_input/train/input.yaml: -------------------------------------------------------------------------------- 1 | root: results/spinel 2 | run_name: run 3 | seed: 123 4 | dataset_seed: 456 5 | 6 | # network 7 | AllegroBesselBasis_trainable: true 8 | bessel_frequency_cutoff: 4 9 | PolynomialCutoff_p: 6 10 | l_max: 1 11 | r_max: 8.0 12 | parity: o3_full 13 | num_layers: 2 14 | 15 | num_tensor_features: 16 16 | tensors_mixing_mode: p 17 | two_body_latent_mlp_latent_dimensions: [32, 64] 18 | two_body_latent_mlp_nonlinearity: silu 19 | latent_mlp_latent_dimensions: [64, 64] 20 | latent_mlp_nonlinearity: silu 21 | latent_mlp_initialization: uniform 22 | latent_resnet: true 23 | env_embed_mlp_latent_dimensions: [] 24 | env_embed_mlp_nonlinearity: null 25 | env_embed_mlp_initialization: uniform 26 | edge_eng_mlp_latent_dimensions: [16] 27 | edge_eng_mlp_nonlinearity: null 28 | edge_eng_mlp_initialization: uniform 29 | 30 | model_builders: 31 | - allegro.model.Allegro 32 | - PerSpeciesRescale 33 | - RescaleEnergyEtc 34 | 35 | 36 | dataset: ase 37 | dataset_file_name: structure.xyz 38 | chemical_symbols: 39 | - Mg 40 | - Al 41 | 42 | # logging 43 | wandb: false 44 | # verbose: debug 45 | 46 | # training 47 | n_train: 80% 48 | n_val: 20% 49 | batch_size: 5 50 | train_val_split: random 51 | #shuffle: true 52 | metrics_key: validation_loss 53 | use_ema: true 54 | ema_decay: 0.99 55 | ema_use_num_updates: true 56 | max_epochs: 100 57 | learning_rate: 0.01 58 | # loss function 59 | loss_coeffs: total_energy 60 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/install_nequip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script installs pytorch, nequip, and allegro 4 | # into python3 environment 5 | 6 | set -ue 7 | 8 | echo "python3 points to the following:" 9 | which python3 10 | 11 | echo 12 | 13 | python3 -m pip install torch==2.5.1 14 | python3 -m pip install nequip 15 | python3 -m pip install git+https://github.com/mir-group/allegro.git 16 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/mock.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from pymatgen.core import Structure 5 | 6 | def calc_energy(st: Structure) -> float: 7 | ene = 0.0 8 | st_local = st.copy() 9 | dm = st_local.distance_matrix 10 | n = len(st_local) 11 | an_mean = 0.0 12 | for i in range(n): 13 | an_mean += st_local.species[i].number 14 | an_mean /= n 15 | for i in range(n): 16 | an_i = st_local.species[i].number - an_mean 17 | for j in range(i + 1, n): 18 | an_j = st_local.species[j].number - an_mean 19 | ene += (an_i * an_j) / (dm[i, j] ** 2) 20 | return ene 21 | 22 | if __name__ == "__main__": 23 | output_dir = sys.argv[1] if len(sys.argv) > 1 else "." 24 | stfile = os.path.join(output_dir, "structure.vasp") 25 | st = Structure.from_file(stfile) 26 | energy = calc_energy(st) 27 | with open(os.path.join(output_dir, "energy.dat"), "w") as f: 28 | f.write("{:.15f}\n".format(energy)) 29 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/parallel_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | parallel --delay 0.2 -j 8 --joblog runtask.log $RESUME_OPT \ 3 | -a rundirs.txt python3 ./mock.py 4 | sleep 5 5 | -------------------------------------------------------------------------------- /tests/integration/active_learn_nequip/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f ./ALloop.progress 8 | rm -f ./rundirs.txt 9 | rm -f ./runtask.log 10 | 11 | rm -rf ./AL0 12 | rm -rf ./AL1 13 | rm -rf ./MC0 14 | rm -rf ./MC1 15 | rm -rf ./nequipXSF 16 | rm -rf ./train0 17 | rm -rf ./generate0 18 | rm -rf ./baseinput 19 | 20 | sh ./AL.sh 21 | sh ./MC.sh 22 | sh ./AL.sh 23 | sh ./MC.sh 24 | 25 | if [ -e MC1/kTs.npy ] ; then 26 | echo OK 27 | exit 0 28 | else 29 | echo FAILED 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /tests/integration/mock/check.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | 4 | obs = np.loadtxt(os.path.join("0", "obs.dat")) 5 | num_Al = int(obs[-1, 4]) 6 | num_Mg = int(obs[-1, 5]) 7 | 8 | np.testing.assert_equal(num_Al, 0) 9 | np.testing.assert_equal(num_Mg, 24) 10 | 11 | print("OK") 12 | -------------------------------------------------------------------------------- /tests/integration/mock/mock.py: -------------------------------------------------------------------------------- 1 | def calc_energy(st): 2 | ene = 0.0 3 | st_local = st.copy() 4 | dm = st_local.distance_matrix 5 | n = len(st_local) 6 | an_mean = 0 7 | for i in range(n): 8 | an_mean += st_local.species[i].number 9 | an_mean /= n 10 | for i in range(n): 11 | an_i = st_local.species[i].number - an_mean 12 | for j in range(i + 1, n): 13 | an_j = st_local.species[j].number - an_mean 14 | ene += (an_i * an_j) / (dm[i, j] ** 2) 15 | return ene 16 | 17 | def num_element(st, sp): 18 | n = 0 19 | for i in range(len(st)): 20 | if st.species[i].symbol == sp: 21 | n += 1 22 | return n 23 | 24 | def num_Al(st): 25 | return num_element(st, "Al") 26 | 27 | def num_Mg(st): 28 | return num_element(st, "Mg") 29 | -------------------------------------------------------------------------------- /tests/integration/mock/ref_logZ.dat: -------------------------------------------------------------------------------- 1 | 0.12925999893 0.0 0.0 0.0 0.0 2 | 0.103407999144 182.08340416110747 0.08375705745792174 182.08340416110747 0.08375705745792174 3 | -------------------------------------------------------------------------------- /tests/integration/mock/ref_result.dat: -------------------------------------------------------------------------------- 1 | 0.103407999144 -94.10025533129131 0.034296529172928275 8854.879284761255 6.45642615718613 0.021172534441757318 0.0058137462512733605 2 | 0.12925999893 -94.11258301960876 0.04274459952101611 8857.211261791974 8.045547649341904 0.03288781418423248 0.012108635612879597 3 | -------------------------------------------------------------------------------- /tests/integration/mock/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f kTs.npy 8 | mpiexec -np 2 --oversubscribe abics_sampling input.toml 9 | 10 | python3 ./check.py 11 | -------------------------------------------------------------------------------- /tests/integration/openmx/baseinput/base.dat: -------------------------------------------------------------------------------- 1 | # 2 | # File Name 3 | # 4 | 5 | System.CurrrentDirectory ./ # default=./ 6 | System.Name met 7 | level.of.stdout 1 # default=1 (1-3) 8 | level.of.fileout 1 # default=1 (0-2) 9 | 10 | # 11 | # Definition of Atomic Species 12 | # 13 | 14 | Species.Number 3 15 | 23 | 24 | # 25 | # Atoms 26 | # 27 | 28 | Atoms.Number 0 29 | Atoms.SpeciesAndCoordinates.Unit Ang # Ang|AU 30 | 32 | # 33 | # SCF or Electronic System 34 | # 35 | 36 | scf.XcType GGA-PBE # LDA|LSDA-CA|LSDA-PW|GGA-PBE 37 | scf.SpinPolarization off # On|Off|NC 38 | scf.ElectronicTemperature 300.0 # default=300 (K) 39 | scf.energycutoff 180.0 # default=150 (Ry) 40 | scf.maxIter 30 # default=40 41 | scf.EigenvalueSolver cluster # DC|GDC|Cluster|Band 42 | scf.Kgrid 1 1 1 # means n1 x n2 x n3 43 | scf.Mixing.Type rmm-diisk # Simple|Rmm-Diis|Gr-Pulay|Kerker|Rmm-Diisk 44 | scf.Init.Mixing.Weight 0.005 # default=0.30 45 | scf.Min.Mixing.Weight 0.001 # default=0.001 46 | scf.Max.Mixing.Weight 0.30 # default=0.40 47 | scf.Mixing.History 25 # default=5 48 | scf.Mixing.StartPulay 10 # default=6 49 | scf.criterion 1.0e-6 # default=1.0e-6 (Hartree) 50 | scf.lapack.dste dstevx # dstevx|dstedc|dstegr,default=dstevx 51 | scf.ProExpn.VNA off 52 | 53 | # 54 | # MD or Geometry Optimization 55 | # 56 | 57 | MD.Type nomd # Nomd|Opt|NVE|NVT_VS|NVT_NH 58 | # Constraint_Opt|DIIS 59 | MD.maxIter 1 # default=1 60 | MD.TimeStep 1.0 # default=0.5 (fs) 61 | MD.Opt.criterion 1.0e-4 # default=1.0e-4 (Hartree/bohr) 62 | -------------------------------------------------------------------------------- /tests/integration/openmx/do_mpich.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/openmx/do_openmpi.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 --oversubscribe --mca orte_abort_on_non_zero_status 0 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/openmx/fulltest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | import sys 4 | 5 | from mpi4py import MPI 6 | import numpy as np 7 | 8 | sys.path.insert(0, "../../../") 9 | 10 | from abics.scripts.main import main_impl 11 | 12 | 13 | class TestAbics(unittest.TestCase): 14 | def test_hoge(self): 15 | main_impl("input.toml") 16 | if MPI.COMM_WORLD.Get_rank() == 0: 17 | ref_T = np.array([[0.103407999144, 0.103407999144], [0.08617333262, 0.08617333262]]) 18 | ref_E = np.array( 19 | [[-5963.873264468331, -5963.8732643856365], [-5963.871843725528, -5963.873264468331]] 20 | ) 21 | T = np.zeros((2, 2)) 22 | E = np.zeros((2, 2)) 23 | for i in (0, 1): 24 | with open(os.path.join(str(i), "obs.dat")) as f: 25 | for j, line in enumerate(f): 26 | words = line.split() 27 | T[i, j] = float(words[1]) 28 | E[i, j] = float(words[2]) 29 | if j == 1: 30 | break 31 | 32 | # print() 33 | # print(T) 34 | # print(E) 35 | # print() 36 | # print(ref_T) 37 | # print(ref_E) 38 | # print() 39 | 40 | self.assertTrue(np.allclose(T, ref_T)) 41 | self.assertTrue(np.allclose(E, ref_E)) 42 | 43 | 44 | if __name__ == "__main__": 45 | unittest.main() 46 | -------------------------------------------------------------------------------- /tests/integration/openmx/input.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | 13 | seed = 12345 14 | 15 | [solver] 16 | type = 'openmx' 17 | path= '~/opt/openmx/bin/openmx' 18 | base_input_dir = './baseinput' 19 | perturb = 0.0 20 | run_scheme = 'mpi_spawn_wrapper' 21 | 22 | [config] 23 | unitcell = """ 24 | 4.056800 4.056800 0.000000 25 | 4.056800 0.000000 -4.056800 26 | 0.000000 4.056800 -4.056800 27 | """ 28 | supercell = [1,1,1] 29 | 30 | [[config.base_structure]] 31 | type = "O" 32 | coords = """ 33 | 0.712200 0.762600 0.762600 34 | 0.287800 0.237400 0.237400 35 | 0.262600 0.762600 0.762600 36 | 0.737400 0.237400 0.237400 37 | 0.262600 0.762600 0.212200 38 | 0.737400 0.237400 0.787800 39 | 0.262600 0.212200 0.762600 40 | 0.737400 0.787800 0.237400 41 | """ 42 | 43 | [[config.defect_structure]] 44 | coords = """ 45 | 1.000000 0.000000 0.000000 46 | 0.500000 0.000000 0.000000 47 | 0.500000 0.000000 0.500000 48 | 0.500000 0.500000 0.000000 49 | 0.125000 0.625000 0.625000 50 | 0.875000 0.375000 0.375000 51 | """ 52 | [[config.defect_structure.groups]] 53 | name = 'Al' 54 | num = 4 55 | [[config.defect_structure.groups]] 56 | name = 'Mg' 57 | num = 2 58 | 59 | [observer] 60 | ignored_species = ['O'] 61 | -------------------------------------------------------------------------------- /tests/integration/potts/check.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | for name in ("energy", "magnetization", "logZ"): 4 | res = np.loadtxt(f"./{name}.dat") 5 | ref = np.loadtxt(f"./ref_{name}.dat") 6 | np.testing.assert_array_almost_equal(res, ref) 7 | print(f"{name} OK") 8 | print("All OK") 9 | -------------------------------------------------------------------------------- /tests/integration/potts/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | nreplicas = 4 3 | nprocs_per_replica = 1 4 | kTstart = 1.0 5 | kTend = 1.2 6 | nsteps = 512 # Number of steps for sampling 7 | RXtrial_frequency = 32 8 | sample_frequency = 8 9 | print_frequency = 4 10 | reload = false 11 | seed = 12345 12 | 13 | [sampling.solver] 14 | type = 'potts' 15 | 16 | [config] 17 | Q = 2 18 | L = [8, 8] 19 | -------------------------------------------------------------------------------- /tests/integration/potts/ref_energy.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: 3 | # $3: ERROR of 4 | # $4: 5 | # $5: ERROR of 6 | # $6: - ^2 7 | # $7: ERROR of - ^2 8 | 1.0 -121.0625 1.157644366231726 14696.375 275.89434460687335 41.54435483871771 9.082645128650052 9 | 1.0666666666666667 -115.6875 1.404939628240673 13442.875 318.7984326918572 61.1895161290272 13.030986814164445 10 | 1.1333333333333333 -115.1875 1.2703596875263272 13316.625 293.70650739640195 50.02822580645352 10.611960551204579 11 | 1.2 -107.375 1.88633841944501 11636.25 408.07323973845035 110.30645161289067 23.036888483676954 12 | -------------------------------------------------------------------------------- /tests/integration/potts/ref_logZ.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: logZ 3 | # $3: ERROR of log(Z) 4 | # $4: log(Z/Z') 5 | # $5: ERROR of log(Z/Z') 6 | 1.2 0.0 0.0 0.0 0.0 7 | 1.1333333333333333 5.396926635579163 0.0949839989301199 5.396926635579163 0.0949839989301199 8 | 1.0666666666666667 11.825718404332694 0.1661080584748836 6.4287917687535305 0.07112405954476371 9 | 1.0 19.16310179605473 0.2420201058363595 7.337383391722035 0.07591204736147589 10 | -------------------------------------------------------------------------------- /tests/integration/potts/ref_magnetization.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: 3 | # $3: ERROR of 4 | # $4: 5 | # $5: ERROR of 6 | # $6: - ^2 7 | # $7: ERROR of - ^2 8 | 1.0 0.08544921875 0.0838755244302223 0.21857452392578125 0.0055440665964392325 0.21808821155179192 0.015822919631098366 9 | 1.0666666666666667 0.12939453125 0.07483218893427532 0.18491363525390625 0.009329988734055125 0.17359555152154993 0.021671563105884212 10 | 1.1333333333333333 0.21142578125 0.06889951126688247 0.18726348876953125 0.007112425938934922 0.14716142223727413 0.030862950012829623 11 | 1.2 -0.271484375 0.04249293865788807 0.1279296875 0.012908371545344579 0.05597514490927402 0.02015089144951152 12 | -------------------------------------------------------------------------------- /tests/integration/potts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f ./kTs.npy 8 | mpiexec -np 4 --oversubscribe abics_sampling input.toml 9 | python3 ./check.py 10 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/check.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | for name in ("energy", "magnetization", "logZ"): 4 | res = np.loadtxt(f"./{name}.dat") 5 | ref = np.loadtxt(f"./ref_{name}.dat") 6 | np.testing.assert_array_almost_equal(res, ref) 7 | print(f"{name} OK") 8 | print("All OK") 9 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/input.toml: -------------------------------------------------------------------------------- 1 | [sampling] 2 | sampler = "PAMC" 3 | nreplicas = 4 4 | nprocs_per_replica = 1 5 | kTstart = 1.5 6 | kTend = 0.8 7 | kTnum = 8 8 | nsteps_between_anneal = 256 9 | resample_frequency = 2 10 | sample_frequency = 8 11 | print_frequency = 4 12 | reload = false 13 | seed = 12345 14 | 15 | [sampling.solver] 16 | type = 'potts' 17 | 18 | [config] 19 | Q = 2 20 | L = [8, 8] 21 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/ref_energy.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: 3 | # $3: ERROR of 4 | # $4: 5 | # $5: ERROR of 6 | # $6: - ^2 7 | # $7: ERROR of - ^2 8 | 1.5 -91.08667640338942 0.059103116474889215 8367.405307558533 22.989523711315105 70.61919616437535 12.242650278916921 9 | 1.4 -92.81006223654245 0.1519493690083824 8671.223401785166 33.945612551552834 57.49266082354143 5.764075742402402 10 | 1.3 -98.9453125 0.8750348765370727 9910.671875 192.62434156380814 119.7313232421875 20.28464148816084 11 | 1.2 -104.9925153321054 0.35112084605933047 11155.35132857298 80.51493205217075 131.79976696205676 13.493842450736489 12 | 1.1 -114.67578125 1.447670163181927 13214.3046875 319.35597070189436 61.67413330078125 14.777878873238153 13 | 1.0 -119.95122764907688 0.24978276445936773 14426.556257600645 60.03747601987018 38.19685165055762 4.177264851438904 14 | 0.9 -123.82421875 0.13229448610840702 15353.1015625 33.07472138694775 20.64691162109375 0.5674362387264472 15 | 0.8 -125.912018117232 0.1073852855062682 15864.48671328651 26.253500664363 10.638875332806492 1.4418706399679244 16 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/ref_logZ.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: logZ 3 | # $3: ERROR of log(Z) 4 | # $4: log(Z/Z') 5 | # $5: ERROR of log(Z/Z') 6 | inf 0.0 0.0 0.0 0.0 7 | 1.5 46.351712573948014 0.5281956305919244 46.351712573948014 0.5281956305919244 8 | 1.4 50.662501489436224 0.8542336782642341 4.310788915488207 0.3260380476723097 9 | 1.3 55.7846647191256 1.0071269871071342 5.1221632296893755 0.15289330884289998 10 | 1.2 62.68840955137748 1.1825155971800079 6.903744832251879 0.17538861007287368 11 | 1.1 71.15371432308088 1.3341203386576614 8.465304771703392 0.15160474147765365 12 | 1.0 82.18635051623406 1.542628508011546 11.032636193153184 0.20850816935388458 13 | 0.9 95.06204683345848 1.8825665019545228 12.875696317224426 0.3399379939429767 14 | 0.8 112.4940857725105 2.1913560971675583 17.432038939052017 0.3087895952130353 15 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/ref_magnetization.dat: -------------------------------------------------------------------------------- 1 | # $1: temperature 2 | # $2: 3 | # $3: ERROR of 4 | # $4: 5 | # $5: ERROR of 6 | # $6: - ^2 7 | # $7: ERROR of - ^2 8 | 1.5 0.04575644252507231 0.0011439803943854331 0.033151066049451054 0.00020626308727350796 0.031056105325758067 0.0003086360387533913 9 | 1.4 0.044346384336985276 0.04728839924833249 0.0488052957708343 0.0005718155132195398 0.04460250126360099 0.0016724026166808376 10 | 1.3 0.0369873046875 0.06974489200852506 0.08083534240722656 0.006451422568185271 0.07460293173789978 0.0072083241871617005 11 | 1.2 0.1344341929479966 0.0840172299573028 0.11922348574714393 0.0038127631992626487 0.09409203858386644 0.01862251569588917 12 | 1.1 0.15203857421875 0.1663759136755236 0.17820072174072266 0.008868501443087254 0.12740404903888702 0.07139824861818925 13 | 1.0 0.3908951213226717 0.11197830212701919 0.211699174800154 0.0021800299188902473 0.04636103877903777 0.07494425505019704 14 | 0.9 0.4805908203125 0.0012176475429235842 0.23162555694580078 0.0010921086701712877 0.0006565377116203308 0.00011459459966252352 15 | 0.8 0.49044600178319986 0.00048674948887343086 0.24082401328815303 0.00044979200339395967 0.00028649569796159596 5.785324689518792e-05 16 | -------------------------------------------------------------------------------- /tests/integration/potts_pamc/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OMP_NUM_THREADS=1 4 | 5 | set -e 6 | 7 | rm -f result.dat 8 | mpiexec -np 4 --oversubscribe abics_sampling input.toml 9 | python3 ./check.py 10 | -------------------------------------------------------------------------------- /tests/integration/qe/baseinput/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'relax' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/opt/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | etot_conv_thr = 0.01 9 | forc_conv_thr = 0.1 10 | / 11 | &SYSTEM 12 | ecutwfc = 30.0 13 | occupations = "smearing" 14 | smearing = "gauss" 15 | degauss = 0.01 16 | / 17 | &electrons 18 | mixing_beta = 0.7 19 | conv_thr = 1.0d-3 20 | electron_maxstep = 100 21 | scf_must_converge = .false. 22 | / 23 | &IONS 24 | / 25 | ATOMIC_SPECIES 26 | Al 26.981 Al.pbe-nl-kjpaw_psl.1.0.0.UPF 27 | Mg 24.305 Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 28 | O 16.000 O.pbe-n-kjpaw_psl.1.0.0.UPF 29 | ATOMIC_POSITIONS crystal 30 | 31 | K_POINTS gamma 32 | -------------------------------------------------------------------------------- /tests/integration/qe/do_mpich.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/qe/do_openmpi.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 --oversubscribe --mca orte_abort_on_non_zero_status 0 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/qe/fulltest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | import shutil 4 | import sys 5 | 6 | from mpi4py import MPI 7 | import numpy as np 8 | 9 | sys.path.insert(0, "../../../") 10 | 11 | from abics.scripts.main import main_impl 12 | 13 | 14 | class TestAbics(unittest.TestCase): 15 | def test_hoge(self): 16 | if MPI.COMM_WORLD.Get_rank() == 0: 17 | for i in (0, 1): 18 | filename = os.path.join(str(i), "obs.dat") 19 | if os.path.exists(filename): 20 | os.remove(filename) 21 | MPI.COMM_WORLD.Barrier() 22 | main_impl("input.toml") 23 | if MPI.COMM_WORLD.Get_rank() == 0: 24 | ref_T = np.array([[0.103407999144, 0.103407999144], [0.08617333262, 0.08617333262]]) 25 | ref_E = np.array( 26 | [[-10523.995551536314, -10523.995551536314], [-10523.756844217527, -10523.710990099398]] 27 | ) 28 | 29 | T = np.zeros((2, 2)) 30 | E = np.zeros((2, 2)) 31 | for i in (0, 1): 32 | with open(os.path.join(str(i), "obs.dat")) as f: 33 | for j, line in enumerate(f): 34 | words = line.split() 35 | T[i, j] = float(words[1]) 36 | E[i, j] = float(words[2]) 37 | if j == 1: 38 | break 39 | self.assertTrue(np.allclose(T, ref_T)) 40 | self.assertTrue(np.allclose(E, ref_E)) 41 | 42 | 43 | if __name__ == "__main__": 44 | unittest.main() 45 | -------------------------------------------------------------------------------- /tests/integration/qe/input.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | seed = 12345 13 | 14 | [solver] 15 | type = 'qe' 16 | path= '~/opt/qe/bin/pw.x' 17 | base_input_dir = './baseinput' 18 | perturb = 0.1 19 | run_scheme = 'mpi_spawn' 20 | 21 | [config] 22 | unitcell = """ 23 | 4.056800 4.056800 0.000000 24 | 4.056800 0.000000 -4.056800 25 | 0.000000 4.056800 -4.056800 26 | """ 27 | supercell = [1,1,1] 28 | 29 | [[config.base_structure]] 30 | type = "O" 31 | coords = """ 32 | 0.712200 0.762600 0.762600 33 | 0.287800 0.237400 0.237400 34 | 0.262600 0.762600 0.762600 35 | 0.737400 0.237400 0.237400 36 | 0.262600 0.762600 0.212200 37 | 0.737400 0.237400 0.787800 38 | 0.262600 0.212200 0.762600 39 | 0.737400 0.787800 0.237400 40 | """ 41 | 42 | [[config.defect_structure]] 43 | coords = """ 44 | 1.000000 0.000000 0.000000 45 | 0.500000 0.000000 0.000000 46 | 0.500000 0.000000 0.500000 47 | 0.500000 0.500000 0.000000 48 | 0.125000 0.625000 0.625000 49 | 0.875000 0.375000 0.375000 50 | """ 51 | [[config.defect_structure.groups]] 52 | name = 'Al' 53 | num = 4 54 | [[config.defect_structure.groups]] 55 | name = 'Mg' 56 | num = 2 57 | 58 | [observer] 59 | ignored_species = ['O'] 60 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/baseinput/scf.in: -------------------------------------------------------------------------------- 1 | &CONTROL 2 | calculation = 'scf' 3 | tstress = .false. 4 | tprnfor = .false. 5 | pseudo_dir = '~/opt/qe/pot' 6 | disk_io = 'low' 7 | wf_collect = .false. 8 | / 9 | &SYSTEM 10 | ecutwfc = 60.0 11 | occupations = "smearing" 12 | smearing = "gauss" 13 | degauss = 0.01 14 | / 15 | &electrons 16 | mixing_beta = 0.7 17 | conv_thr = 1.0d-4 18 | electron_maxstep = 3 19 | / 20 | ATOMIC_SPECIES 21 | Al 26.981 Al.pbe-nl-kjpaw_psl.1.0.0.UPF 22 | Mg 24.305 Mg.pbe-spnl-kjpaw_psl.1.0.0.UPF 23 | O 16.000 O.pbe-n-kjpaw_psl.1.0.0.UPF 24 | ATOMIC_POSITIONS crystal 25 | 26 | K_POINTS gamma 27 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/do_mpich.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/do_openmpi.sh: -------------------------------------------------------------------------------- 1 | OMP_NUM_THREADS=1 mpiexec -np 2 --oversubscribe --mca orte_abort_on_non_zero_status 0 python ./fulltest.py 2 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/fulltest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import sys 4 | import unittest 5 | 6 | from mpi4py import MPI 7 | import numpy as np 8 | 9 | sys.path.insert(0, "../../../") 10 | 11 | from abics.scripts.main import main_impl 12 | 13 | 14 | class TestAbics(unittest.TestCase): 15 | def test_hoge(self): 16 | if MPI.COMM_WORLD.Get_rank() == 0: 17 | for i in (0, 1): 18 | if os.path.exists(str(i)): 19 | shutil.rmtree(str(i)) 20 | if os.path.exists("{}_4step".format(i)): 21 | shutil.rmtree("{}_4step".format(i)) 22 | MPI.COMM_WORLD.Barrier() 23 | 24 | main_impl("input_4steps.toml") 25 | if MPI.COMM_WORLD.Get_rank() == 0: 26 | ref_T = np.zeros((2, 4)) 27 | ref_E = np.zeros((2, 4)) 28 | for i in (0, 1): 29 | with open(os.path.join(str(i), "obs.dat")) as f: 30 | for j, line in enumerate(f): 31 | words = line.split() 32 | ref_T[i, j] = float(words[1]) 33 | ref_E[i, j] = float(words[2]) 34 | if j == 3: 35 | break 36 | shutil.move(str(i), "{}_4step".format(i)) 37 | 38 | main_impl("input_2steps.toml") 39 | main_impl("input_2steps_restart.toml") 40 | 41 | if MPI.COMM_WORLD.Get_rank() == 0: 42 | res_T = np.zeros((2, 4)) 43 | res_E = np.zeros((2, 4)) 44 | for i in (0, 1): 45 | with open(os.path.join(str(i), "obs.dat")) as f: 46 | for j, line in enumerate(f): 47 | words = line.split() 48 | res_T[i, j] = float(words[1]) 49 | res_E[i, j] = float(words[2]) 50 | if j == 3: 51 | break 52 | self.assertTrue(np.allclose(res_T, ref_T)) 53 | self.assertTrue(np.allclose(res_E, ref_E)) 54 | 55 | 56 | if __name__ == "__main__": 57 | unittest.main() 58 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/input_2steps.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | seed = 12345 13 | 14 | reload = false 15 | 16 | [solver] 17 | type = 'qe' 18 | path= '~/opt/qe/bin/pw.x' 19 | base_input_dir = './baseinput' 20 | perturb = 0.0 21 | run_scheme = 'mpi_spawn' 22 | 23 | [config] 24 | unitcell = """ 25 | 4.056800 4.056800 0.000000 26 | 4.056800 0.000000 -4.056800 27 | 0.000000 4.056800 -4.056800 28 | """ 29 | supercell = [1,1,1] 30 | 31 | [[config.base_structure]] 32 | type = "O" 33 | coords = """ 34 | 0.712200 0.762600 0.762600 35 | 0.287800 0.237400 0.237400 36 | 0.262600 0.762600 0.762600 37 | 0.737400 0.237400 0.237400 38 | 0.262600 0.762600 0.212200 39 | 0.737400 0.237400 0.787800 40 | 0.262600 0.212200 0.762600 41 | 0.737400 0.787800 0.237400 42 | """ 43 | 44 | [[config.defect_structure]] 45 | coords = """ 46 | 1.000000 0.000000 0.000000 47 | 0.500000 0.000000 0.000000 48 | 0.500000 0.000000 0.500000 49 | 0.500000 0.500000 0.000000 50 | 0.125000 0.625000 0.625000 51 | 0.875000 0.375000 0.375000 52 | """ 53 | [[config.defect_structure.groups]] 54 | name = 'Al' 55 | num = 4 56 | [[config.defect_structure.groups]] 57 | name = 'Mg' 58 | num = 2 59 | 60 | [observer] 61 | ignored_species = ['O'] 62 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/input_2steps_restart.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 2 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | seed = 12345 13 | 14 | reload = true 15 | 16 | [solver] 17 | type = 'qe' 18 | path= '~/opt/qe/bin/pw.x' 19 | base_input_dir = './baseinput' 20 | perturb = 0.0 21 | run_scheme = 'mpi_spawn' 22 | 23 | [config] 24 | unitcell = """ 25 | 4.056800 4.056800 0.000000 26 | 4.056800 0.000000 -4.056800 27 | 0.000000 4.056800 -4.056800 28 | """ 29 | supercell = [1,1,1] 30 | 31 | [[config.base_structure]] 32 | type = "O" 33 | coords = """ 34 | 0.712200 0.762600 0.762600 35 | 0.287800 0.237400 0.237400 36 | 0.262600 0.762600 0.762600 37 | 0.737400 0.237400 0.237400 38 | 0.262600 0.762600 0.212200 39 | 0.737400 0.237400 0.787800 40 | 0.262600 0.212200 0.762600 41 | 0.737400 0.787800 0.237400 42 | """ 43 | 44 | [[config.defect_structure]] 45 | coords = """ 46 | 1.000000 0.000000 0.000000 47 | 0.500000 0.000000 0.000000 48 | 0.500000 0.000000 0.500000 49 | 0.500000 0.500000 0.000000 50 | 0.125000 0.625000 0.625000 51 | 0.875000 0.375000 0.375000 52 | """ 53 | [[config.defect_structure.groups]] 54 | name = 'Al' 55 | num = 4 56 | [[config.defect_structure.groups]] 57 | name = 'Mg' 58 | num = 2 59 | 60 | [observer] 61 | ignored_species = ['O'] 62 | -------------------------------------------------------------------------------- /tests/integration/qe_restart/input_4steps.toml: -------------------------------------------------------------------------------- 1 | [replica] 2 | nreplicas = 2 3 | nprocs_per_replica = 1 4 | 5 | kTstart = 1000.0 6 | kTend = 1200.0 7 | 8 | nsteps = 4 # Number of steps for sampling 9 | RXtrial_frequency = 1 10 | sample_frequency = 1 11 | print_frequency = 1 12 | seed = 12345 13 | 14 | reload = false 15 | 16 | [solver] 17 | type = 'qe' 18 | path= '~/opt/qe/bin/pw.x' 19 | base_input_dir = './baseinput' 20 | perturb = 0.0 21 | run_scheme = 'mpi_spawn' 22 | 23 | [config] 24 | unitcell = """ 25 | 4.056800 4.056800 0.000000 26 | 4.056800 0.000000 -4.056800 27 | 0.000000 4.056800 -4.056800 28 | """ 29 | supercell = [1,1,1] 30 | 31 | [[config.base_structure]] 32 | type = "O" 33 | coords = """ 34 | 0.712200 0.762600 0.762600 35 | 0.287800 0.237400 0.237400 36 | 0.262600 0.762600 0.762600 37 | 0.737400 0.237400 0.237400 38 | 0.262600 0.762600 0.212200 39 | 0.737400 0.237400 0.787800 40 | 0.262600 0.212200 0.762600 41 | 0.737400 0.787800 0.237400 42 | """ 43 | 44 | [[config.defect_structure]] 45 | coords = """ 46 | 1.000000 0.000000 0.000000 47 | 0.500000 0.000000 0.000000 48 | 0.500000 0.000000 0.500000 49 | 0.500000 0.500000 0.000000 50 | 0.125000 0.625000 0.625000 51 | 0.875000 0.375000 0.375000 52 | """ 53 | [[config.defect_structure.groups]] 54 | name = 'Al' 55 | num = 4 56 | [[config.defect_structure.groups]] 57 | name = 'Mg' 58 | num = 2 59 | 60 | [observer] 61 | ignored_species = ['O'] 62 | -------------------------------------------------------------------------------- /tests/test_aenetpylammps.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | import os 18 | import shutil 19 | import unittest 20 | 21 | import numpy as np 22 | 23 | from pymatgen.core import Structure 24 | 25 | from abics.applications.latgas_abinitio_interface.base_solver import create_solver 26 | from abics.applications.latgas_abinitio_interface.params import DFTParams 27 | from abics.applications.latgas_abinitio_interface.aenet_pylammps import ( 28 | AenetPyLammpsSolver, 29 | ) 30 | 31 | 32 | class TestAenetPyLammps(unittest.TestCase): 33 | @classmethod 34 | def setUpClass(cls): 35 | rootdir = os.path.dirname(__file__) 36 | workdir = os.path.join(rootdir, "res", "aenet") 37 | if os.path.exists(workdir): 38 | shutil.rmtree(workdir) 39 | os.makedirs(workdir) 40 | 41 | def setUp(self): 42 | params = DFTParams.from_dict({"type": "aenetPyLammps", "path": "."}) 43 | 44 | self.imported = False 45 | try: 46 | self.solver = create_solver(params.solver, params) 47 | self.imported = True 48 | except ImportError: 49 | self.imported = False 50 | 51 | self.rootdir = os.path.dirname(__file__) 52 | self.datadir = os.path.join(self.rootdir, "data", "aenet") 53 | self.workdir = os.path.join(self.rootdir, "res", "aenet") 54 | 55 | def test_create_solver(self): 56 | if self.imported: 57 | self.assertIsInstance(self.solver, AenetPyLammpsSolver) 58 | -------------------------------------------------------------------------------- /tests/test_mc.py: -------------------------------------------------------------------------------- 1 | # ab-Initio Configuration Sampling tool kit (abICS) 2 | # Copyright (C) 2019- The University of Tokyo 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see http://www.gnu.org/licenses/. 16 | 17 | import unittest 18 | 19 | import numpy as np 20 | import numpy.random as random 21 | 22 | 23 | from abics.mc import Model, CanonicalMonteCarlo 24 | 25 | random.seed(12345) 26 | 27 | 28 | class TestMC(unittest.TestCase): 29 | class MyModel(Model): 30 | def energy(self, config): 31 | return config[0] * config[1] 32 | 33 | def newconfig(self, config, dconfig): 34 | ret = config[:] 35 | ret[dconfig] *= -1.0 36 | return ret 37 | 38 | def trialstep(self, config, energy): 39 | dconfig = random.randint(0, 1) 40 | dE = self.energy(self.newconfig(config, dconfig)) - energy 41 | return dconfig, dE 42 | 43 | def test_mc(self): 44 | self.mc = CanonicalMonteCarlo(TestMC.MyModel(), 1.0, [1.0,1.0]) 45 | # self.mc = CanonicalMonteCarlo(TestMC.dmodel, 1.0, 1) 46 | N = 100 47 | S = 0.0 48 | S2 =0.0 49 | for i in range(N): 50 | E = self.mc.run(100, sample_frequency=1)[0] 51 | S += E 52 | S2 += E*E 53 | m = S/N 54 | er = np.sqrt((S2 - S*S/N)/(N-1)/N) 55 | self.assertTrue(np.isclose(-np.tanh(1.0), m, atol=3*er, rtol=0.0)) 56 | --------------------------------------------------------------------------------