Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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():
"turbomole",
"v-sim",
"vasp",
"xsf",
"xyz"]
# safe settings for non-cubic large gas phase cell
GAS_PHASE_CELL = [15, 16, 17]
atomic_radii = {
element.symbol:
(element.atomic_radius
or element.covalent_radius_cordero
or element.covalent_radius_pyykko)
for element in mendeleev.get_all_elements()}
class MockRequest(object):
def __init__(self, args):
self.args = json.dumps(args)
def __repr__(self):
return '[MockRequest] ' + pprint.pformat(self.args)
@catKitDemo.route('/generate_bulk_cif/', methods=['GET', 'POST'])
def generate_bulk_cif(request=None, return_atoms=False):
request = flask.request if request is None else request
if isinstance(request.args, str):
request.args = json.loads(request.args)