mirror of https://github.com/abinit/abipy.git
Fix scripts after refactoring
This commit is contained in:
parent
981eb56e65
commit
804ab3f5db
|
@ -202,7 +202,8 @@ class ElectronBandsPlotterTest(AbipyTest):
|
|||
|
||||
if self.has_matplotlib():
|
||||
plotter.combiplot(title="Silicon band structure", show=False)
|
||||
plotter.combiboxplot(title="Silicon band structure", show=False)
|
||||
if self.has_seaborn():
|
||||
plotter.combiboxplot(title="Silicon band structure", show=False)
|
||||
plotter.gridplot(title="Silicon band structure", show=False)
|
||||
plotter.boxplot(title="Silicon band structure", swarm=True, show=False)
|
||||
plotter.animate(show=False)
|
||||
|
|
|
@ -7,10 +7,15 @@ from __future__ import print_function, division, unicode_literals, absolute_impo
|
|||
import os
|
||||
import numpy as np
|
||||
|
||||
from phonopy import Phonopy, file_IO
|
||||
from phonopy.structure.atoms import Atoms as PhonopyAtoms
|
||||
from phonopy.interface.vasp import read_vasp_from_strings
|
||||
from phonopy.interface.abinit import parse_set_of_forces
|
||||
try:
|
||||
from phonopy import Phonopy, file_IO
|
||||
from phonopy.interface.vasp import read_vasp_from_strings
|
||||
from phonopy.interface.abinit import parse_set_of_forces
|
||||
except ImportError:
|
||||
import warnings
|
||||
warnings.warn("phonopy is required by abiphonopy. Install it with conda or pip")
|
||||
|
||||
|
||||
from pymatgen.io.abinit.works import Work
|
||||
from abipy.core.structure import Structure
|
||||
from abipy.abio.inputs import AbinitInput
|
||||
|
|
|
@ -87,7 +87,7 @@ def flowdir_wname_tname(dirname):
|
|||
"""
|
||||
if dirname is None: dirname = os.getcwd()
|
||||
dirname = os.path.abspath(dirname)
|
||||
if os.path.exists(os.path.join(dirname, abilab.Flow.PICKLE_FNAME)):
|
||||
if os.path.exists(os.path.join(dirname, flowapi.Flow.PICKLE_FNAME)):
|
||||
return dirname, None, None
|
||||
|
||||
# Handle works or tasks.
|
||||
|
@ -96,7 +96,7 @@ def flowdir_wname_tname(dirname):
|
|||
for i in range(2):
|
||||
head, tail = os.path.split(head)
|
||||
if i == 0: tail_1 = tail
|
||||
if os.path.exists(os.path.join(head, abilab.Flow.PICKLE_FNAME)):
|
||||
if os.path.exists(os.path.join(head, flowapi.Flow.PICKLE_FNAME)):
|
||||
if i == 0:
|
||||
# We have a work: /root/flow_dir/w[num]
|
||||
wname = tail
|
||||
|
@ -529,7 +529,7 @@ Specify the files to open. Possible choices:
|
|||
qtype = options.qtype
|
||||
|
||||
if qtype == "script":
|
||||
manager = abilab.TaskManager.from_user_config()
|
||||
manager = flowapi.TaskManager.from_user_config()
|
||||
script = manager.qadapter.get_script_str(
|
||||
job_name="job_name",
|
||||
launch_dir="workdir",
|
||||
|
@ -543,7 +543,7 @@ Specify the files to open. Possible choices:
|
|||
print(script)
|
||||
|
||||
else:
|
||||
print(abilab.TaskManager.autodoc())
|
||||
print(flowapi.TaskManager.autodoc())
|
||||
print("qtype supported: %s" % flowapi.all_qtypes())
|
||||
print("Use `abirun.py . manager slurm` to have the list of qparams for slurm.\n")
|
||||
|
||||
|
@ -555,12 +555,11 @@ Specify the files to open. Possible choices:
|
|||
|
||||
if options.command == "doc_scheduler":
|
||||
print("Options that can be specified in scheduler.yml:")
|
||||
print(abilab.PyFlowScheduler.autodoc())
|
||||
print(flowapi.PyFlowScheduler.autodoc())
|
||||
return 0
|
||||
|
||||
if options.command == "abibuild":
|
||||
#abilab.abicheck():
|
||||
abinit_build = abilab.AbinitBuild()
|
||||
abinit_build = flowapi.AbinitBuild()
|
||||
print()
|
||||
print(abinit_build)
|
||||
print()
|
||||
|
@ -597,7 +596,7 @@ Specify the files to open. Possible choices:
|
|||
options.flowdir, wname, tname = flowdir_wname_tname(options.flowdir)
|
||||
|
||||
# Read the flow from the pickle database.
|
||||
flow = abilab.Flow.pickle_load(options.flowdir, remove_lock=options.remove_lock)
|
||||
flow = flowapi.Flow.pickle_load(options.flowdir, remove_lock=options.remove_lock)
|
||||
#flow.show_info()
|
||||
|
||||
# If we have selected a work/task, we have to convert wname/tname into node ids (nids)
|
||||
|
@ -642,7 +641,7 @@ Specify the files to open. Possible choices:
|
|||
|
||||
elif options.command == "new_manager":
|
||||
# Read the new manager from file.
|
||||
new_manager = abilab.TaskManager.from_file(options.manager_file)
|
||||
new_manager = flowapi.TaskManager.from_file(options.manager_file)
|
||||
|
||||
# Default status for new_manager is QCritical
|
||||
if options.task_status is None:
|
||||
|
|
|
@ -4,9 +4,9 @@ from __future__ import print_function, division, unicode_literals, absolute_impo
|
|||
|
||||
import os
|
||||
import abipy.data as abidata
|
||||
import abipy.flowapi as flowapi
|
||||
|
||||
from abipy.core.testing import AbipyTest
|
||||
from abipy import abilab
|
||||
|
||||
|
||||
class ManagerTest(AbipyTest):
|
||||
|
@ -17,7 +17,7 @@ class ManagerTest(AbipyTest):
|
|||
yaml_paths = [os.path.join(root, f) for f in os.listdir(root) if f.endswith(".yml") and "_manager" in f]
|
||||
assert yaml_paths
|
||||
for p in yaml_paths:
|
||||
manager = abilab.TaskManager.from_file(p)
|
||||
manager = flowapi.TaskManager.from_file(p)
|
||||
print(manager)
|
||||
shell = manager.to_shell_manager(mpi_procs=2)
|
||||
#assert 0
|
||||
|
@ -28,7 +28,7 @@ class ManagerTest(AbipyTest):
|
|||
yaml_paths = [os.path.join(root, f) for f in os.listdir(root) if f.endswith(".yml") and "_scheduler" in f]
|
||||
assert yaml_paths
|
||||
for p in yaml_paths:
|
||||
sched = abilab.PyFlowScheduler.from_file(p)
|
||||
sched = flowapi.PyFlowScheduler.from_file(p)
|
||||
print(sched)
|
||||
|
||||
#assert 0
|
|
@ -4,6 +4,7 @@ from __future__ import print_function, division, unicode_literals, absolute_impo
|
|||
|
||||
import os
|
||||
import abipy.data as abidata
|
||||
import abipy.flowapi as flowapi
|
||||
|
||||
from scripttest import TestFileEnvironment
|
||||
from monty.inspect import all_subclasses
|
||||
|
@ -26,13 +27,14 @@ def test_if_all_scripts_are_tested():
|
|||
for i, s in enumerate(not_tested):
|
||||
print("[%d] %s" % (i, s))
|
||||
|
||||
assert not_tested == set([
|
||||
"abiGWprint.py",
|
||||
"abiGWstore.py",
|
||||
"abiGWoutput.py",
|
||||
"abiphonons.py",
|
||||
"abiGWsetup.py",
|
||||
])
|
||||
assert len(not_tested) == 0
|
||||
#assert not_tested == set([
|
||||
# "abiGWprint.py",
|
||||
# "abiGWstore.py",
|
||||
# "abiGWoutput.py",
|
||||
# "abiphonons.py",
|
||||
# "abiGWsetup.py",
|
||||
#])
|
||||
|
||||
|
||||
class ScriptTest(AbipyTest):
|
||||
|
@ -177,7 +179,7 @@ class TestAbirun(ScriptTest):
|
|||
# Build a flow.
|
||||
flowdir = env.base_path
|
||||
scf_input, nscf_input = make_scf_nscf_inputs()
|
||||
flow = abilab.bandstructure_flow(flowdir, scf_input, nscf_input, manager=None)
|
||||
flow = flowapi.bandstructure_flow(flowdir, scf_input, nscf_input, manager=None)
|
||||
flow.build_and_pickle_dump()
|
||||
|
||||
# Test abirun commands requiring a flow (no submission)
|
||||
|
|
Loading…
Reference in New Issue