How to use mendeleev - 10 common examples

To help you get started, we’ve selected a few mendeleev 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 TrustyJAID / Trusty-cogs / elements / core.py View on Github external
async def convert(self, ctx: commands.Context, argument: str) -> ELEMENTS:
        result = None
        if argument.isdigit():
            if int(argument) > 118 or int(argument) < 1:
                raise BadArgument("`{}` is not a valid element!".format(argument))
            result = ELEMENTS(int(argument))
        else:
            try:
                result = ELEMENTS(argument.title())
            except Exception:
                raise BadArgument("`{}` is not a valid element!".format(argument))
        if not result:
            raise BadArgument("`{}` is not a valid element!".format(argument))
        return result
github SUNCAT-Center / CatalysisHubBackend / apps / prototypeSearch / ingest.py View on Github external
import pprint
import sys
import time
import statistics

from sqlalchemy.sql.expression import Tuple

import models
import mendeleev

# create table if it hasn't already happened
models.metadata.create_all(models.engine)
models.session.commit()

scarcity_data = {}
for element in mendeleev.get_all_elements():
    scarcity_data[element.symbol] = 1./(element.abundance_crust or 1e-9)


#@profile
def bulk_upsert(db, geometries):
    geometries_dict = {
            (geometry.repository, geometry.handle): geometry
                 for geometry in geometries
            }
    existing = db.Geometry.query.filter(
            Tuple(db.Geometry.repository, db.Geometry.handle).in_(
                (geometry.repository, geometry.handle)
                for geometry in geometries
                )
            )
    for each in existing.all():
github flawnson / Graph_convolutional_NN_molecule_maker / features.py View on Github external
def get_num_classes(atom_list):
        num_classes = []
        for atoms in atom_list:
                boiling_points = list([element(atom).boiling_point for atom in atoms])
                classes = len(sorted(list(set(boiling_points))))
                num_classes.append(classes)
        return max(num_classes) # We return the max value, as this is the number of classes of the most diverse molecule
github kalset1 / bigChem / main.py View on Github external
"[Ce]", "[Pr]", "[Nd]", "[Pm]", "[Sm]", "[Eu]", "[Gd]", "[Tb]", "[Dy]", "[Ho]", "[Er]", "[Tm]", "[Yb]", "[Lu]",
    "[Th]", "[Pa]", "[U ]", "[Np]", "[Pu]", "[Am]", "[Cm]", "[Bk]", "[Cf]", "[Es]", "[Fm]", "[Md]", "[No]", "[Lr]"
    ]

elements = ["Hydrogen",'Helium','Lithium','Beryllium','Boron','Carbon','Nitrogen','Oxygen','Fluorine','Neon','Sodium','Magnesium','Aluminum','Silicon','Phosphorus','Sulfur','Chlorine',
'Argon','Potassium','Calcium','Scandium','Titanium','Vanadium','Chromium','Manganese','Iron','Cobalt','Nickel','Copper','Zinc','Gallium','Germanium','Arsenic',
'Selenium','Bromine','Krypton','Rubidium','Strontium','Yttrium','Zirconium','Niobium','Molybdenum','Technetium','Ruthenium','Rhodium','Palladium',
'Silver','Cadmium','Indium','Tin','Antimony','Tellurium','Iodine','Xenon','Cesium','Barium',
'Lanthanum','Cerium','Praseodymium','Neodymium','Promethium','Samarium','Europium','Gadolinium','Terbium','Dysprosium','Holmium','Erbium','Thulium','Ytterbium','Lutetium','Hafnium','Tantalum','Tungsten','Rhenium','Osmium','Iridium','Platinum','Gold','Mercury','Thallium','Lead','Bismuth','Polonium','Astatine','Radon','Francium','Radium','Actinium','Thorium','Protactinium','Uranium','Neptunium','Plutonium','Americium',
'Curium','Berkelium','Californium','Einsteinium','Fermium','Mendelevium','Nobelium','Lawrencium','Rutherfordium','Dubnium','Seaborgium','Bohrium',
'Hassium','Meitnerium','Darmstadtium','Roentgenium','Copernicium',"Nihonium","Flerovium","Moscovium","Livermorium","Tennessine","Oganesson"]

values = []

for i in elements:
    x = element(i)
    symbol = x.symbol
    atom_number = x.atomic_number
    atom_weight = x.mass
    atom_radius = x.atomic_radius
    config = x.econf
    y = [symbol, atom_number, atom_weight, config]
    values.append(y)

element_dict = {}

for i in range(len(elements)):
    element_dict[elements[i]] = values[i]

def getAll(formula_name):
    url_formula = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/" + formula_name + "/property/MolecularFormula/TXT"
    url_structure = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/" + formula_name + "/property/CanonicalSMILES/TXT"
github hightower8083 / PoGit / pogit / particle.py View on Github external
params['DensityRatio'] = relative_density

        if species=='generic_ionizable' or species=='ion':
            if element is None:
                raise ValueError(f'{species} needs `element` argument')

            params["Element"] = element
            params["TargetSpeciesName"] = target_species.name
            params["InitialCharge"] = initial_charge
            params["pol"] = ionizer_polarization

        if species=='generic_ionizable' or species=='generic_nonionizable':
            params["MassRatio"] = mass_ratio
            params["ChargeRatio"] = charge_ratio
        elif species=='ion':
            el = table_element(element)
            params["MassRatio"] = el.mass * atomic_mass / m_e
            params["ChargeRatio"] = -el.atomic_number

        # Converting float and integer arguments to strings
        for arg in params.keys():
            if type(params[arg]) == float:
                # Imposing a fixed float format
                params[arg] = f"{params[arg]:.15e}"
            if type(params[arg]) == int:
                params[arg] = f"{params[arg]:d}"

        # Generic parameters
        template_species = {}
        template_species['filename'] = 'species.template'
        template_species['Appendable'] = {}
        template_species['Appendable']['\n'] = {}
github kalset1 / bigChem / main.py View on Github external
formula = self.formula
        rname = self.rname
        structure = "[" + "".join(formula) + "]"

        if len(formula) == 4:
            formula[0], formula[1] = (str(formula[0]) + str(formula[1])), (str(formula[2]) + str(formula[3]))
        elif len(formula) == 3 and formula[2] in string.ascii_uppercase:
            formula[0], formula[1] = (str(formula[0]) + str(formula[1])), (str(formula[2]))
            del formula[2]
        elif len(formula) == 3 and formula[2] in string.ascii_lowercase:
            formula[0], formula[1] = str(formula[0]), (str(formula[1] + str(formula[2])))
            del formula[2]

        for i in formula:
            if i not in str(range(101)):
                z = element(i)
                z = z.ionic_radii
                z = list(z)

                for i in z:
                    if "charge=" in str(i):
                        i = str(i).replace("charge=", "")
                        i = list(i)
                        i = i[:i.index(",")]
                        i = "".join(i)
                        i = str(i).strip()
                        charges.append(int(i))

        return [structure, charges]
github TrustyJAID / Trusty-cogs / elements / core.py View on Github external
async def elements(self, ctx: commands.Context, *elements: ElementConverter) -> None:
        """
            Display information about multiple elements

            `elements` can be the name, symbol or atomic number of the element
            separated by spaces
        """
        if not elements:
            elements = [ELEMENTS(e) for e in range(1, 119)]
        await menu(ctx, [await self.element_embed(e) for e in elements], DEFAULT_CONTROLS)
github flawnson / Graph_convolutional_NN_molecule_maker / features.py View on Github external
def get_targets(atom_list):
        # Same as the get_atom_properties function from node attributes section
        for atoms in atom_list:
                boiling_points = list([element(atom).boiling_point for atom in atoms])

                yield boiling_points
github TrustyJAID / Trusty-cogs / elements / core.py View on Github external
async def ptable(self, ctx: commands.Context) -> None:
        """Display a menu of all elements"""
        embeds = [await self.element_embed(ELEMENTS(e)) for e in range(1, 119)]
        await menu(ctx, embeds, DEFAULT_CONTROLS)
github flawnson / Graph_convolutional_NN_molecule_maker / features.py View on Github external
def get_atom_properties(atom_list):
    for atoms in atom_list:
        atomic_number = [element(atom).atomic_number for atom in atoms]
        atomic_volume = [element(atom).atomic_volume for atom in atoms]
        atomic_weight = [element(atom).atomic_weight for atom in atoms]
        all_atom_properties = list(zip(atomic_number, atomic_volume, atomic_weight))
        yield all_atom_properties

mendeleev

Pythonic periodic table of elements

MIT
Latest version published 2 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages