Debian Codegraph @

src/pymbd/__main__.py

raw
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 import sys
5
6 from pymbd import ang
7 from pymbd.fortran import MBDGeom, with_mpi
8
9 if with_mpi:
10 from mpi4py import MPI
11
12 rank = MPI.COMM_WORLD.Get_rank()
13 else:
14 rank = 0
15
16 ene_expected = -0.0002462647623815428
17 ene = MBDGeom([(0, 0, 0), (0, 0, 4 * ang)]).mbd_energy_species(
18 ['Ar', 'Ar'], [1, 1], 0.83
19 )
20 if rank == 0:
21 print(f'Expected energy: {ene_expected}')
22 print(f'Calculated energy: {ene}')
23 if ene - ene_expected > 1e-10:
24 sys.exit(1)