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