Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement k-points sampling #4

Open
leifjacobson opened this issue Oct 6, 2021 · 6 comments
Open

Implement k-points sampling #4

leifjacobson opened this issue Oct 6, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@leifjacobson
Copy link

leifjacobson commented Oct 6, 2021

This could easily be a feature but I'm filing as an issue in case it's not. As a test I computed the cohesive energy of ammonia crystal (from the X23 test set) using the given unit cell as well as 2x2x2, 3x3x3, etc supercells. The energy I compute is 3.25, 9.25 and 10.10 kcal/mol/molecule for the unitcell, 2x2x2, and 3x3x3 respectively. For larger supercells I get a segfault.

Can you advise? Is this due to lack of k-point sampling (gamma point approx)? Is this expected? Is there a hard limit on the system size?

Molecule geometry:
$coord angs
1.8596000000 1.3558000000 0.5232000000 H
1.3558000000 0.5232000000 1.8596000000 H
0.5232000000 1.8596000000 1.3558000000 H
1.0342000000 1.0342000000 1.0342000000 N
$end                                                
Unit cell geometry:
$coord angs
1.8596000000 1.3558000000 0.5232000000 H
1.3558000000 0.5232000000 1.8596000000 H
0.5232000000 1.8596000000 1.3558000000 H
4.3407000000 1.1253000000 4.4390000000 H
3.8368000000 1.9579000000 3.1025000000 H
3.0043000000 0.6214000000 3.6064000000 H
3.6064000000 3.0043000000 0.6214000000 H
4.4390000000 4.3407000000 1.1253000000 H
1.9579000000 3.1025000000 3.8368000000 H
0.6214000000 3.6064000000 3.0043000000 H
1.1253000000 4.4390000000 4.3407000000 H
3.1025000000 3.8368000000 1.9579000000 H
1.0342000000 1.0342000000 1.0342000000 N
3.5152000000 1.4469000000 3.9280000000 N
3.9280000000 3.5152000000 1.4469000000 N
1.4469000000 3.9280000000 3.5152000000 N
$periodic 3
$lattice angs
4.9621637000 0.0000000000 0.0000000000
0.0000000000 4.9621637000 0.0000000000
0.0000000000 0.0000000000 4.9621637000
$end                                                    
2x2x2 cell
$coord angs                                                                                                                                                                                                                                   
0.5539040000 2.7226850000 -3.7759750000 H                                                                                                                                                                                                     
0.0501040000 1.8900850000 -2.4395750000 H                                                                                                                                                                                                     
-0.7824960000 3.2264850000 -2.9433750000 H                                                                                                                                                                                                    
3.0350040000 2.4921850000 0.1398250000 H                                                                                                                                                                                                      
2.5311040000 3.3247850000 -1.1966750000 H                                                                                                                                                                                                     
1.6986040000 1.9882850000 -0.6927750000 H                                                                                                                                                                                                     
2.3007040000 4.3711850000 -3.6777750000 H                                                                                                                                                                                                     
3.1333040000 5.7075850000 -3.1738750000 H                                                                                                                                                                                                     
0.6522040000 4.4693850000 -0.4623750000 H                                                                                                                                                                                                     
-0.6842960000 4.9732850000 -1.2948750000 H                                                                                                                                                                                                    
-0.1803960000 5.8058850000 0.0415250000 H                                                                                                                                                                                                     
1.7968040000 5.2036850000 -2.3412750000 H                                                                                                                                                                                                     
-0.2714960000 2.4010850000 -3.2649750000 N                                                                                                                                                                                                    
2.2095040000 2.8137850000 -0.3711750000 N                                                                                                                                                                                                     
2.6223040000 4.8820850000 -2.8522750000 N                                                                                                                                                                                                     
0.1412040000 5.2948850000 -0.7839750000 N                                                                                                                                                                                                     
0.5539040000 2.7226850000 1.1861890000 H                                                                                                                                                                                                      
0.0501040000 1.8900850000 2.5225890000 H                                                                                                                                                                                                      
-0.7824960000 3.2264850000 2.0187890000 H                                                                                                                                                                                                     
3.0350040000 2.4921850000 5.1019890000 H                                                                                                                                                                                                      
2.5311040000 3.3247850000 3.7654890000 H                                                                                                                                                                                                      
1.6986040000 1.9882850000 4.2693890000 H                                                                                                                                                                                                      
2.3007040000 4.3711850000 1.2843890000 H                                                                                                                                                                                                      
3.1333040000 5.7075850000 1.7882890000 H                                                                                                                                                                                                      
0.6522040000 4.4693850000 4.4997890000 H                                                                                                                                                                                                      
-0.6842960000 4.9732850000 3.6672890000 H                                                                                                                                                                                                     
-0.1803960000 5.8058850000 5.0036890000 H                                                                                                                                                                                                     
1.7968040000 5.2036850000 2.6208890000 H                                                                                                                                                                                                      
-0.2714960000 2.4010850000 1.6971890000 N                                                                                                                                                                                                     
2.2095040000 2.8137850000 4.5909890000 N                                                                                                                                                                                                      
2.6223040000 4.8820850000 2.1098890000 N                                                                                                                                                                                                      
0.1412040000 5.2948850000 4.1781890000 N                                                                                                                                                                                                      
0.5539040000 7.6848490000 -3.7759750000 H                                                                                                                                                                                                     
0.0501040000 6.8522490000 -2.4395750000 H                                                                                                                                                                                                     
-0.7824960000 8.1886490000 -2.9433750000 H                                                                                                                                                                                                    
3.0350040000 7.4543490000 0.1398250000 H                                                                                                                                                                                                      
2.5311040000 8.2869490000 -1.1966750000 H                                                                                                                                                                                                     
1.6986040000 6.9504490000 -0.6927750000 H                                                                                                                                                                                                     
2.3007040000 9.3333490000 -3.6777750000 H                                                                                                                                                                                                     
3.1333040000 10.6697490000 -3.1738750000 H                                                                                                                                                                                                    
0.6522040000 9.4315490000 -0.4623750000 H                                                                                                                                                                                                     
-0.6842960000 9.9354490000 -1.2948750000 H                                                                                                                                                                                                    
-0.1803960000 10.7680490000 0.0415250000 H                                                                                                                                                                                                    
1.7968040000 10.1658490000 -2.3412750000 H                                                                                                                                                                                                    
-0.2714960000 7.3632490000 -3.2649750000 N                                                                                                                                                                                                    
2.2095040000 7.7759490000 -0.3711750000 N                                                                                                                                                                                                     
2.6223040000 9.8442490000 -2.8522750000 N                                                                                                                                                                                                     
0.1412040000 10.2570490000 -0.7839750000 N                                                                                                                                                                                                    
0.5539040000 7.6848490000 1.1861890000 H                                                                                                                                                                                                      
0.0501040000 6.8522490000 2.5225890000 H                                                                                                                                                                                                      
-0.7824960000 8.1886490000 2.0187890000 H                                                                                                                                                                                                     
3.0350040000 7.4543490000 5.1019890000 H                                                                                                                                                                                                      
2.5311040000 8.2869490000 3.7654890000 H
1.6986040000 6.9504490000 4.2693890000 H
2.3007040000 9.3333490000 1.2843890000 H
3.1333040000 10.6697490000 1.7882890000 H
0.6522040000 9.4315490000 4.4997890000 H
-0.6842960000 9.9354490000 3.6672890000 H
-0.1803960000 10.7680490000 5.0036890000 H
1.7968040000 10.1658490000 2.6208890000 H
-0.2714960000 7.3632490000 1.6971890000 N
2.2095040000 7.7759490000 4.5909890000 N
2.6223040000 9.8442490000 2.1098890000 N
0.1412040000 10.2570490000 4.1781890000 N
5.5160680000 2.7226850000 -3.7759750000 H
5.0122680000 1.8900850000 -2.4395750000 H
4.1796680000 3.2264850000 -2.9433750000 H
7.9971680000 2.4921850000 0.1398250000 H
7.4932680000 3.3247850000 -1.1966750000 H
6.6607680000 1.9882850000 -0.6927750000 H
7.2628680000 4.3711850000 -3.6777750000 H
8.0954680000 5.7075850000 -3.1738750000 H
5.6143680000 4.4693850000 -0.4623750000 H
4.2778680000 4.9732850000 -1.2948750000 H
4.7817680000 5.8058850000 0.0415250000 H
6.7589680000 5.2036850000 -2.3412750000 H
4.6906680000 2.4010850000 -3.2649750000 N
7.1716680000 2.8137850000 -0.3711750000 N
7.5844680000 4.8820850000 -2.8522750000 N
5.1033680000 5.2948850000 -0.7839750000 N
5.5160680000 2.7226850000 1.1861890000 H
5.0122680000 1.8900850000 2.5225890000 H
4.1796680000 3.2264850000 2.0187890000 H
7.9971680000 2.4921850000 5.1019890000 H
7.4932680000 3.3247850000 3.7654890000 H
6.6607680000 1.9882850000 4.2693890000 H
7.2628680000 4.3711850000 1.2843890000 H
8.0954680000 5.7075850000 1.7882890000 H
5.6143680000 4.4693850000 4.4997890000 H
4.2778680000 4.9732850000 3.6672890000 H
4.7817680000 5.8058850000 5.0036890000 H
6.7589680000 5.2036850000 2.6208890000 H
4.6906680000 2.4010850000 1.6971890000 N
7.1716680000 2.8137850000 4.5909890000 N
7.5844680000 4.8820850000 2.1098890000 N
5.1033680000 5.2948850000 4.1781890000 N
5.5160680000 7.6848490000 -3.7759750000 H
5.0122680000 6.8522490000 -2.4395750000 H
4.1796680000 8.1886490000 -2.9433750000 H
7.9971680000 7.4543490000 0.1398250000 H
7.4932680000 8.2869490000 -1.1966750000 H
6.6607680000 6.9504490000 -0.6927750000 H
7.2628680000 9.3333490000 -3.6777750000 H
8.0954680000 10.6697490000 -3.1738750000 H
5.6143680000 9.4315490000 -0.4623750000 H
4.2778680000 9.9354490000 -1.2948750000 H
4.7817680000 10.7680490000 0.0415250000 H
6.7589680000 10.1658490000 -2.3412750000 H
4.6906680000 7.3632490000 -3.2649750000 N
7.1716680000 7.7759490000 -0.3711750000 N
7.5844680000 9.8442490000 -2.8522750000 N
5.1033680000 10.2570490000 -0.7839750000 N
5.5160680000 7.6848490000 1.1861890000 H
5.0122680000 6.8522490000 2.5225890000 H
4.1796680000 8.1886490000 2.0187890000 H
7.9971680000 7.4543490000 5.1019890000 H
7.4932680000 8.2869490000 3.7654890000 H
6.6607680000 6.9504490000 4.2693890000 H
7.2628680000 9.3333490000 1.2843890000 H
8.0954680000 10.6697490000 1.7882890000 H
5.6143680000 9.4315490000 4.4997890000 H
4.2778680000 9.9354490000 3.6672890000 H
4.7817680000 10.7680490000 5.0036890000 H
6.7589680000 10.1658490000 2.6208890000 H
4.6906680000 7.3632490000 1.6971890000 N
7.1716680000 7.7759490000 4.5909890000 N
7.5844680000 9.8442490000 2.1098890000 N
5.1033680000 10.2570490000 4.1781890000 N
$periodic 3
$lattice angs
9.9243278503 0.0000000000 0.0000000000
0.0000000000 9.9243278503 0.0000000000
0.0000000000 0.0000000000 9.9243278503
@awvwgk
Copy link
Member

awvwgk commented Oct 6, 2021

You can use xTB in DFTB+ with k-point sampling instead of building supercells.

Also, there is no limit in systemsize, but since we are using a shared memory parallelization you have to provide enough memory for all the threads using the OMP_STACKSIZE environment variable, otherwise it the OMP stack might overflow and the program crash.

@leifjacobson
Copy link
Author

Thanks for the comment. Sounds like it's a feature. I'll try building DFTB+.

@awvwgk awvwgk added the enhancement New feature or request label Oct 6, 2021
@awvwgk
Copy link
Member

awvwgk commented Oct 6, 2021

Implementing k-point sampling here in tblite would be a really cool feature, but with the integration in DFTB+ we already have such an implementation with both k-points and spin channels available. Therefore, this is currently less of a priority for me.

If more projects start using tblite's high-level API to evaluate xTB singlepoints for periodic systems this might be worth revisiting.

@awvwgk awvwgk changed the title Convergence with system size in ammonia crystal Implement k-points sampling Oct 6, 2021
@leifjacobson
Copy link
Author

Hi @awvwgk as a follow up I got dftb+ to compile and for the same system described above it looks like convergence is pretty rapid with a pretty small MP kpoint mesh. However, the converged results do not agree with the largest supercell energy reported above. The gamma point and molecular energies do agree to high precision. Do you have some example crystals with GFN2-xTB energies that you believe are converged? It would be useful for me to make sure I'm getting the right answers.

@vladislavivanistsev
Copy link

Implementing k-point sampling here in tblite would be a really cool feature, but with the integration in DFTB+ we already have such an implementation with both k-points and spin channels available. Therefore, this is currently less of a priority for me.

If more projects start using tblite's high-level API to evaluate xTB singlepoints for periodic systems this might be worth revisiting.

I have been testing tblite, DFTB+, and CP2k for a while. tblibe as a stand-alone calculator is the most attractive. Yet, it does luck some features, like k-point sampling.
How difficult is to implement k-points?
How about linking the corresponding module to https://pypi.org/project/kpLib/?

@awvwgk
Copy link
Member

awvwgk commented Dec 1, 2022

For me it was easiest to get a good k-point implementation by integrating tblite in DFTB+ and leverage the available k-point aware SCF. For an implementation in tblite we can rely on an external library, but it has to be available in the SCF (so in Fortran) to be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants