Пример #1
0
# Store detected errors
if 'error' in locals():
    HT.updateResults({'error': error}, cinfo['id'])
else:
    print('Gathering results')
    results = gather(cinfo['results'])

    print('Updating results.')
    # updateresults could be assumed from dictionary keys and automated.
    HT.updateResults(results, cinfo['id'])

    print(
        'Energy OK. Ending calculation, deleting junk files and fetching results.'
    )
    HT.end(cinfo['id'])
    #cleanup function
    # Can change this to a step dictionary
    os.remove('CHG')

print('Updating settings.')

# Update POTCAR INFO

POTCAR_version = execute('grep -a \'TITEL\' POTCAR | awk \'{ print $4 }\'')
cinfo['settings']['POTCAR'] = POTCAR_version.strip().replace('\n', ', ')

HT.updateSettings(cinfo['settings'], cinfo['id'])

# Update priority with Machine Learning model
#if step == 21:
Пример #2
0
elif energy == '' or not 'energy' in locals():
    HT.updateResults({'error': 'Energy missing'}, cid)
    print('Energy missing! Error...')
elif not os.path.isfile('CHGCAR') and not os.path.isfile('CHG'):
    HT.updateResults({'error': 'CHGCAR and CHG missing. VASP Error?'}, cid)
    print('CHGCAR/CHG missing. VASP Error?')
else:
    print(
        'Energy OK. Ending calculation, deleting junk files and fetching results.'
    )
    print('This is the HT.end cid: ' + str(cid))

    ended = 0
    tries = 0
    while (ended == 0 and tries < 10):
        ended = HT.end(cid)
        tries = tries + 1
        print tries
        time.sleep(random.randint(10, 100))
    if (ended == 0):
        print('ERROR: I tried to end calculation ' + str(cid) + str(tries) +
              ' times, but no succes.')  #tries should always be 10
        HT.updateResults({'error': 'Ending calculation failed'}, cid)

    else:
        if status < 15:
            #os.remove('CHGCAR')
            os.remove('CHG')

        results = HT.getResults(cid)
Пример #3
0
#END CALCULATION AND FETCH RESULTS

energy = execute('grep \'energy  without entropy\'  OUTCAR | tail -1 | awk \'{ print $4 }\'')

if 'error' in locals():
    HT.updateResults({'error':error}, cid)
elif energy=='' or not 'energy' in locals():
    HT.updateResults({'error':'Energy missing'}, cid)
    print('Energy missing! Error...')
elif not os.path.isfile('CHGCAR') and not os.path.isfile('CHG'):
    HT.updateResults({'error':'CHGCAR and CHG missing. VASP Error?'}, cid)
    print('CHGCAR/CHG missing. VASP Error?')
else:
    print('Energy OK. Ending calculation, deleting junk files and fetching results.')
    HT.end(cid)

    if status<19:
        os.remove('CHG')

    results = HT.getResults(cid)

    #could leave this out when working with QZP's

    numberofatoms = lines[6][:-1].lstrip()
    numberofatoms = " ".join(numberofatoms.split())
    numberofatoms = sum(map(int, numberofatoms.split(' ')))

    energy = float(energy)

    if step == 1:
Пример #4
0
#END CALCULATION AND FETCH RESULTS

energy = execute('grep \'energy  without entropy\'  OUTCAR | tail -1 | awk \'{ print $4 }\'')

if 'error' in locals():
    HT.updateResults({'error':error}, cid)
elif energy=='' or not 'energy' in locals():
    HT.updateResults({'error':'Energy missing'}, cid)
    print('Energy missing! Error...')
elif not os.path.isfile('CHGCAR') and not os.path.isfile('CHG'):
    HT.updateResults({'error':'CHGCAR and CHG missing. VASP Error?'}, cid)
    print('CHGCAR/CHG missing. VASP Error?')
else:
    print('Energy OK. Ending calculation, deleting junk files and fetching results.')
    HT.end(cid)

    if status<19:
        os.remove('CHG')

    results = HT.getResults(cid)

    #could leave this out when working with QZP's

    numberofatoms = lines[6][:-1].lstrip()
    numberofatoms = " ".join(numberofatoms.split())
    numberofatoms = sum(map(int, numberofatoms.split(' ')))

    energy = float(energy)

    if step == 1:
Пример #5
0
#HTML.setMLPriority(newq, 2,  ['mass','Ecoh','EN','IP'], N_init)
#
#for i in range(N_init):
#    calc = HTc.fetchgetstart(newq)
#    HTc.updateResults({target: rdict[calc['file']]})
#
#    if rdict[calc['file']] < limit:
#        stable += 1
#    print('Found ' + str(stable) + ' stable materials (' + str(int(round(100*stable/tstable,0))) + ' %) in ' + str(i+1) + ' samples.')
#    HTc.end()

for i in range(nsample):
    if i % batch_size == 0:
        HTML.updateMLPriority(
            newq,
            stat=2,
            modelClass='sklearn.gaussian_process.GaussianProcessRegressor',
            target='Ehull',
            features=['mass', 'Ecoh', 'EN', 'IP'],
            maxParallel=1)
    calc = HTc.fetchgetstart(newq)
    print(calc)
    HTc.updateResults({target: rdict[calc['file']]})

    if rdict[calc['file']] < limit:
        stable += 1
    print('Found ' + str(stable) + ' stable materials (' +
          str(int(round(100 * stable / tstable, 0))) + ' %) in ' + str(i + 1) +
          ' samples.')
    HTc.end()