Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing IP outputs #52

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tutorial/databases_qepy/iron-metal/flow-iron.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from yambopy.io.factories import PwNscfTasks, PwBandsTasks, PwRelaxTasks
from yambopy.flow import YambopyFlow, PwTask, E2yTask, YamboTask
from schedulerpy import Scheduler
from yambopy import yambopyenv
from yambopy.env import yambopyenv

#sch = Scheduler.factory(scheduler="slurm",ntasks=8,walltime="10:00:00")
sch = Scheduler.factory(scheduler="bash")
Expand Down
6 changes: 5 additions & 1 deletion yamboparser/yambofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def parse_output(self,**parse_kwargs):
zip_tags = parse_kwargs.get('zip_tags',False) #flag--default behavior is to do nothing
#get the tags of the columns
if self.type in YamboFile._outputs_type.keys(): #== "output_absorption":
tags = [tag.strip() for tag in re.findall('([ `0-9a-zA-Z\-\/]+)\[[0-9]\]',''.join(self.lines))]
pattern = '([ `0-9a-zA-Z\-\/]+)\[[0-9]\]'
tags = [tag.strip() for tag in re.findall(pattern,''.join(self.lines))]
if len(tags) < 2 and self.type in ["output_loss", "output_abs", "output_alpha"]: # temporary fix for IP case: E[1] [eV] Im(eps) Re(eps)
lines_with_matches = [line for line in self.lines if re.search(pattern, line)]
tags = [tag.strip() for tag in lines_with_matches[0].replace("#","").replace("\n","").replace("[eV]","").split()]
if self.type == "output_gw":
tags = [line.replace('(meV)','').replace('Sc(Eo)','Sc|Eo') for line in self.lines if all(tag in line for tag in ['K-point','Band','Eo'])][0]
tags = tags[2:].strip().split()
Expand Down
11 changes: 0 additions & 11 deletions yambopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@
"""
import numpy as np

class yambopyenv():
YAMBO = "yambo"
P2Y = "p2y"
E2Y = "e2y"
YPP = "ypp"
SCHEDULER = "bash"
YAMBO_RT = "yambo_rt"
YPP_RT = "ypp_rt"
YAMBO_NL = "yambo_nl"
YPP_NL = "ypp_nl"

#tools and units
from yambopy.tools.jsonencoder import *
from yambopy.units import *
Expand Down
1 change: 1 addition & 0 deletions yambopy/dbs/bsekerneldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
import os
from yambopy import *
from yambopy.dbs.savedb import YamboSaveDB
from yambopy.units import *
from itertools import product

Expand Down
10 changes: 10 additions & 0 deletions yambopy/env/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class yambopyenv():
YAMBO = "yambo"
P2Y = "p2y"
E2Y = "e2y"
YPP = "ypp"
SCHEDULER = "bash"
YAMBO_RT = "yambo_rt"
YPP_RT = "ypp_rt"
YAMBO_NL = "yambo_nl"
YPP_NL = "ypp_nl"
2 changes: 1 addition & 1 deletion yambopy/flow/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from qepy.ph import PhIn
from qepy.dynmat import DynmatIn
from qepy import qepyenv
from yambopy import yambopyenv
from yambopy.env import yambopyenv
from yambopy.tools.string import marquee
from yambopy.tools.duck import isiter, isstring
from yambopy.io.inputfile import YamboIn
Expand Down
3 changes: 2 additions & 1 deletion yambopy/io/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import json
import re
from subprocess import Popen, PIPE
from yambopy import yambopyenv
from yambopy.env import yambopyenv
from yambopy.tools.duck import isstring


def issave(path):
""" Check if yambo SAVE folder is present either as directory or as symlink """
if os.path.isdir(path) or os.path.islink(path): return True
Expand Down
2 changes: 1 addition & 1 deletion yambopy/io/iofile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import re
from subprocess import Popen, PIPE
from yambopy import yambopyenv
from yambopy.env import yambopyenv
from yambopy.tools.duck import isstring

class YamboIO(object):
Expand Down