How to use the atomate.utils.utils.get_database function in atomate

To help you get started, we’ve selected a few atomate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / atomate / atomate / vasp / builders / materials_descriptor.py View on Github external
def from_file(cls, db_file, m="materials", **kwargs):
        """
        Get a MaterialsDescriptorBuilder using only a db file.

        Args:
            db_file: (str) path to db file
            m: (str) name of "materials" collection
            **kwargs: other parameters to feed into the builder
        """
        db_write = get_database(db_file, admin=True)
        return cls(db_write[m], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / tasks_materials.py View on Github external
Get a TaskMaterialsBuilder using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            c (str): name of "counter" collection
            t (str): name of "tasks" collection
            **kwargs: other params to put into TasksMaterialsBuilder
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            logger.warning("Warning: could not get read-only database; using write creds")
            db_read = get_database(db_file, admin=True)
        return cls(db_write[m], db_write[c], db_read[t], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / tags.py View on Github external
def from_file(cls, db_file, m="materials", t="tasks", **kwargs):
        """
        Get a TagsCollector using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            **kwargs: other parameters to feed into the builder, e.g. update_all
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database; using write creds")
            db_read = get_database(db_file, admin=True)
        return cls(db_write[m], db_read[t], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / tags.py View on Github external
def from_file(cls, db_file, m="materials", t="tasks", **kwargs):
        """
        Get a TagsCollector using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            **kwargs: other parameters to feed into the builder, e.g. update_all
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database; using write creds")
            db_read = get_database(db_file, admin=True)
        return cls(db_write[m], db_read[t], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / boltztrap_materials.py View on Github external
def from_file(cls, db_file, m="materials", b="boltztrap", **kwargs):
        """
        Get a BoltztrapMaterialsBuilder using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            b (str): name of "boltztrap" collection
            **kwargs: other params to put into BoltztrapMaterialsBuilder
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database")
            db_read = get_database(db_file, admin=True)

        return cls(db_write[m], db_read[b], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / bandgap_estimation.py View on Github external
def from_file(db_file, m="materials", **kwargs):
        """
        Get builder using only a db file.

        Args:
            db_file: (str) path to db file
            m: (str) name of "materials" collection
            **kwargs: other parameters to feed into the builder, e.g. mapi_key

        Returns:
            BandgapEstimationBuilder
        """
        db_write = get_database(db_file, admin=True)
        return BandgapEstimationBuilder(db_write[m], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / boltztrap_materials.py View on Github external
"""
        Get a BoltztrapMaterialsBuilder using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            b (str): name of "boltztrap" collection
            **kwargs: other params to put into BoltztrapMaterialsBuilder
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database")
            db_read = get_database(db_file, admin=True)

        return cls(db_write[m], db_read[b], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / file_materials.py View on Github external
def from_file(cls, db_file, data_file=None, m="materials", **kwargs):
        """
        Get a FileMaterialsBuilder using only a db file.

        Args:
            db_file (str): path to db file
            data_file (str): path to data file
            m (str): name of "materials" collection
            **kwargs: other parameters to feed into the builder, e.g. mapi_key
        """
        db_write = get_database(db_file, admin=True)
        if data_file:
            return cls(db_write[m], data_file, **kwargs)
        else:
            raise ValueError("data_file must be provided")
github hackingmaterials / atomate / atomate / vasp / builders / tags.py View on Github external
def from_file(cls, db_file, m="materials", t="tasks", **kwargs):
        """
        Get a TagsCollector using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            **kwargs: other parameters to feed into the builder, e.g. update_all
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database; using write creds")
            db_read = get_database(db_file, admin=True)
        return cls(db_write[m], db_read[t], **kwargs)
github hackingmaterials / atomate / atomate / vasp / builders / boltztrap_materials.py View on Github external
def from_file(cls, db_file, m="materials", b="boltztrap", **kwargs):
        """
        Get a BoltztrapMaterialsBuilder using only a db file.

        Args:
            db_file (str): path to db file
            m (str): name of "materials" collection
            b (str): name of "boltztrap" collection
            **kwargs: other params to put into BoltztrapMaterialsBuilder
        """
        db_write = get_database(db_file, admin=True)
        try:
            db_read = get_database(db_file, admin=False)
            db_read.collection_names()  # throw error if auth failed
        except:
            print("Warning: could not get read-only database")
            db_read = get_database(db_file, admin=True)

        return cls(db_write[m], db_read[b], **kwargs)