Skip to content

Commit

Permalink
Merge pull request #187 from yambo-code/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mikibonacci authored Sep 18, 2020
2 parents ab5c511 + 988b328 commit 16f0875
Show file tree
Hide file tree
Showing 24 changed files with 643 additions and 61 deletions.
2 changes: 1 addition & 1 deletion aiida_yambo.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: aiida-yambo
Version: 1.1.1
Version: 1.1.2
Summary: YAMBO plugin and workflows for AiiDA
Home-page: https://github.com/yambo-code/yambo-aiida
Author: Miki Bonacci, Michael Atambo, Antimo Marrazzo, Prandini Gianluca
Expand Down
2 changes: 1 addition & 1 deletion aiida_yambo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.0"
__version__ = "1.1.2"
2 changes: 1 addition & 1 deletion aiida_yambo/aiida_yambo.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Name: aiida-yambo
Version: 1.0.0
Version: 1.1.2
7 changes: 3 additions & 4 deletions aiida_yambo/calculations/yambo.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def define(cls,spec):

def prepare_for_submission(self, tempfolder):

_dbs_accepted = {'gw0': 'ndb.QP', 'HF_and_locXC': 'ndb.HF_and_locXC',
'ns.db1': 'ns.db1',}
_dbs_accepted = {'gw0': 'ndb.QP', 'HF_and_locXC': 'ndb.HF_and_locXC',}

local_copy_list = []
remote_copy_list = []
Expand Down Expand Up @@ -353,8 +352,8 @@ def prepare_for_submission(self, tempfolder):
extra_retrieved = []

if initialise:
extra_retrieved.append('SAVE/'+_dbs_accepted['ns.db1'])

# extra_retrieved.append('SAVE/'+_dbs_accepted['ns.db1'])
pass
else:
for dbs in _dbs_accepted.keys():
db = boolean_dict.pop(dbs,False)
Expand Down
23 changes: 13 additions & 10 deletions aiida_yambo/parsers/ext_dep/yambofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,19 @@ def parse_report(self):
else: # data line B=x Eo = y ..
data_lines = [ i for i in spliter.split(line) if i.strip()]
for qp_data in data_lines:
bindex, dft_energy, qp_energy, qp_correction, z_factor, \
non_local_xc, local_xc, selfenergy_c = [float (i) for i in extract.match(qp_data).groups()]
kp_results['bindex'].append(bindex)
kp_results['dft_energy'].append(dft_energy)
kp_results['qp_energy'].append(qp_energy)
kp_results['qp_correction'].append(qp_correction)
kp_results['z_factor'].append(z_factor)
kp_results['non_local_xc'].append(non_local_xc)
kp_results['local_xc'].append(local_xc)
kp_results['selfenergy_c'].append(selfenergy_c)
try:
bindex, dft_energy, qp_energy, qp_correction, z_factor, \
non_local_xc, local_xc, selfenergy_c = [float (i) for i in extract.match(qp_data).groups()]
kp_results['bindex'].append(bindex)
kp_results['dft_energy'].append(dft_energy)
kp_results['qp_energy'].append(qp_energy)
kp_results['qp_correction'].append(qp_correction)
kp_results['z_factor'].append(z_factor)
kp_results['non_local_xc'].append(non_local_xc)
kp_results['local_xc'].append(local_xc)
kp_results['selfenergy_c'].append(selfenergy_c)
except:
pass
qp_results[kp_index] = kp_results
self.data = qp_results

Expand Down
6 changes: 4 additions & 2 deletions aiida_yambo/parsers/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def parse(self, retrieved, **kwargs):
'p2y_completed': False, 'last_time':0,\
'requested_time':self._calc.attributes['max_wallclock_seconds'], 'time_units':'seconds',\
'memstats':[], 'para_error':False, 'memory_error':False,'timing':[],'time_error': False, 'has_gpu': False,
'yambo_version':'4.5'}
'yambo_version':'4.5', 'Fermi(eV)':0}
ndbqp = {}
ndbhf = {}

Expand Down Expand Up @@ -242,7 +242,9 @@ def parse(self, retrieved, **kwargs):

if success == False:
if abs((float(output_params['last_time'])-float(output_params['requested_time'])) \
/ float(output_params['requested_time'])) < 0.25:
/ float(output_params['requested_time'])) < 0.25:
return self.exit_codes.WALLTIME_ERROR
elif 'time_most_prob' in output_params['errors']:
return self.exit_codes.WALLTIME_ERROR
elif output_params['para_error']:
return self.exit_codes.PARA_ERROR
Expand Down
49 changes: 39 additions & 10 deletions aiida_yambo/parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
import copy
import glob, os, re

def take_fermi_parser(file): # calc_node_pk = node_conv_wfl.outputs.last_calculation

for line in file:
if '[X]Fermi Level' in line:
print('The Fermi level is {}'.format(line.split()[3]))
ef = float(line.split()[3])
if '[X] Fermi Level' in line:
print('The Fermi level is {}'.format(line.split()[4]))
ef = float(line.split()[4])

return ef

def yambotiming_to_seconds(yt):
t = 0
th = 0
Expand Down Expand Up @@ -40,8 +52,9 @@ def parse_log(log, output_params):
else:
#Game over...
game_over = re.compile('Game')
game_over_2 = re.compile('Clock:')
for line in log.lines:
if game_over.findall(line):
if game_over.findall(line) or game_over_2.findall(line):
output_params['game_over'] = True

#timing sections...
Expand Down Expand Up @@ -73,6 +86,7 @@ def parse_log(log, output_params):
incomplete_para_error = re.compile('\[ERROR\]Incomplete')
impossible_para_error = re.compile('\[ERROR\]Impossible')
impossible_para_error2 = re.compile('\[ERROR\]USER parallel')
time_probably = re.compile('Alloc Xo%blc_d')
X_par_mem = re.compile('\[ERROR\]Allocation of X_par%blc_d failed')
reading_explosion_of_memory = re.compile('Reading')
for line in log.lines:
Expand All @@ -85,30 +99,44 @@ def parse_log(log, output_params):
output_params['errors'].append('memory_general')
elif incomplete_para_error.findall(line) or impossible_para_error.findall(line) or impossible_para_error2.findall(line):
output_params['para_error'] = True
if reading_explosion_of_memory.findall(log.lines[-1]):
output_params['memory_error'] = True
output_params['errors'].append('memory_general')
if X_par_mem.findall(log.lines[-1]):
output_params['memory_error'] = True
output_params['errors'].append('X_par_allocation')
elif time_probably.findall(line):
output_params['errors'].append('time_most_prob')
try:
if reading_explosion_of_memory.findall(log.lines[-1]):
output_params['memory_error'] = True
output_params['errors'].append('memory_general')
except:
pass
try:
if X_par_mem.findall(log.lines[-1]):
output_params['memory_error'] = True
output_params['errors'].append('X_par_allocation')
except:
pass
# if alloc2_error.findall(log.lines[-1]):
# output_params['memory_error'] = True
# output_params['errors'].append('memory_general')


return output_params

def parse_report(report, output_params):

try:
output_params['Fermi(eV)'] = take_fermi_parser(report.lines)
except:
pass

if 'setup' in report.filename:
pass

else:
#Game over...
game_over = re.compile('Game')
game_over_2 = re.compile('Clock:')
gpu_support = re.compile('CUDA')
for line in report.lines:
if game_over.findall(line):
if game_over.findall(line) or game_over_2.findall(line):
output_params['game_over'] = True

if gpu_support.findall(line):
Expand All @@ -120,11 +148,12 @@ def parse_scheduler_stderr(stderr, output_params):
m2 = re.compile('segmentation')
m3 = re.compile('dumped')
t1 = re.compile('walltime')
t2 = re.compile('time')
for line in stderr.lines:
if m1.findall(line) or m2.findall(line) or m3.findall(line):
output_params['memory_error'] = True
output_params['errors'].append('memory_general')
elif t1.findall(line):
elif t1.findall(line) or t2.findall(line):
output_params['time_error'] = True

def yambo_wrote_dbs(output_params):
Expand Down
2 changes: 1 addition & 1 deletion aiida_yambo/utils/parallel_namelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def check_para_namelists(params, version):

for key in params.keys():
for level in namelists[version].keys():
if level in key and 'CPU' in key:
if level in key and '_CPU' in key:
if level+namelists[version][level]+'CPU' == key:
pass
else:
Expand Down
2 changes: 1 addition & 1 deletion aiida_yambo/workflows/utils/helpers_aiida_yambo.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ def take_quantities(self, steps = 1, where = [], what = 'gap',backtrace=1):
return quantities

def start_from_converged(self, inputs, node):
inputs.yres.yambo.parameters = node.get_builder_restart().yres.yambo['parameters']
inputs.yres.yambo.parameters = node.called[0].get_builder_restart().yambo['parameters']
6 changes: 6 additions & 0 deletions aiida_yambo/workflows/yamboconvergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ def do_p2y(self):
self.report('Submitted YamboWorkflow up to p2y, pk = {}'.format(calc['p2y'].pk))
self.ctx.p2y_inputs.yres.yambo.settings = update_dict(self.ctx.p2y_inputs.yres.yambo.settings, 'INITIALISE', False)
self.ctx.p2y = calc['p2y']
self.report('setting label "p2y _on YC"')
load_node(calc['p2y'].pk).label = 'p2y _on YC'

return ToContext(calc)

def prepare_calculations(self):
Expand Down Expand Up @@ -266,6 +269,9 @@ def do_precalc(self):
calc['PRE_CALC'] = self.submit(YamboWorkflow, **self.ctx.precalc_inputs) #################run
self.report('Submitted preliminary YamboWorkflow, pk = {}'.format(calc['PRE_CALC'].pk))
self.ctx.PRE = calc['PRE_CALC']
self.report('setting label "precalc _on YC"')
load_node(calc['PRE_CALC'].pk).label = 'precalc _on YC'

return ToContext(calc)

def post_processing(self):
Expand Down
3 changes: 3 additions & 0 deletions aiida_yambo/workflows/yamborestart.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def _handle_parallelism_error(self, calculation):


if calculation.outputs.output_parameters.get_dict()['yambo_wrote_dbs'] :
self.ctx.inputs.parent_folder = calculation.outputs.remote_folder
self.ctx.inputs.settings = update_dict(self.ctx.inputs.settings,'RESTART_YAMBO',True) # to link the dbs in aiida.out
self.ctx.inputs.settings = update_dict(self.ctx.inputs.settings,'COPY_DBS', False)

Expand All @@ -169,6 +170,7 @@ def _handle_memory_error(self, calculation):
new_para, new_resources = fix_memory(self.ctx.inputs.metadata.options.resources, calculation, calculation.exit_status)
self.ctx.inputs.metadata.options.resources = new_resources
self.ctx.inputs.parameters = update_dict(self.ctx.inputs.parameters, list(new_para.keys()), list(new_para.values()))


new_para = check_para_namelists(new_para, self.inputs.code_version.value)
if new_para:
Expand All @@ -177,6 +179,7 @@ def _handle_memory_error(self, calculation):


if calculation.outputs.output_parameters.get_dict()['yambo_wrote_dbs'] :
self.ctx.inputs.parent_folder = calculation.outputs.remote_folder
self.ctx.inputs.settings = update_dict(self.ctx.inputs.settings,'RESTART_YAMBO',True) # to link the dbs in aiida.out
self.ctx.inputs.settings = update_dict(self.ctx.inputs.settings,'COPY_DBS', False)

Expand Down
7 changes: 3 additions & 4 deletions build/lib/aiida_yambo/calculations/yambo.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def define(cls,spec):

def prepare_for_submission(self, tempfolder):

_dbs_accepted = {'gw0': 'ndb.QP', 'HF_and_locXC': 'ndb.HF_and_locXC',
'ns.db1': 'ns.db1',}
_dbs_accepted = {'gw0': 'ndb.QP', 'HF_and_locXC': 'ndb.HF_and_locXC',}

local_copy_list = []
remote_copy_list = []
Expand Down Expand Up @@ -353,8 +352,8 @@ def prepare_for_submission(self, tempfolder):
extra_retrieved = []

if initialise:
extra_retrieved.append('SAVE/'+_dbs_accepted['ns.db1'])

# extra_retrieved.append('SAVE/'+_dbs_accepted['ns.db1'])
pass
else:
for dbs in _dbs_accepted.keys():
db = boolean_dict.pop(dbs,False)
Expand Down
23 changes: 13 additions & 10 deletions build/lib/aiida_yambo/parsers/ext_dep/yambofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,19 @@ def parse_report(self):
else: # data line B=x Eo = y ..
data_lines = [ i for i in spliter.split(line) if i.strip()]
for qp_data in data_lines:
bindex, dft_energy, qp_energy, qp_correction, z_factor, \
non_local_xc, local_xc, selfenergy_c = [float (i) for i in extract.match(qp_data).groups()]
kp_results['bindex'].append(bindex)
kp_results['dft_energy'].append(dft_energy)
kp_results['qp_energy'].append(qp_energy)
kp_results['qp_correction'].append(qp_correction)
kp_results['z_factor'].append(z_factor)
kp_results['non_local_xc'].append(non_local_xc)
kp_results['local_xc'].append(local_xc)
kp_results['selfenergy_c'].append(selfenergy_c)
try:
bindex, dft_energy, qp_energy, qp_correction, z_factor, \
non_local_xc, local_xc, selfenergy_c = [float (i) for i in extract.match(qp_data).groups()]
kp_results['bindex'].append(bindex)
kp_results['dft_energy'].append(dft_energy)
kp_results['qp_energy'].append(qp_energy)
kp_results['qp_correction'].append(qp_correction)
kp_results['z_factor'].append(z_factor)
kp_results['non_local_xc'].append(non_local_xc)
kp_results['local_xc'].append(local_xc)
kp_results['selfenergy_c'].append(selfenergy_c)
except:
pass
qp_results[kp_index] = kp_results
self.data = qp_results

Expand Down
6 changes: 4 additions & 2 deletions build/lib/aiida_yambo/parsers/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def parse(self, retrieved, **kwargs):
'p2y_completed': False, 'last_time':0,\
'requested_time':self._calc.attributes['max_wallclock_seconds'], 'time_units':'seconds',\
'memstats':[], 'para_error':False, 'memory_error':False,'timing':[],'time_error': False, 'has_gpu': False,
'yambo_version':'4.5'}
'yambo_version':'4.5', 'Fermi(eV)':0}
ndbqp = {}
ndbhf = {}

Expand Down Expand Up @@ -242,7 +242,9 @@ def parse(self, retrieved, **kwargs):

if success == False:
if abs((float(output_params['last_time'])-float(output_params['requested_time'])) \
/ float(output_params['requested_time'])) < 0.25:
/ float(output_params['requested_time'])) < 0.25:
return self.exit_codes.WALLTIME_ERROR
elif 'time_most_prob' in output_params['errors']:
return self.exit_codes.WALLTIME_ERROR
elif output_params['para_error']:
return self.exit_codes.PARA_ERROR
Expand Down
Loading

0 comments on commit 16f0875

Please sign in to comment.