<jupyter_start><jupyter_text>make QE input<jupyter_code>from aiida.orm.nodes.data.upf import get_pseudos_from_structure

def _make_upf_locally( structure: StructureData, pseudos: str, cwd: str=None) -> dict:
    upflist = get_pseudos_from_structure(structure, pseudos)
    upfdic = {}
    for upfkey, upfvalue in upflist.items():
        #print(upfvalue.get_content())
        upf_filename = upfvalue.list_object_names()[0]
        upfdic[upfkey] = upf_filename
        if cwd is not None:
            target_path = os.path.join(cwd, upf_filename)
            with open(target_path,"w") as f:
                f.write(upfvalue.get_content())
            print(target_path,"is made.")
    return upfdic
def make_qe_input(superstructure: StructureData, pseudos: (str,Str), QEinput = "qe.in"):
    params = {
            'calculation': 'scf',
             'tprnfor': True, 
             'tstress': True,
            'pseudo_dir': ".", 
            'ecutwfc': 3.,
            'ecutrho': 10.,
            'conv_thr': 5.e-6,
            'electron_maxstep': 100,
    }

    if isinstance(pseudos,Str):
        pseudos = pseudos.value
    pseudo = _make_upf_locally(superstructure, pseudos)
    kspacing  = 0.05
    koffset  = (1,1,1)
    with open(QEinput,"w") as f:
        write_espresso_in(f, superstructure.get_ase(), pseudopotentials =pseudo, 
                          kspacing= kspacing, koffset=koffset, 
                      **params)
    return True
g_QEinput = nodebank.load("qeinput",g_force)
g_pseudos = Str('SSSP_1.1_efficiency')
# if g_QEinput is None:
if True:   
    g_QEinput_filename = os.path.join(g_root_wd.value,"qe.in")
    make_qe_input(g_superstructure, g_pseudos, g_QEinput_filename)
    g_QEinput = SinglefileData(g_QEinput_filename)
    nodebank.dump("qeinput",g_QEinput)
g_norder<jupyter_output><empty_output><jupyter_text>alm suggest<jupyter_code>codename = "alm@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_aiida_structure
builder.prefix = g_prefix
builder.norder = g_norder
builder.mode = Str("suggest")
builder.cwd = g_cwd

builder.metadata = {
        'options': {
           'resources': {'tot_num_mpiprocs': 1, 'num_machines': 1}
        } }

g_alm_suggest_future = nodebank.load("alm_suggest",g_force)
if g_alm_suggest_future is None: 
#if True:
    g_alm_suggest_future = submit(builder) # temporary run(), use submit()
    print(g_alm_suggest_future)
    _wait_for_node_finished(g_alm_suggest_future)
    if g_alm_suggest_future.is_finished_ok:
        nodebank.dump("alm_suggest",g_alm_suggest_future)

g_alm_suggest_future
if g_graph:
    !verdi node graph generate $g_alm_suggest_future.pk
g_alm_suggest_future.outputs.pattern_folder.list_object_names()<jupyter_output><empty_output><jupyter_text>重要: 1. 複数のSinglefileDataはnodeとすることができない。次に使うSinglefileDataは、次のworkchain/calcjobで取得しする。2. もしくはまとめてFolderDataとする。  displace.py<jupyter_code>g_mag = nodebank.load("mag", g_force)
if g_mag is None:
    g_mag = Float(0.01)
    nodebank.dump("mag", g_mag)
from fnmatch import fnmatch
@calcfunction
def _pack_harmonic_pattern_files(**kwargs):
    print(kwargs)
    result = []
    for _, folder in kwargs.items():
        for filename in folder.list_object_names():
            if fnmatch(filename,"*.pattern_HARMONIC"):
                result.append(filename)
    return Dict(dict={'pattern_files':result})
    
inputs = {
    "pattern1": g_alm_suggest_future.outputs.pattern_folder
}

g_pattern_files = nodebank.load("pattern_file",g_force)
if g_pattern_files is None:
    g_pattern_files = _pack_harmonic_pattern_files(**inputs)
    nodebank.dump("pattern_file",g_pattern_files)
g_pattern_files.attributes["pattern_files"]
for filename in g_pattern_files.attributes['pattern_files']:
    print(filename)
g_QEinput.attributes["filename"]
g_disp_start_id = nodebank.load("start_id", g_force)
if g_disp_start_id is None:
    g_disp_start_id = Int(1)
    nodebank.dump("start_id", g_disp_start_id)
codename = "alamode.displace@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.format = g_format
builder.cwd = g_cwd
builder.structure_org = g_QEinput
builder.mag = g_mag
builder.pattern_files = g_pattern_files

g_displacefuture = nodebank.load("displace", g_force)
if g_displacefuture is None:
    g_displacefuture = submit(builder)
    print(g_displacefuture)
    _wait_for_node_finished(g_displacefuture)
    if g_displacefuture.is_finished_ok:
        nodebank.dump("displace", g_displacefuture)
g_displacefuture
if g_graph:
    !verdi node graph generate $g_displacefuture.pk
g_displacefuture.outputs.result
g_displacefuture.outputs.retrieved.list_object_names()
g_displacefuture.outputs.dispfile_folder.list_object_names()<jupyter_output><empty_output><jupyter_text>pwx parallel submit<jupyter_code>g_displacefuture.outputs.dispfile_folder.list_object_names()
if g_graph:
    !verdi node graph generate $g_pwx_files.pk
g_cwd
# single file test
if False:
    codename = "alam<EMAIL>"
    code = Code.get_from_string(codename)

    builder = code.get_builder()
    builder.cwd = g_cwd
    builder.pwx_input_filename = Str('disp1.pw.in')
    builder.pseudos = g_pseudos
    #builder.pwx_output_filename = Str('disp1.pw.out')
    #builder.xml_filename = Str('disp1.xml')

    if True:
        g_displacefuture = run(builder)
        _wait_for_node_finished(g_displacefuture, 5)
        print(g_displacefuture)
    else:
        g_displacefuture = load_node(9949)
g_displacefuture.outputs.dispfile_folder.list_object_names()
g_codelist = List(list=["alam<EMAIL>.p<EMAIL>1",
                  "alamode.pwx@<EMAIL>2"])
g_displacefuture.outputs.dispfile_folder.list_object_names()

g_alldisp_pwx = WorkflowFactory("alamode.dispall_pwx")

# g_code_str = Str("alamode.pwx@mygarden1")

g_pwx_all_future = nodebank.load("dispall", g_force)
# if g_pwx_all_future is None:
if True:
    g_pwx_all_future = submit(g_alldisp_pwx, 
                pwx_input_folder=g_displacefuture.outputs.dispfile_folder, 
                pseudos = g_pseudos, 
                code_string = g_codelist, 
                cwd=g_cwd)
    print(g_pwx_all_future)
    _wait_for_node_finished(g_pwx_all_future, 10)
    if g_pwx_all_future.is_finished_ok:
        nodebank.dump("dispall", g_pwx_all_future)
g_pwx_all_future.outputs.pwx_output
#if g_graph:
if True:
    !verdi node graph generate $g_pwx_all_future.pk
g_pwx_all_future.outputs.pwx_output.attributes<jupyter_output><empty_output><jupyter_text>extract<jupyter_code>g_pwx_all_future
g_pwx_all_future.outputs.pwx_output.get_list()
extractworkchain = WorkflowFactory("alamode.extract")

inputs= {'QE': g_QEinput, 
         'target_file': g_pwx_all_future.outputs.pwx_output, 
         'cwd': g_cwd,
         "norder": g_norder
        # 'output_filename' : g_DFSET_filename
        }
print(inputs)

g_alamodeextract_future = nodebank.load("extract", g_force)
if g_alamodeextract_future is None:
    g_alamodeextract_future = submit(extractworkchain, **inputs)
    print(g_alamodeextract_future)
    _wait_for_node_finished(g_alamodeextract_future)
    if g_alamodeextract_future.is_finished_ok:
        nodebank.dump("extract", g_alamodeextract_future)

g_alamodeextract_future
g_alamodeextract_future.outputs.dfset_file
if g_graph:
    !verdi node graph generate $g_alamodeextract_future.pk
g_DFSET_file = g_alamodeextract_future.outputs.dfset_file
g_DFSET_file.attributes["filename"]<jupyter_output><empty_output><jupyter_text>alm opt<jupyter_code>g_alamodeextract_future
#g_aiida_structure = load_node(7970)
#g_prefix = load_node(7973)
#g_cwd  = load_node(7971)

g_DFSET_file = g_alamodeextract_future.outputs.dfset_file
from alamode_aiida.alm_input import alm_norder_name

almp = AlmPrefixMaker(name=g_primstructure.get_formula(),
                      kmesh=g_diag.get_array("diag"),
                      norder = g_norder.value)
g_prefix = Str(almp.prefix)
g_prefix
codename = "alm@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_aiida_structure
builder.prefix = g_prefix
builder.cwd = g_cwd
builder.mode = Str("opt")
builder.norder = g_norder
builder.dfset_file = g_DFSET_file

key = "almopt"
g_almoptfuture = nodebank.load(key,g_force)
if g_almoptfuture is None:
#if True:
    g_almoptfuture = submit(builder)
    print(g_almoptfuture)
    _wait_for_node_finished(g_almoptfuture, 5)
    if g_almoptfuture.is_finished_ok:
        nodebank.dump(key, g_almoptfuture)

g_almoptfuture.outputs.input_ANPHON_file.attributes<jupyter_output><empty_output><jupyter_text>f"{g_prefix}.fcs and {g_prefix}.xml are made in {g_cwd} directory."<jupyter_code>if g_graph:
    !verdi node graph generate $g_almoptfuture.pk<jupyter_output><empty_output><jupyter_text>anphon phonon<jupyter_code>g_prefix
g_cwd = Str(os.path.join(g_root_wd.value, "property"))
os.makedirs(g_cwd.value, exist_ok=True)
codename = "anphon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_primstructure
builder.prefix = g_prefix
builder.cwd = g_cwd
# builder.norder = g_norder
builder.fcsxml = g_almoptfuture.outputs.input_ANPHON_file
builder.mode = Str("phonons")
builder.phonons_mode = Str("band")
#builder.kparam = Dict(dict={}) # should merge to the input port, param.

g_phbandfuture = nodebank.load("phband", g_force)

if g_phbandfuture is None:
#if True:
    g_phbandfuture = submit(builder)
    print(g_phbandfuture)
    _wait_for_node_finished(g_phbandfuture, 5)
    nodebank.dump("phband", g_phbandfuture)
g_phbandfuture
from alamode_aiida.alm_input import make_alm_uniform_kmesh
g_qmesh_value = make_alm_uniform_kmesh(g_primstructure.get_ase(),kspacing=0.1)

amp = AlmPrefixMaker(name=g_primstructure.get_formula(), 
                     kmesh=g_diag.get_array("diag"), 
                     norder = g_norder.value, 
                     qmesh=g_qmesh_value )
g_prefix_dos = Str(amp.prefix)
g_prefix_dos
g_qmesh = List(list=[10,10,10])
codename = "anphon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_primstructure
builder.prefix = g_prefix_dos
builder.cwd = g_cwd
# builder.norder = g_norder
builder.fcsxml = g_almoptfuture.outputs.input_ANPHON_file
builder.mode = Str("phonons")
builder.phonons_mode = Str("dos")
builder.qmesh = g_qmesh

g_phdosfuture = nodebank.load("phdos",g_force)
if g_phdosfuture is None:
#if True:
    g_phdosfuture = submit(builder)
    print(g_phdosfuture)
    _wait_for_node_finished(g_phdosfuture, 5)
    if g_phdosfuture.is_finished_ok:
         nodebank.dump("phdos",g_phdosfuture)
g_phdosfuture.outputs.phdos_file.list_object_names()
if False:
    @calcfunction
    def FolderData_to_filename(outputfiles: FolderData, prefix: Str, mode: Str):
        band_filename = f"{prefix.value}.{mode.value}"
        if band_filename in outputfiles.list_object_names():
            return Str(band_filename)
        else:
            raise ValueError(f"No band file={band_filename} is found in outputfiles List.")<jupyter_output><empty_output><jupyter_text>band plot<jupyter_code>g_prefix
g_phbandfuture.outputs.phband_file.list_object_names()
phbandworkchain = WorkflowFactory('alamode.phband_img')
# g_img_filename = Str(f"{g_prefix.value}_phband.pdf")
g_band_filenames = g_phbandfuture.outputs.phband_file
inputs = {"cwd": g_cwd, "band_filenames": g_band_filenames, "prefix": g_prefix}
print(inputs)
isinstance(g_band_filenames,SinglefileData)
phbandimgworkchain = nodebank.load("phbandimg", g_force)
if phbandimgworkchain is None:
#if True:
    phbandimgworkchain = submit(phbandworkchain, **inputs)
    print(phbandimgworkchain)
    _wait_for_node_finished(phbandimgworkchain)
    if phbandimgworkchain.is_finished_ok:
         nodebank.dump("phbandimg",phbandimgworkchain)
phbandimgworkchain
phbandimgworkchain.outputs.img_file<jupyter_output><empty_output><jupyter_text>DOS plot<jupyter_code>g_phdosfuture.outputs.phdos_file
from alamode_aiida.alm_input import make_kspacing_kmeshlist, make_alm_uniform_kmesh
make_kspacing_kmeshlist(g_primstructure.get_ase())
g_prefix_dos

phdosworkchain = WorkflowFactory('alamode.phdos_img')

inputs = {"cwd": g_cwd, "dos_filenames": g_phdosfuture.outputs.phdos_file,
          "prefix": g_prefix_dos}
print(inputs)

g_dosfuture = nodebank.load("phdosimg", g_force)
if g_dosfuture is None:
#if True:
    g_dosfuture = submit(phdosworkchain, **inputs)
    print(g_dosfuture)
    _wait_for_node_finished(g_dosfuture)
    if g_dosfuture.is_finished_ok:
        nodebank.dump("phdosimg",g_dosfuture)

g_dosfuture.outputs.img_file.attributes<jupyter_output><empty_output><jupyter_text>thermo plot<jupyter_code>g_prefix_dos
FreeenergyImgWorkChain = WorkflowFactory("alamode.freeenergy_img")            
g_img_filename = Str("phdos_freeenergy.pdf")
g_inputs = {'cwd': g_cwd,'prefix': g_prefix_dos, 
            'thermo_file': g_phdosfuture.outputs.thermo_file}

freeenergyimgfuture = nodebank.load("freeenergyimg", g_force)
if freeenergyimgfuture is None:
#if True:   
    freeenergyimgfuture = submit(FreeenergyImgWorkChain, **g_inputs)
    print(freeenergyimgfuture)
    _wait_for_node_finished(freeenergyimgfuture)
    if freeenergyimgfuture.is_finished_ok:
        nodebank.dump("freeenergyimg",freeenergyimgfuture)

freeenergyimgfuture.outputs.img_file.list_object_names()
freeenergyimgfuture<jupyter_output><empty_output><jupyter_text>cubic term  alm suggest<jupyter_code>key = 'norder2_suggest'
g_norder = nodebank.load(key)
if g_norder is None:
    g_norder = Int(2)
    nodebank.dump(key, g_norder)
key = "cutoff2"
g_cutoff = nodebank.load(key)
if g_cutoff is None:
#if True:
    g_cutoff = Dict(dict={"Si-Si": {None, 7.3}})
    nodebank.dump(key, g_cutoff)
g_cutoff.attributes
almp = AlmPathMaker(name=g_primstructure.get_formula(),
                      kmesh=g_diag.get_array("diag"),
                   norder = g_norder)

g_cwd = Str(os.path.join(g_root_wd.value, almp.prefix))
os.makedirs(g_cwd.value, exist_ok=True)
print(g_cwd)
codename = "alm@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_aiida_structure
#builder.prefix = g_prefix
builder.mode = Str("suggest")
builder.cwd = g_cwd
builder.norder = g_norder
builder.cutoff = g_cutoff

builder.metadata = {
        'options': {
           'resources': {'tot_num_mpiprocs': 1, 'num_machines': 1}
        } }

key = "alm_suggest_cubic"
g_alm_suggest_future = nodebank.load(key,g_force)
if g_alm_suggest_future is None: 
#if True:    
    g_alm_suggest_future = submit(builder) # temporary run(), use submit()
    print(g_alm_suggest_future)
    _wait_for_node_finished(g_alm_suggest_future, 5)
    if g_alm_suggest_future.is_finished_ok:
        nodebank.dump(key,g_alm_suggest_future)

g_alm_suggest_future.outputs.pattern_folder.list_object_names()<jupyter_output><empty_output><jupyter_text>displace<jupyter_code>key = "mag_cubic"
g_mag = nodebank.load(key, g_force)
if g_mag is None:
    g_mag = Float(0.04)
    nodebank.dump(key, g_mag)
@calcfunction
def _pack_cubic_pattern_files(**kwargs):
    print(kwargs)
    result = []
    for _, folder in kwargs.items():
        for filename in folder.list_object_names():
            if fnmatch(filename,"*.pattern_ANHARM3"):
                result.append(filename)
    return Dict(dict={'pattern_files':result})

inputs = {
    "pattern1": g_alm_suggest_future.outputs.pattern_folder
}

key = "cubic_pattern_file"
g_pattern_files = nodebank.load(key,g_force)
#if g_pattern_files is None:
if True:
    g_pattern_files = _pack_cubic_pattern_files(**inputs)
    nodebank.dump(key,g_pattern_files)
g_norder
codename = "alamode.<EMAIL>"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.format = g_format
builder.cwd = g_cwd
builder.norder = g_norder
builder.structure_org = g_QEinput
# builder.start_id = g_disp_start_id
builder.mag = g_mag
builder.pattern_files = g_pattern_files

key = "displace_cubic"
g_displacefuture = nodebank.load(key, g_force)
if g_displacefuture is None:
#if True:
    g_displacefuture = submit(builder)
    print(g_displacefuture)
    _wait_for_node_finished(g_displacefuture)
    if g_displacefuture.is_finished_ok:
        nodebank.dump(key, g_displacefuture)
g_displacefuture.outputs.dispfile_folder.list_object_names()
g_cwd<jupyter_output><empty_output><jupyter_text>pw all<jupyter_code>if False: # don't run it. Too heavy.
    g_alldisp_pwx = WorkflowFactory("alamode.dispall_pwx")

    # g_code_str = Str("alamode.pwx@mygarden1")

    key = "dispall_cubic"
    g_pwx_all_future = nodebank.load(key, g_force)
    if g_pwx_all_future is None:
        g_pwx_all_future = run(g_alldisp_pwx, 
                    pwx_input_folder=g_displacefuture.outputs.dispfile_folder, 
                    code_string = g_codelist, 
                    cwd=g_cwd, norder=g_norder)
        print(g_pwx_all_future)
        _wait_for_node_finished(g_pwx_all_future, 10)
        if g_pwx_all_future.is_finished_ok:
            nodebank.dump(key, g_pwx_all_future)<jupyter_output><empty_output><jupyter_text>alm opt norder=2restarting from tutorial/Si sample*please copy DFSET_cubic from Si/reference*<jupyter_code>g_cwd
g_norder
g_DFSET_file = SinglefileData(os.path.join(g_cwd.value,"DFSET_cubic"))
g_DFSET_file
amp = AlmPrefixMaker(name=g_primstructure.get_formula(), 
                     kmesh=g_diag.get_array("diag"), 
                     norder=g_norder.value )
g_prefix =Str(amp.prefix)

codename = "alm@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_aiida_structure
builder.prefix = g_prefix
builder.cwd = g_cwd
builder.mode = Str("opt")
builder.norder = g_norder
builder.dfset_file = g_DFSET_file
builder.fc2xml_file =  g_almoptfuture.outputs.input_ANPHON_file

key = "almopt_cubic"
g_almopt2future = nodebank.load(key,g_force)

if g_almopt2future is None:
#if True:
    g_almopt2future = submit(builder)
    print(g_almopt2future)
    _wait_for_node_finished(g_almopt2future, 5)
    if g_almopt2future.is_finished_ok:
        nodebank.dump(key, g_almopt2future)

if True:
    ! verdi node graph generate $g_almopt2future.pk
g_almopt2future.outputs.result.attributes
g_almopt2future.outputs.force_constants_file
g_almopt2future.outputs.input_ANPHON_file<jupyter_output><empty_output><jupyter_text>analysis  thermal conductivity<jupyter_code>g_qmesh = [5,5,5,]
almp = AlmPrefixMaker(name=g_primstructure.get_formula(),
                      kmesh=g_diag.get_array("diag"),
                      norder=g_norder.value,
                      qmesh = g_qmesh)
g_prefix = Str(almp.prefix)
g_prefix
g_almopt2future.outputs.input_ANPHON_file.list_object_names()
g_cwd = Str(os.path.join(g_root_wd.value, "property"))
g_cwd
codename = "anphon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_primstructure
builder.prefix = g_prefix
builder.cwd = g_cwd
builder.norder = g_norder
builder.fcsxml = g_almopt2future.outputs.input_ANPHON_file
builder.mode = Str("RTA")
#builder.kparam = Dict(dict={"kspacing": 0.1})
builder.qmesh = List(list=g_qmesh)

key = "RTA"
g_RTAfuture = nodebank.load(key,g_force)
#if g_RTAfuture is None:   
if True:
    g_RTAfuture = submit(builder)
    print(g_RTAfuture)
    _wait_for_node_finished(g_RTAfuture, 5)
    if g_RTAfuture.is_finished_ok:
         nodebank.dump(key,g_RTAfuture)

import pandas as pd
g_RTAfuture.outputs.kl_file
g_df = load_anphon_kl(g_RTAfuture.outputs.kl_file)
g_df.plot(x="Temperature [K]", y="Thermal Conductivity_xx [W/mK]")
import matplotlib.pyplot as plt
plt.xscale("log")
import re
import pandas as pd

g_RTAfuture.outputs.result_file
class analzePhononOptions:
    def __init__(self, **kwargs):
        self.options= {'temp': None, 'mode': None, 'kpoint': None, 
'calc': 'kappa_boundary', 'isotope': None, 'average_gamma': True, 
'size': '1e+6', 'length': None, 'direction': None}

a = analzePhononOptions()
print(a.options)
g_prefix
codename = "analyze_phonon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.cwd = g_cwd
#builder.norder = g_norder
builder.prefix = g_prefix
builder.calc = Str("kappa_boundary")
# builder.size = Float(1.0e+6)
builder.file_result = g_RTAfuture.outputs.result_file
builder.param = Dict(dict={"size": 1e+6})

key = "ap_kappa"
g_ap_kappa_future = nodebank.load(key)
#if g_ap_kappa_future is None:   
if True:   
    g_ap_kappa_future = submit(builder)
    print(g_ap_kappa_future)
    _wait_for_node_finished(g_ap_kappa_future, 5)
    if g_ap_kappa_future.is_finished_ok:
         nodebank.dump(key,g_ap_kappa_future)
g_prefix
codename = "analyze_phonon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.cwd = g_cwd
builder.prefix = g_prefix
builder.calc = Str("tau")
# builder.size = Float(1.0e+6)
builder.file_result = g_RTAfuture.outputs.result_file
builder.param = Dict(dict={"temp": 300.0})


key = "ap_tau"
g_ap_tau_future = nodebank.load(key)
#if g_ap_tau_future is None:   
if True:
    g_ap_tau_future = submit(builder)
    print(g_ap_tau_future)
    _wait_for_node_finished(g_ap_tau_future, 5)
    if g_ap_tau_future.is_finished_ok:
         nodebank.dump(key,g_ap_tau_future)
g_ap_tau_future.outputs.tau_file
codename = "analyze_phonon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.cwd = g_cwd
builder.prefix = g_prefix
builder.calc = Str("cumulative")
# builder.size = Float(1.0e+6)
builder.file_result = g_RTAfuture.outputs.result_file
builder.param = Dict(dict={"temp": 300.0, "length": "10000:5"})


key = "ap_cum"
g_ap_cum_future = nodebank.load(key)
if g_ap_cum_future is None:   
#if True:
    g_ap_cum_future = submit(builder)
    print(g_ap_cum_future)
    _wait_for_node_finished(g_ap_cum_future, 5)
    if g_ap_cum_future.is_finished_ok:
         nodebank.dump(key,g_ap_cum_future)
g_ap_tau_future
!verdi node graph generate $g_ap_cum_future.pk
g_ap_cum_future.outputs.cumulative.attributes
values = g_ap_cum_future.outputs.cumulative.get_array("values")
values
values = g_ap_cum_future.outputs.cumulative.get_array("values").astype(float)
splitted_header = g_ap_cum_future.outputs.cumulative.get_array("columns")
df = pd.DataFrame(values, columns=splitted_header)
df
df.plot(x= "L [nm]", y='kappa xx [W/mK]')<jupyter_output><empty_output><jupyter_text>anphon spectra<jupyter_code>g_prefix
codename = "anphon@tutor"
code = Code.get_from_string(codename)

builder = code.get_builder()
builder.structure = g_primstructure
builder.prefix = g_prefix
builder.cwd = g_cwd
builder.norder = g_norder
builder.fcsxml = g_almopt2future.outputs.input_ANPHON_file
builder.mode = Str("RTA")
builder.kappa_spec = Int(1) # spectra
builder.qmesh = List(list=g_qmesh)
eparam = {"EMIN":0, "EMAX":550, "DELTA_E": 10.0}
builder.param= Dict(dict={"general": eparam})

key = "RTAspec"
g_RTAspecfuture = nodebank.load(key,g_force)
#if g_RTAspecfuture is None:  
if True:   
    g_RTAspecfuture = submit(builder)
    print(g_RTAspecfuture)
    _wait_for_node_finished(g_RTAspecfuture, 5)
    if g_RTAspecfuture.is_finished_ok:
         nodebank.dump(key,g_RTAspecfuture)

if True:
    ! verdi node graph generate $g_RTAspecfuture.pk
g_RTAspecfuture.outputs.result.attributes
g_df = load_anphon_kl_spec(g_RTAspecfuture.outputs.kl_spec_file)
print(np.unique(g_df["Temperature [K]"].values))
g_df_select = g_df[g_df["Temperature [K]"]==300]
g_df_select.plot(x=g_df.columns[1], y=g_df.columns[2])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10526765132758474, 'fraction_numerical': 0.006189703747972338, 'mean_word_length': 4.990028125799029, 'pattern_counts': {'":': 19, '<': 74, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '367997', 'license': 'Apache-2.0', 'n_tokens_mistral': 9102, 'n_tokens_neox': 8751, 'n_words': 1308, 'path': 'example/7080_alamode_all_aiida.ipynb', 'repo_name': 'nim-hrkn/alamode_aiida', 'size': '23444'}