Example #1
0
def clear_env():
    sma = SubmissionMongoAdapter.auto_load()

    lp = LaunchPad.auto_load()

    snl = SNLMongoAdapter.auto_load()

    db_dir = os.environ['DB_LOC']
    db_path = os.path.join(db_dir, 'tasks_db.json')
    with open(db_path) as f:
        db_creds = json.load(f)

    sma._reset()
    lp.reset('', require_password=False)
    snl._reset()

    conn = MongoClient(db_creds['host'], db_creds['port'])
    db = conn[db_creds['database']]
    db.authenticate(db_creds['admin_user'], db_creds['admin_password'])
    db.tasks.remove()
    db.boltztrap.remove()
    db.counter.remove()
    db['dos_fs.chunks'].remove()
    db['dos_fs.files'].remove()
    db['band_structure_fs.files'].remove()
    db['band_structure_fs.files'].remove()
Example #2
0
def submit_all_snl(min=None, max=None):
    constraints = {
        'is_ordered': True,
        'is_valid': True,
        'nsites': {
            '$lte': 200
        },
        'canonical_snl.about.projects': {
            '$ne': 'CederDahn Challenge'
        }
    }
    constraints['elements'] = {'$nin': NO_POTCARS}
    constraints['canonical_snl.about.history.name'] = {
        "$ne": "Materials Project structure optimization"
    }
    constraints['canonical_snl.about.remarks'] = {"$ne": "DEPRECATED"}

    if min and max:
        constraints['snlgroup_id'] = {'$gte': min, '$lte': max}
    elif min or max:
        raise ValueError('Must specify both min AND max if you specify one')

    snldb = SNLMongoAdapter.auto_load()
    sma = SubmissionMongoAdapter.auto_load()

    for result in snldb.snlgroups.find(constraints, {
            'canonical_snl': 1,
            'snlgroup_id': 1
    }):
        snl = MPStructureNL.from_dict(result['canonical_snl'])
        parameters = {'snlgroup_id': result['snlgroup_id']}
        sma.submit_snl(snl,
                       'Anubhav Jain <*****@*****.**>',
                       parameters=parameters)
Example #3
0
def clear_env():
    sma = SubmissionMongoAdapter.auto_load()

    lp = LaunchPad.auto_load()

    snl = SNLMongoAdapter.auto_load()

    db_dir = os.environ['DB_LOC']
    db_path = os.path.join(db_dir, 'tasks_db.json')
    with open(db_path) as f:
        db_creds = json.load(f)

    sma._reset()
    lp.reset('', require_password=False)
    snl._reset()

    conn = MongoClient(db_creds['host'], db_creds['port'])
    db = conn[db_creds['database']]
    db.authenticate(db_creds['admin_user'], db_creds['admin_password'])
    db.tasks.remove()
    db.boltztrap.remove()
    db.counter.remove()
    db['dos_fs.chunks'].remove()
    db['dos_fs.files'].remove()
    db['band_structure_fs.files'].remove()
    db['band_structure_fs.files'].remove()
Example #4
0
def submit_all_snl(min=None, max=None):
    constraints = {'is_ordered': True, 'is_valid': True, 'nsites': {'$lte': 200}, 'canonical_snl.about.projects': {'$ne': 'CederDahn Challenge'}}
    constraints['elements'] = {'$nin': NO_POTCARS}
    constraints['canonical_snl.about.history.name'] = {"$ne":"Materials Project structure optimization"}
    constraints['canonical_snl.about.remarks'] = {"$ne": "DEPRECATED"}

    if min and max:
        constraints['snlgroup_id'] = {'$gte': min, '$lte': max}
    elif min or max:
        raise ValueError('Must specify both min AND max if you specify one')

    snldb = SNLMongoAdapter.auto_load()
    sma = SubmissionMongoAdapter.auto_load()

    for result in snldb.snlgroups.find(constraints, {'canonical_snl': 1, 'snlgroup_id': 1}):
        snl = MPStructureNL.from_dict(result['canonical_snl'])
        parameters = {'snlgroup_id': result['snlgroup_id']}
        sma.submit_snl(snl, 'Anubhav Jain <*****@*****.**>', parameters=parameters)
Example #5
0
def fix():

    # initialize databases
    module_dir = os.path.dirname(os.path.abspath(__file__))

    snl_f = os.path.join(module_dir, 'snl.yaml')
    snldb = SNLMongoAdapter.from_file(snl_f)
    snl = snldb.snl
    snlgroups = snldb.snlgroups

    tasks_f = os.path.join(module_dir, 'tasks.yaml')
    with open(tasks_f) as f2:
        task_creds = yaml.load(f2)

    mc = MongoClient(task_creds['host'], task_creds['port'])
    db = mc[task_creds['database']]
    db.authenticate(task_creds['admin_user'], task_creds['admin_password'])
    tasks = db['tasks']

    tasks_f = os.path.join(module_dir, 'tasks.yaml')
    with open(tasks_f) as f2:
        task_creds = yaml.load(f2)

    mc = MongoClient(task_creds['host'], task_creds['port'])
    db = mc[task_creds['database']]
    db.authenticate(task_creds['admin_user'], task_creds['admin_password'])
    tasks = db['tasks']

    lp_f = os.path.join(module_dir, 'my_launchpad.yaml')
    lpdb = LaunchPad.from_file(lp_f)
    fws = lpdb.fireworks
    launches = lpdb.launches

    sb_f = os.path.join(module_dir, 'submission.yaml')
    sbdb = SubmissionMongoAdapter.from_file(sb_f)
    submissions = sbdb.jobs

    bad_crystal_ids = []

    crystals_file = os.path.join(module_dir, 'bad_crystals.txt')
    with open(crystals_file) as f:
        for line in f:
            bad_crystal_ids.append(int(line.strip()))


    for c_id in bad_crystal_ids:
        if c_id == 100892 or c_id == 100202:
            print 'SKIP'

        else:
            # FIX SNL
            for s in snl.find({'about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'snl_id': 1}):
                snl.update({'snl_id': s['snl_id']}, {'$pushAll': {"about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX SNLGROUPS
            for s in snlgroups.find({'canonical_snl.about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'snlgroup_id': 1}):
                snlgroups.update({'snlgroup_id': s['snlgroup_id']}, {'$pushAll': {"canonical_snl.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX FWs pt 1
            for s in fws.find({'spec.mpsnl.about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'fw_id': 1}):
                fws.update({'fw_id': s['fw_id']}, {'$pushAll': {"spec.mpsnl.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX FWs pt 2
            for s in fws.find({'spec.force_mpsnl.about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'fw_id': 1}):
                fws.update({'fw_id': s['fw_id']}, {'$pushAll': {"spec.force_mpsnl.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX Launches
            for s in launches.find({'action.update_spec.mpsnl.about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'launch_id': 1}):
                launches.update({'launch_id': s['launch_id']}, {'$pushAll': {"action.update_spec.mpsnl.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX TASKS
            for s in tasks.find({'snl.about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'task_id': 1}):
                tasks.update({'task_id': s['task_id']}, {'$pushAll': {"snl.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})
                tasks.update({'task_id': s['task_id']}, {'$pushAll': {"snl_final.about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            # FIX SUBMISSIONS
            for s in submissions.find({'about._materialsproject.deprecated.crystal_id_deprecated': c_id}, {'submission_id': 1}):
                submissions.update({'submission_id': s['submission_id']}, {'$pushAll': {"about.remarks": ['DEPRECATED', 'SEVERE BUG IN ICSD CONVERSION']}})

            print 'FIXED', c_id
    def auto_load(cls):
        sma = SubmissionMongoAdapter.auto_load()
        lp = LaunchPad.auto_load()

        return SubmissionProcessor(sma, lp)
    def auto_load(cls):
        sma = SubmissionMongoAdapter.auto_load()
        lp = LaunchPad.auto_load()

        return SubmissionProcessor(sma, lp)
Example #8
0
def submit_tests(names=None, params=None):
    sma = SubmissionMongoAdapter.auto_load()

    # note: TiO2 is duplicated twice purposely, duplicate check should catch this
    compounds = {
        "Si": 149,
        "Al": 134,
        "ZnO": 2133,
        "FeO": 18905,
        "LiCoO2": 601860,
        "LiFePO4": 585433,
        "GaAs": 2534,
        "Ge": 32,
        "PbTe": 19717,
        "YbO": 1216,
        "SiC": 567551,
        "Fe3C": 510623,
        "SiO2": 547211,
        "Na2O": 2352,
        "InSb (unstable)": 10148,
        "Sb2O5": 1705,
        "N2O5": 554368,
        "BaTiO3": 5020,
        "Rb2O": 1394,
        "TiO2": 554278,
        "TiO2 (2)": 554278,
        'BaNbTePO8': 560794,
        "AgCl": 22922,
        "AgCl (2)": 570858,
        "SiO2 (2)": 555211,
        "Mg2SiO4": 2895,
        "CO2": 20066,
        "PbSO4": 22298,
        "SrTiO3": 5532,
        "FeAl": 2658,
        "AlFeCo2": 10884,
        "NaCoO2": 554427,
        "ReO3": 547271,
        "LaH2": 24153,
        "SiH3I": 28538,
        "LiBH4": 30209,
        "H8S5N2": 28143,
        "LiOH": 23856,
        "SrO2": 2697,
        "Mn": 35,
        "Hg4Pt": 2312,
        "PdF4": 13868,
        "Gd2WO6": 651333,
        'MnO2': 19395,
        'VO2': 504800
    }

    mpr = MPRester()

    for name, sid in compounds.iteritems():
        if not names or name in names:
            sid = mpr.get_materials_id_from_task_id("mp-{}".format(sid))
            s = mpr.get_structure_by_material_id(sid, final=False)

            snl = StructureNL(s, 'Anubhav Jain <*****@*****.**>')

            parameters = {'priority': 10} if name == 'Si' else None
            if params:
                parameters.update(params)
            sma.submit_snl(snl, '*****@*****.**', parameters=parameters)
Example #9
0
#els_n1.append("Cu")
#els_n1.append("Au")
#print els_n1
#MA =[17,35,53,71,89,107,143,215] #2*3*3 system
#MA = [7,15,23,31,39,47,63,95]
#FA = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,18,19,20,30,31,32,33,34,35]#alpha
#FA = [0,1,2,3,4,5,6,7,8,9,12,13,20,21,22,23]#delta
#FA = [0,1,2,3,4,5,6,7]
#s.remove_sites(FA)
#add = [0.7469,0.74726,0.7469] # for 2*2*2 system
#add  = [0.74626,0.830865,0.8315]
#add1 = [0.66667,0.33333,0.34262]#alpha
#add1 = [0.33333,0.66667,0.15493]#delta
#add = [0.5,0.56901,0.5]
#s.append('K',add)#els_n1[9
#add2 = [0.33333,0.66667,0.61381]#alpha
#add2 = [0.66667,0.33333,0.65493]#delta
#s.append('K',add2)
#add3 = [0,0,0.010678]#alpha
#s.append('K',add3)
#s.to(fmt="poscar",filename="POSCAR4")
spacegroup = SpacegroupAnalyzer(s)
print('space group symbol:', spacegroup.get_space_group_symbol())
print('space group number:', spacegroup.get_space_group_number())
sma = SubmissionMongoAdapter.auto_load()
snl = StructureNL(s,
                  authors='WenQi <*****@*****.**>',
                  remarks=['MAPbI3', 'B-site'])
parameters = {'boltztrap': False, 'force_gamma': True}
sma.submit_snl(snl, '*****@*****.**', parameters=parameters)
Example #10
0
import json
import os
from fireworks.core.launchpad import LaunchPad
from mpworks.submission.submission_mongo import SubmissionMongoAdapter
from pymatgen.matproj.snl import StructureNL

__author__ = 'Anubhav Jain'
__copyright__ = 'Copyright 2014, The Materials Project'
__version__ = '0.1'
__maintainer__ = 'Anubhav Jain'
__email__ = '*****@*****.**'
__date__ = 'Jan 24, 2014'

if __name__ == "__main__":
    sma = SubmissionMongoAdapter.from_file('submission.yaml')

    module_dir = os.path.dirname(os.path.abspath(__file__))
    lp_f = os.path.join(module_dir, 'my_launchpad.yaml')
    lpdb = LaunchPad.from_file(lp_f)

    for s in os.listdir(os.path.join(module_dir, "snls")):
        if '.json' in s:
            print 'submitting', s
            with open(os.path.join(module_dir, "snls",s)) as f:
                snl = StructureNL.from_dict(json.load(f))
                sma.submit_snl(snl, '*****@*****.**', {"priority": 10})
            print 'DONE submitting', s


print 'DONE!'
Example #11
-1
def submit_tests(names=None, params=None):
    sma = SubmissionMongoAdapter.auto_load()

    # note: TiO2 is duplicated twice purposely, duplicate check should catch this
    compounds = {"Si": 149, "Al": 134, "ZnO": 2133, "FeO": 18905,
                 "LiCoO2": 601860, "LiFePO4": 585433, "GaAs": 2534, "Ge": 32, "PbTe": 19717,
                 "YbO": 1216, "SiC": 567551, "Fe3C": 510623, "SiO2": 547211, "Na2O": 2352,
                 "InSb (unstable)": 10148, "Sb2O5": 1705, "N2O5": 554368, "BaTiO3": 5020,
                 "Rb2O": 1394, "TiO2": 554278, "TiO2 (2)": 554278, 'BaNbTePO8': 560794,
                 "AgCl": 22922, "AgCl (2)": 570858, "SiO2 (2)": 555211, "Mg2SiO4": 2895, "CO2": 20066,
                 "PbSO4": 22298, "SrTiO3": 5532, "FeAl": 2658, "AlFeCo2": 10884, "NaCoO2": 554427,
                 "ReO3": 547271, "LaH2": 24153, "SiH3I": 28538, "LiBH4": 30209, "H8S5N2": 28143,
                 "LiOH": 23856, "SrO2": 2697, "Mn": 35, "Hg4Pt": 2312,
                 "PdF4": 13868, "Gd2WO6": 651333, 'MnO2': 19395, 'VO2': 504800}

    mpr = MPRester()

    for name, sid in compounds.iteritems():
        if not names or name in names:
            sid = mpr.get_materials_id_from_task_id("mp-{}".format(sid))
            s = mpr.get_structure_by_material_id(sid, final=False)

            snl = StructureNL(s, 'Anubhav Jain <*****@*****.**>')

            parameters = {'priority': 10} if name == 'Si' else None
            if params:
                parameters.update(params)
            sma.submit_snl(snl, '*****@*****.**', parameters=parameters)