Skip to content

Commit

Permalink
mpi is now unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Klymenko committed Dec 8, 2021
1 parent 9d9f7f4 commit d69d519
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions nanonet/tb/tbmpi_script.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
from mpi4py import MPI
try:
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
except ImportError:
rank = 0
size = 1
import nanonet.tb as tb
from .tb_script import create_parser, preprocess_data, postprocess_data


comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
from nanonet.tb.tb_script import create_parser, preprocess_data, postprocess_data


def main1(param_file, k_points_file, xyz, show, save, code_name):
Expand Down Expand Up @@ -50,7 +53,8 @@ def main1(param_file, k_points_file, xyz, show, save, code_name):
band_structure.append({'id': j, 'wave_vector': jj, 'eigenvalues': vals, 'eigenvectors': vects})
print('#{} '.format(j), " ".join(['{:.3f} '.format(element) for element in vals]))

band_structure = comm.reduce(band_structure, root=0)
if size > 1:
band_structure = comm.reduce(band_structure, root=0)

if rank == 0:
postprocess_data(wave_vector, band_structure, show, save, code_name)
Expand Down

0 comments on commit d69d519

Please sign in to comment.