Skip to content

Commit 35216ec

Browse files
Merge pull request #414 from bastonero/new/flare-interface
New active learning with AiiDA and FLARE
2 parents b36d5db + 2be60bd commit 35216ec

25 files changed

Lines changed: 3580 additions & 123 deletions

.github/workflows/python-testsuite.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
cd CellConstructor
5757
pip install --no-build-isolation .
5858
cd ..
59+
git clone --depth 1 https://github.com/mir-group/flare.git flare
60+
cd flare
61+
pip install .
62+
cd ..
5963
6064
pip install --no-build-isolation .
6165

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ frequencies*.*
6565
timer.json
6666
minim.dat
6767
otf_run*
68+
nohup.out
6869
disp_*
6970
_data_tmp_
7071

Examples/sscha_and_aiida/README.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
# Instructions
22

3-
We provide here the script `run_aiida_sscha.py`, which performs a thermal expansion calculation using SSCHA and aiida-quantumespresso.
3+
We provide here some scripts to run SSCHA using AiiDA, FLARE machine-learning potential, and a combination of the two as on-the-fly active learning.
44

5-
It is preferable to execute the example that you already have some experience with both the SSCHA and AiiDA-QuantumEspresso codes. Nevertheless, you can try following the instructions and to run the example.
5+
* `run_aiida_sscha.py`, which performs a thermal expansion calculation using SSCHA and aiida-quantumespresso.
6+
* `run_flare_sscha.py`, which performs a thermal expansion calculation using SSCHA and FLARE machine-learning interatomic potential.
7+
* `run_aiida_flare_sscha.py`, which performs an on-the-fly active learning SSCHA calculation using aiida-quantumespresso for DFT and FLARE as the ML potential.
8+
9+
It is preferable to execute the example that you already have some experience with both the SSCHA and AiiDA-QuantumESPRESSO codes. Nevertheless, you can try following the instructions and to run the example.
610

711
## Installation
812

9-
We recommend to install all the packages via `mamba` (which is based on top of `conda`). After having installed `mamba`, you can simply run the following:
13+
We recommend to install all the packages via `mamba` (which is based on `conda`). After having installed `mamba`, you can simply run the following:
1014

1115
```console
12-
> mamba create -n aiida-sscha -c conda-forge python gfortran libblas lapack openmpi julia openmpi-mpicc pip numpy scipy spglib aiida-core
13-
> pip install ase quippy-ase cellconstructor python-sscha aiida-quantumespresso aiida-pseudo
14-
> mamba activate aiida-sscha
16+
> mamba create -n sscha-aiida -c conda-forge python gfortran "blas=*=openblas" openblas lapack julia pip numpy scipy spglib pkg-config aiida-core
17+
> pip install ase cellconstructor python-sscha aiida-quantumespresso aiida-pseudo
18+
> mamba activate sscha-aiida
1519
```
20+
Then, you should configure an AiiDA profile and the pw.x code in order to use the example script (see also Prerequisites section).
1621

17-
Then, you should configure an AiiDA profile in order to use the example script (see also Prerequisites section).
22+
For on-the-fly active learning you also need the FLARE package:
23+
24+
```console
25+
> git clone --depth 1 https://github.com/mir-group/flare.git
26+
> cd flare
27+
> pip install .
28+
```
1829

1930
## Prerequisites
2031

@@ -23,6 +34,7 @@ You need to have installed in the same environment:
2334
- `cellconstructor`
2435
- `aiida-core`
2536
- `aiida-quantumespresso`
37+
- (optional, for active learning) `mir-flare`
2638

2739
For the AiiDA part, it is essential the dameon is running and you have:
2840
1. Configured a computer where to run the code (e.g. on your own laptop; see `aiida-core` docs for further details)
@@ -33,6 +45,8 @@ Please refer to the aiida-core and aiida-quantumespresso for further installatio
3345

3446
## How-to run
3547

48+
### SSCHA with the aiida-quantumespresso interface
49+
3650
Open the `run_aiida_sscha.py` and change the data according to your needs and local installation. Then simply
3751

3852
```console
@@ -45,4 +59,20 @@ Usually an actual production run would take a while. We suggest to use instead
4559
> nohup python run_aiida_sscha.py > run_aiida_sscha.log &
4660
```
4761

62+
or a submit script at glance.
63+
64+
### On-the-fly active learning SSCHA with aiida-quantumespresso and FLARE interface
65+
66+
Open the `run_aiida_flare_sscha.py` and change the data according to your needs and local installation. Then simply
67+
68+
```console
69+
> python run_aiida_flare_sscha.py > run_aiida_sscha.log
70+
```
71+
72+
Usually an actual production run would take a while. We suggest to use instead
73+
74+
```console
75+
> nohup python run_aiida_sscha.py > run_aiida_sscha.log &
76+
```
77+
4878
or a submit script at glance.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Dynamical matrix file
2+
File generated with the CellConstructor by Lorenzo Monacelli
3+
1 2 0 1.8897259890000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
4+
Basis vectors
5+
2.7154799999999999 2.7154799999999999 0.0000000000000000
6+
2.7154799999999999 0.0000000000000000 2.7154799999999999
7+
0.0000000000000000 2.7154799999999999 2.7154799999999999
8+
1 'Si ' 25597.9124185021937592
9+
1 1 -0.0000000000000004 0.0000000000000004 0.0000000000000004
10+
2 1 1.3577400000000002 1.3577400000000006 1.3577400000000004
11+
12+
Dynamical Matrix in cartesian axes
13+
14+
q = ( 0.000000000000 0.000000000000 0.000000000000 )
15+
16+
1 1
17+
0.2590944141379855 0.0000000000000000 0.0000000000000001 0.0000000000000000 -0.0000000000000000 0.0000000000000000
18+
0.0000000000000001 0.0000000000000000 0.2590944141379854 0.0000000000000000 -0.0000000000000002 0.0000000000000000
19+
-0.0000000000000000 0.0000000000000000 -0.0000000000000002 0.0000000000000000 0.2590944141379854 0.0000000000000000
20+
1 2
21+
-0.2590944141379856 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
22+
-0.0000000000000001 0.0000000000000000 -0.2590944141379856 0.0000000000000000 0.0000000000000002 0.0000000000000000
23+
0.0000000000000001 0.0000000000000000 0.0000000000000002 0.0000000000000000 -0.2590944141379856 0.0000000000000000
24+
2 1
25+
-0.2590944141379856 0.0000000000000000 -0.0000000000000001 0.0000000000000000 0.0000000000000001 0.0000000000000000
26+
-0.0000000000000000 0.0000000000000000 -0.2590944141379856 0.0000000000000000 0.0000000000000002 0.0000000000000000
27+
0.0000000000000001 0.0000000000000000 0.0000000000000002 0.0000000000000000 -0.2590944141379855 0.0000000000000000
28+
2 2
29+
0.2590944141379858 0.0000000000000000 0.0000000000000001 0.0000000000000000 -0.0000000000000001 0.0000000000000000
30+
0.0000000000000001 0.0000000000000000 0.2590944141379858 0.0000000000000000 -0.0000000000000001 0.0000000000000000
31+
-0.0000000000000001 0.0000000000000000 -0.0000000000000001 0.0000000000000000 0.2590944141379858 0.0000000000000000
32+
33+
Diagonalizing the dynamical matrix
34+
35+
q = ( 0.000000000000 0.000000000000 0.000000000000 )
36+
37+
***************************************************************************
38+
freq ( 1) = -0.00000009 [THz] = -0.00000305 [cm-1]
39+
( 0.699099 0.000000 -0.097697 0.000000 0.041428 0.000000 )
40+
( 0.699099 0.000000 -0.097697 0.000000 0.041428 0.000000 )
41+
freq ( 2) = 0.00000020 [THz] = 0.00000677 [cm-1]
42+
( 0.002505 0.000000 0.291167 0.000000 0.644372 0.000000 )
43+
( 0.002505 0.000000 0.291167 0.000000 0.644372 0.000000 )
44+
freq ( 3) = 0.00000026 [THz] = 0.00000855 [cm-1]
45+
( -0.106088 0.000000 -0.636928 0.000000 0.288216 0.000000 )
46+
( -0.106088 0.000000 -0.636928 0.000000 0.288216 0.000000 )
47+
freq ( 4) = 14.80188490 [THz] = 493.73766382 [cm-1]
48+
( -0.042416 0.000000 -0.451763 0.000000 -0.542320 0.000000 )
49+
( 0.042416 0.000000 0.451763 0.000000 0.542320 0.000000 )
50+
freq ( 5) = 14.80188490 [THz] = 493.73766382 [cm-1]
51+
( -0.515182 0.000000 0.391193 0.000000 -0.285579 0.000000 )
52+
( 0.515182 0.000000 -0.391193 0.000000 0.285579 0.000000 )
53+
freq ( 6) = 14.80188490 [THz] = 493.73766382 [cm-1]
54+
( -0.482481 0.000000 -0.377992 0.000000 0.352610 0.000000 )
55+
( 0.482481 0.000000 0.377992 0.000000 -0.352610 0.000000 )
56+
***************************************************************************
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Dynamical matrix file
2+
File generated with the CellConstructor by Lorenzo Monacelli
3+
1 2 0 1.8897259890000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
4+
Basis vectors
5+
2.7154799999999999 2.7154799999999999 0.0000000000000000
6+
2.7154799999999999 0.0000000000000000 2.7154799999999999
7+
0.0000000000000000 2.7154799999999999 2.7154799999999999
8+
1 'Si ' 25597.9124185021937592
9+
1 1 -0.0000000000000004 0.0000000000000004 0.0000000000000004
10+
2 1 1.3577400000000002 1.3577400000000006 1.3577400000000004
11+
12+
Dynamical Matrix in cartesian axes
13+
14+
q = ( -0.184129509332 0.000000000000 0.000000000000 )
15+
16+
1 1
17+
0.3548752551952572 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
18+
0.0000000000000000 -0.0000000000000000 0.2477607075541515 0.0000000000000000 0.0000000000000001 -0.0000000000000000
19+
-0.0000000000000000 0.0000000000000000 0.0000000000000001 0.0000000000000000 0.2477607075541518 0.0000000000000000
20+
1 2
21+
0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0000000000000000
22+
0.0000000000000000 0.0000000000000000 0.0000000000000001 0.0000000000000000 -0.2008555582082014 -0.0000000087796757
23+
-0.0000000000000000 -0.0000000000000000 -0.2008555582082012 -0.0000000087796757 -0.0000000000000002 -0.0000000000000000
24+
2 1
25+
0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000
26+
-0.0000000000000000 -0.0000000000000000 0.0000000000000001 0.0000000000000000 -0.2008555582082013 0.0000000087796757
27+
0.0000000000000000 0.0000000000000000 -0.2008555582082014 0.0000000087796757 -0.0000000000000002 0.0000000000000000
28+
2 2
29+
0.3548752551952572 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
30+
0.0000000000000000 -0.0000000000000000 0.2477607075541515 0.0000000000000000 -0.0000000000000001 -0.0000000000000000
31+
-0.0000000000000000 0.0000000000000000 -0.0000000000000001 0.0000000000000000 0.2477607075541518 0.0000000000000000
32+
33+
Dynamical Matrix in cartesian axes
34+
35+
q = ( 0.000000000000 0.000000000000 -0.184129509332 )
36+
37+
1 1
38+
0.2477607075541515 0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000
39+
0.0000000000000000 0.0000000000000000 0.2477607075541516 -0.0000000000000000 0.0000000000000001 -0.0000000000000000
40+
-0.0000000000000000 -0.0000000000000000 0.0000000000000001 0.0000000000000000 0.3548752551952568 0.0000000000000000
41+
1 2
42+
-0.0000000000000000 -0.0000000000000000 -0.2008555582082013 -0.0000000087796755 0.0000000000000000 0.0000000000000000
43+
-0.2008555582082013 -0.0000000087796755 -0.0000000000000002 -0.0000000000000000 0.0000000000000000 -0.0000000000000000
44+
-0.0000000000000001 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000001 0.0000000000000000
45+
2 1
46+
-0.0000000000000000 0.0000000000000000 -0.2008555582082013 0.0000000087796755 -0.0000000000000001 0.0000000000000000
47+
-0.2008555582082013 0.0000000087796755 -0.0000000000000002 0.0000000000000000 0.0000000000000000 -0.0000000000000000
48+
0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000001 -0.0000000000000000
49+
2 2
50+
0.2477607075541515 -0.0000000000000000 0.0000000000000001 -0.0000000000000000 -0.0000000000000000 0.0000000000000000
51+
0.0000000000000001 -0.0000000000000000 0.2477607075541518 0.0000000000000000 0.0000000000000000 -0.0000000000000000
52+
-0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.3548752551952572 0.0000000000000000
53+
54+
Dynamical Matrix in cartesian axes
55+
56+
q = ( 0.000000000000 -0.184129509332 0.000000000000 )
57+
58+
1 1
59+
0.2477607075541516 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000
60+
0.0000000000000000 0.0000000000000000 0.3548752551952573 -0.0000000000000000 0.0000000000000001 0.0000000000000000
61+
0.0000000000000000 0.0000000000000000 0.0000000000000001 -0.0000000000000000 0.2477607075541516 -0.0000000000000000
62+
1 2
63+
0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.2008555582082014 -0.0000000087796755
64+
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000
65+
-0.2008555582082015 -0.0000000087796755 0.0000000000000001 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000
66+
2 1
67+
0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.2008555582082015 0.0000000087796755
68+
0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000001 0.0000000000000000
69+
-0.2008555582082014 0.0000000087796755 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000
70+
2 2
71+
0.2477607075541516 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000
72+
-0.0000000000000000 -0.0000000000000000 0.3548752551952571 -0.0000000000000000 0.0000000000000000 -0.0000000000000000
73+
-0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.2477607075541518 0.0000000000000000
74+
75+
Diagonalizing the dynamical matrix
76+
77+
q = ( -0.184129509332 0.000000000000 0.000000000000 )
78+
79+
***************************************************************************
80+
freq ( 1) = 4.45331342 [THz] = 148.54652494 [cm-1]
81+
( -0.000000 0.000000 0.703431 0.000000 0.072005 0.000000 )
82+
( 0.000000 -0.000000 0.072005 -0.000000 0.703431 -0.000000 )
83+
freq ( 2) = 4.45331342 [THz] = 148.54652494 [cm-1]
84+
( 0.000000 -0.000000 -0.072005 -0.000000 0.703431 0.000000 )
85+
( -0.000000 0.000000 0.703431 -0.000000 -0.072005 0.000000 )
86+
freq ( 3) = 12.24928837 [THz] = 408.59222083 [cm-1]
87+
( -0.145074 0.000000 0.000000 -0.000000 -0.000000 0.000000 )
88+
( -0.989421 0.000000 0.000000 -0.000000 -0.000000 0.000000 )
89+
freq ( 4) = 12.24928837 [THz] = 408.59222083 [cm-1]
90+
( 0.989421 0.000000 -0.000000 -0.000000 -0.000000 0.000000 )
91+
( -0.145074 0.000000 -0.000000 -0.000000 0.000000 0.000000 )
92+
freq ( 5) = 13.77242792 [THz] = 459.39867995 [cm-1]
93+
( 0.000000 -0.000000 0.411585 -0.000000 -0.574977 0.000000 )
94+
( 0.000000 -0.000000 0.574977 -0.000000 -0.411585 0.000000 )
95+
freq ( 6) = 13.77242792 [THz] = 459.39867995 [cm-1]
96+
( 0.000000 -0.000000 0.574977 -0.000000 0.411585 -0.000000 )
97+
( 0.000000 0.000000 -0.411585 0.000000 -0.574977 0.000000 )
98+
***************************************************************************

0 commit comments

Comments
 (0)