materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.51k stars 862 forks source link

Out of date example using Interstitial in documentation #2082

Closed katerinavr closed 1 year ago

katerinavr commented 3 years ago

Describe the bug The example given in the documentation making use of pymatgen.analysis.defects.core.Interstitial seems to be outdated or incorrect. Following the example shown on the installation page yields to the following error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'radii'

To Reproduce

See the last code snippet at https://pymatgen.org/installation.html.

from pymatgen.analysis.defects.core import Interstitial
from pymatgen.core.structure import Structure

structure = Structure.from_file('/path/to/file')
radii, valences = {}, {}

for element in structure.composition.elements:
    radii[element.symbol] = element.atomic_radius
    valence = element.group  # Just a first guess..
    if element.group > 12:
        valence -= 10
    valences[element.symbol] = valence

interstitial = Interstitial(structure, radii=radii, valences=valences)

If you could please provide an up-to-date method of using this class that would be really helpful

Regards

shyuep commented 3 years ago

@mbkumar can you update pls?

mbkumar commented 3 years ago

@shyuep,

There are two parts. a) The installation for Zeo++, which could be still valid. b) The validation example which uses the Interstitial class is outdated. The defects subpackage was rewritten by Shyam and Danny. They were using a new algorithm introduced by Nils Zimmerman for interstitials.

So my suggestion would be to rewrite the interstitial generation example using the latest defects code and move it to a new subsection titled "Defects" if not already present. And leave the rest of the Zeo++ section intact after removing/relocating the example code.

@shyamd, could you please take a look at the non-working example and write a new canonical example for interstitial generation.

Bharat