How to define complex defect

Hi all,

I am trying to define a defect that is composed of an interstitial and a vacancy (a color center).

How can I achieve this in pymatgen? Do I have to define multiple defects and then combine them somehow?

Thank you for your help!

Hi AxLamelas, sorry for the late reply.

Currently, pymatgen supports the creation of point defects, but not point defect clusters, unfortunately.

The best you can do is, as you say, to create two defects and then combine them. What pymatgen can do is help you identify the unique sites. Perhaps you can you use the InterstitialGenerator located in pymatgen.analysis.defects.generators in order to find the different possible sites, then you can simply remove an atom to make the vacancy?

Part of the reason why we do not, yet, have a generator for these clusters is the number of permutations can quickly become massive. An interstitial site, for example, can be identified for a primitive cell and has N sites. A di-interstitial, however, does not have 2N possibilities, rather it the number of possibilities depends on how large of a supercell you want, because the separation of the two interstitials would be a new variable. Hopefully we will have a generator to take all of this into account some time in the future, but it isn’t in our immediate plans.

Good luck on your work and let me know if you have further questions.

1 Like

Thank you very much for the answer.
I created a custom class for dealing with the structure generations as this was my immediate problem. I’m defining particular defects by hand so the generators are not of immediate concern.
I’ll implement additional functionality when the need arises based on pymatgen’s implementation.
I’ll also have a look at your suggestion.

Sorry for the delay in my response.

Hi Nicholas,

I wonder if this is a correct syntax to generate the interstitial defect
from pymatgen.analysis.defects.generators import DefectGenerator, InterstitialGenerator
struct_w_interstital = InterstitialGenerator(initial_struct,'O')
I ran the script but got the error “min() arg is a empty sequence”

Do you have any suggestion?
Thank you!

The way you have written it isn’t correct because the InterstitialGenerator class creates a python generator, which can be used to iterate over interstitial sites. This is because there isn’t one unique interstitial site, and there are often many, so you must iterate over possibilities.

If you would like to see all the sites, you can convert the interstitial generator into a list of interstitial objects.

from pymatgen.analysis.defects.generators import DefectGenerator, InterstitialGenerator
defects = [defect for defect in InterstitialGenerator(initial_struct,'O')]

Note that these are not “structures with interstitials”. Defect objects hold information on how to create the structure with an interstitial, but also info like the bulk structure, the multiplicity of that site, etc. Therefore, in order to get the structure with the interstitial in it, you should use a command like this:

defective_structure = defect.generate_defect_structure(supercell_scaling_matrix)

Where supercell_scaling_matrix is used to convert from the bulk structure used as input, which is generally a primitive structure, into a supercell that can accommodate the defect with minimal finite size effects during a DFT calculation. If your input structure is already a supercell, this can be omitted.

Hope this helps.

1 Like

I get this error when I run the code complaining of module not found error.

"ModuleNotFoundError: No module named ‘pymatgen.analysis.defects’

Meanwhile I’ve installed pymatgen using pip