AMSET for two-dimensional materials

Dear Alex,
I hope you are doing well.
Can we use the amset code for two-dimensional materials?
How to extract the scattering rate from the output of the amset code?
Is it possible parallelism in amset code?

1 Like

Hi Aamir,

amset hasn’t been designed specially for 2D materials but it should be possible to run them just like a 3D system, provided you include enough vacuum in your structure. I’ve not tried this before though, so please let me know if you run into any issues.

For parallelism: Only the interpolation routines are currently parallelised. Hopefully in the future I will parallelise the scattering and transport routines too.

The scattering rate is written to the mesh.h5 file if write_mesh is set to True (see the docs).

The mesh.h5 file is in HDF5 format but there is a helper function that converts the file to a python dictionary format:

from amset.io import load_mesh

data = load_mesh("mesh.h5")

print(data.keys())
#  ['doping', 'efermi', 'energies', 'fd_cutoffs', 'fermi_levels', 
#  'ir_kpoints', 'ir_to_full_kpoint_mapping', 'is_metal', 
#  'kpoints', 'num_electrons', 'scattering_labels',
#  'scattering_rates', 'soc', 'structure', 'temperatures',
#  'vb_idx', 'velocities']

The scattering rates are stored as a dictionary, with a key for the spin up and spin down bands. If the system is not spin polarised then there will only be spin up bands. In each spin channel, the scattering rates are stored as numpy arrays, with the data shape (n_scattering_mechanisms, n_doping, n_temperatures, n_bands, n_ir_kpoints).

from pymatgen import Spin

rates = data["scattering_rates"]

print(rates[Spin.up].shape)
# (2, 6, 1, 10, 12341)

You can see which scattering mechanisms correspond to which dimension using:

print(data["scattering_labels"])
# ['IMP', 'ADP']

To get the overall scattering rate, you need to sum the rates from all mechanisms:

import numpy as np

overall_rates = np.sum(rates[Spin.up], axis=0)

# print the overall rate for the second doping, first temperature, third band, and tenth k-point
doping_idx = 1
temperature_idx = 0
band_idx = 2
kpoint_idx = 9

print("doping: {:.0g} cm^-3".format(data["doping"][doping_idx]))
print("temperature: {:d} K".format(data["temperatures"][temperature_idx]))
print("kpoint:", data["ir_kpoints"][kpoint_idx])
print("rate: {:.3g} s^-1".format(overall_rates[doping_idx, temperature_idx, band_idx, kpoint_idx]))

# doping: -2e+15 cm^-3
# temperature: 300 K
# kpoint: [0.11111111 0.         0.        ]
# rate: 5.52e+12 s^-1

Hope that helps.

Best,
Alex

Hi @Aamir_Shafique,

Just an update on parallelisation. I’ve now added support for multiprocessing when calculating scattering rates. The number of processors used is controlled through the nworkers setting. To obtain the best performance you should run export OMP_NUM_THREADS=1 before running amset and set nworkers to the number of cores on the compute node/your computer.

I’ve only added multiprocessing for the scattering rates. If you find calculating transport properties is taking a long time, let me know and I can look at adding it there also.

Be aware that this only supports parallelism over a single node.

Dear Alex,
Thank you for your reply.