Giter Club home page Giter Club logo

Comments (3)

rkingsbury avatar rkingsbury commented on June 14, 2024 1

Thanks for raising @DanielYang59, this can be improved and I will reply about proposed changes in #3534 . However, I want to make a note here for posterity. Typically a user should call process_entries rather than get_adjustments to apply corrections, e.g.:

from pymatgen.io.vasp import Vasprun
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
vasprun1 = Vasprun("data/mp_1595_vasprun.xml")
entry1 = vasprun1.get_computed_entry(inc_structure=True)
compatibility = MaterialsProjectCompatibility()
compatibility.process_entries(entry1)

This allows the compatibility class to decide what to do with the entry in the event of a CompatibilityError (which can be set via a kwarg to process_entries

def process_entries(
    self,
    entries: AnyComputedEntry | list[AnyComputedEntry],
    clean: bool = True,
    verbose: bool = False,
    inplace: bool = True,
    on_error: Literal["ignore", "warn", "raise"] = "ignore",
) -> list[AnyComputedEntry]:
    """Process a sequence of entries with the chosen Compatibility scheme.

    Warning: This method changes entries in place! All changes can be undone and original entries
    restored by setting entry.energy_adjustments = [].

    Args:
        entries (AnyComputedEntry | list[AnyComputedEntry]): A sequence of
            Computed(Structure)Entry objects.
        clean (bool): Whether to remove any previously-applied energy adjustments.
            If True, all EnergyAdjustment are removed prior to processing the Entry.
            Defaults to True.
        verbose (bool): Whether to display progress bar for processing multiple entries.
            Defaults to False.
        inplace (bool): Whether to adjust input entries in place. Defaults to True.
        on_error ('ignore' | 'warn' | 'raise'): What to do when get_adjustments(entry)
            raises CompatibilityError. Defaults to 'ignore'.

    Returns:
        list[AnyComputedEntry]: Adjusted entries. Entries in the original list incompatible with
            chosen correction scheme are excluded from the returned list.
    """

from pymatgen.

DanielYang59 avatar DanielYang59 commented on June 14, 2024

It appears to me that the get_correction method under pymatgen.entries.compatibility explicitly requires the run_type to be in {"GGA", "GGA+U"}, which in this case the run_type is PBE. However:

def run_type(self):
"""
Returns the run type. Currently detects GGA, metaGGA, HF, HSE, B3LYP,
and hybrid functionals based on relevant INCAR tags. LDA is assigned if
PAW POTCARs are used and no other functional is detected.
Hubbard U terms and vdW corrections are detected automatically as well.
"""
GGA_TYPES = {
"RE": "revPBE",
"PE": "PBE",
"PS": "PBEsol",
"RP": "revPBE+Padé",
"AM": "AM05",
"OR": "optPBE",
"BO": "optB88",
"MK": "optB86b",
"--": "GGA",
}

I'm not quite familiar with the definations in Pymatgen but it seems PBE should be a subset of GGA? Is this a compatibility issue?

from pymatgen.

DanielYang59 avatar DanielYang59 commented on June 14, 2024

Also noticed the handling of non-GGA run_type is inconsistent. In the get_correction method of pymatgen.entries.compatibility module there is a duplicate check of run_type:

if entry.parameters.get("run_type") not in ("GGA", "GGA+U"):
raise CompatibilityError(
f"Entry {entry.entry_id} has invalid run type {entry.parameters.get('run_type')}. Discarding."
)
calc_u = entry.parameters.get("hubbards") or defaultdict(int)
comp = entry.composition
elements = sorted((el for el in comp.elements if comp[el] > 0), key=lambda el: el.X)
most_electroneg = elements[-1].symbol
correction = ufloat(0.0, 0.0)
# only correct GGA or GGA+U entries
if entry.parameters.get("run_type") not in ("GGA", "GGA+U"):
return ufloat(0.0, 0.0)

from pymatgen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.