try pytraj
online:
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
import pytraj as pt
traj = pt.iterload('tz2.nc', 'tz2.parm7')
print(traj)
pt.pmap(pt.rmsd, traj, mask='@CA', ref=traj[0], n_cores=4)
%%file my_script.py
## create a file name my_scrip.py (you can use any name you like)
import pytraj as pt
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.rank
# load files
traj = pt.iterload('tz2.nc', 'tz2.parm7')
# call pmap_mpi for MPI
# we dont need to specify n_cores=6 here since we will use `mpirun -n 6`
data = pt.pmap_mpi(pt.rmsd, traj, mask='@CA', ref=traj[0])
# data is sent to rank==0
if rank == 0:
print(data)
# run
# run in shell
! mpirun -n 4 python my_script.py
(tutorial_parallel.ipynb; tutorial_parallel_evaluated.ipynb; tutorial_parallel.py)