mirror of https://github.com/abinit/abipy.git
pylint (unused import)
This commit is contained in:
parent
5425a402d9
commit
b22680d09b
|
@ -3,7 +3,6 @@ This module gathers the most important classes and helper functions used for scr
|
|||
"""
|
||||
from __future__ import print_function, division, unicode_literals
|
||||
|
||||
import sys
|
||||
import os
|
||||
import collections
|
||||
|
||||
|
@ -24,7 +23,7 @@ ArrayWithUnit = units.ArrayWithUnit
|
|||
####################
|
||||
### Abipy import ###
|
||||
####################
|
||||
from abipy.flowtk import Pseudo, PseudoTable, Mrgscr, Mrgddb, Mrggkk, Flow, Work, TaskManager, AbinitBuild, flow_main
|
||||
from abipy.flowtk import Pseudo, PseudoTable, Mrgscr, Mrgddb, Flow, Work, TaskManager, AbinitBuild, flow_main
|
||||
from abipy.core.release import __version__, min_abinit_version
|
||||
from abipy.core.globals import enable_notebook, in_notebook, disable_notebook
|
||||
from abipy.core import restapi
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""This module contains lookup table with the name of the ABINIT variables."""
|
||||
import json
|
||||
import os
|
||||
import warnings
|
||||
import numpy as np
|
||||
|
@ -547,7 +546,7 @@ class AbinitInputParser(object):
|
|||
if m:
|
||||
tok = tok.replace("sqrt", "math.sqrt")
|
||||
tok = str(eval(tok))
|
||||
if "/" in tok: # Note true_division from __future__
|
||||
if "/" in tok:
|
||||
tok = str(eval(tok))
|
||||
values.append(tok)
|
||||
return values
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
"""Database with the names of the input variables used in Abinit and in other main programs."""
|
||||
import sys
|
||||
import os
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
# Unit names.
|
||||
# Operators.
|
||||
from abipy.abio.abivar_database.variables import ABI_UNITS, ABI_OPS
|
||||
|
||||
##############
|
||||
# Public API #
|
||||
|
|
|
@ -9,7 +9,6 @@ from monty.collections import AttrDict
|
|||
from monty.string import is_string
|
||||
from monty.json import jsanitize, MontyDecoder
|
||||
from pymatgen.util.serialization import pmg_serialize
|
||||
from abipy.flowtk import PseudoTable
|
||||
from abipy.core.structure import Structure
|
||||
from abipy.abio.inputs import AbinitInput, MultiDataset
|
||||
from abipy.abio.input_tags import *
|
||||
|
|
|
@ -4,7 +4,6 @@ The syntax is similar to the one used in ABINIT with small differences.
|
|||
"""
|
||||
import os
|
||||
import collections
|
||||
import warnings
|
||||
import itertools
|
||||
import copy
|
||||
import time
|
||||
|
@ -263,10 +262,10 @@ class AbiAbstractInput(AbstractInput):
|
|||
the corresponding variables to the input.
|
||||
"""
|
||||
d = {}
|
||||
for aobj in abi_objects:
|
||||
if not hasattr(aobj, "to_abivars"):
|
||||
raise TypeError("type %s: %s does not have `to_abivars` method" % (type(aobj), repr(aobj)))
|
||||
d.update(self.set_vars(aobj.to_abivars()))
|
||||
for obj in abi_objects:
|
||||
if not hasattr(obj, "to_abivars"):
|
||||
raise TypeError("type %s: %s does not have `to_abivars` method" % (type(obj), repr(obj)))
|
||||
d.update(self.set_vars(obj.to_abivars()))
|
||||
return d
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -369,12 +368,9 @@ class AbinitInput(AbiAbstractInput, MSONable, Has_Structure):
|
|||
import hashlib
|
||||
sha1 = hashlib.sha1()
|
||||
|
||||
try:
|
||||
tos = unicode
|
||||
except NameError:
|
||||
# Py3K
|
||||
def tos(s):
|
||||
return str(s).encode(encoding="utf-8")
|
||||
# Py3K
|
||||
def tos(s):
|
||||
return str(s).encode(encoding="utf-8")
|
||||
|
||||
# Add key, values to sha1
|
||||
# (not sure this is code is portable: roundoff errors and conversion to string)
|
||||
|
|
|
@ -370,7 +370,7 @@ class AbinitOutputFile(AbinitTextFile, NotebookWriter):
|
|||
if self.run_completed:
|
||||
return self._get_structures("footer")
|
||||
else:
|
||||
print("Cannot extract final structures from file.\n %s" % str(exc))
|
||||
cprint("Cannot extract final structures from file.\n %s" % self.filepath, "red")
|
||||
return []
|
||||
|
||||
@lazy_property
|
||||
|
|
|
@ -692,7 +692,7 @@ Expecting callable or attribute name or key in abifile.params""" % (type(hue), s
|
|||
if self._do_close.pop(abifile.filepath, False):
|
||||
try:
|
||||
abifile.close()
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
print("Exception while closing: ", abifile.filepath)
|
||||
print(exc)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import string
|
||||
import warnings
|
||||
import collections
|
||||
import numpy as np
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
from collections import OrderedDict
|
||||
from monty.collections import AttrDict
|
||||
from monty.functools import lazy_property
|
||||
from monty.string import is_string
|
||||
from monty.string import is_string, marquee
|
||||
from monty.termcolor import cprint
|
||||
from monty.inspect import all_subclasses
|
||||
from pymatgen.io.vasp.inputs import Poscar
|
||||
|
@ -502,7 +502,7 @@ class _Field(Has_Structure):
|
|||
|
||||
elif self.nspinor == 2:
|
||||
raise NotImplementedError()
|
||||
ntot, mx, my, mz = scalvec_from_spinmat(res_nspden)
|
||||
#ntot, mx, my, mz = scalvec_from_spinmat(res_nspden)
|
||||
nup, ndown = 0.5 * (ntot + mz), 0.5 * (ntot - mz)
|
||||
|
||||
# Fill DataFrame row.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
Function1D describes a function of a single variable and provides an easy-to-use API
|
||||
for performing common tasks such as algebraic operations, integrations, differentiations, plots ...
|
||||
"""
|
||||
import itertools
|
||||
import numpy as np
|
||||
|
||||
from io import StringIO
|
||||
|
|
|
@ -8,10 +8,9 @@ import numpy as np
|
|||
|
||||
from itertools import product
|
||||
from tabulate import tabulate
|
||||
from monty.json import MSONable, MontyEncoder
|
||||
from monty.json import MontyEncoder
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from monty.string import marquee
|
||||
from pymatgen.core.lattice import Lattice
|
||||
from pymatgen.util.serialization import pmg_serialize
|
||||
|
@ -348,7 +347,7 @@ def map_kpoints(other_kpoints, other_lattice, ref_lattice, ref_kpoints, ref_symr
|
|||
found = False
|
||||
for ik_ref, kref in enumerate(ref_kpoints):
|
||||
if found: break
|
||||
for tsign in tsign:
|
||||
for tsign in tsigns:
|
||||
for isym, symrec in enumerate(ref_symrecs):
|
||||
krot = tsign * np.matmul(symrec, kref)
|
||||
if issamek(okpt_red, krot):
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
import numpy as np
|
||||
|
||||
from itertools import product as iproduct
|
||||
from collections import deque
|
||||
#from itertools import product as iproduct
|
||||
from monty.functools import lazy_property
|
||||
from numpy.random import random
|
||||
#from numpy.random import random
|
||||
from numpy.fft import fftn, ifftn, fftshift, ifftshift, fftfreq
|
||||
from abipy.tools import duck
|
||||
|
||||
|
|
|
@ -5,15 +5,14 @@ import os
|
|||
import collections
|
||||
import tempfile
|
||||
import pickle
|
||||
import numpy as np
|
||||
|
||||
from time import ctime
|
||||
import numpy as np
|
||||
from monty.os.path import which
|
||||
from monty.termcolor import cprint
|
||||
from monty.string import is_string, list_strings
|
||||
from monty.string import list_strings
|
||||
from monty.collections import dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from abipy.flowtk.netcdf import NetcdfReader, NO_DEFAULT
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
|
|
@ -7,7 +7,6 @@ import sys
|
|||
from collections import OrderedDict
|
||||
from pprint import pprint
|
||||
from monty.functools import lazy_property
|
||||
from monty.collections import dict2namedtuple
|
||||
from monty.string import marquee
|
||||
from pymatgen import SETTINGS
|
||||
from pymatgen.ext.matproj import MPRester, MPRestError
|
||||
|
|
|
@ -11,7 +11,7 @@ import pickle
|
|||
import pymatgen
|
||||
import pymatgen.core.units as pmg_units
|
||||
|
||||
from pprint import pprint, pformat
|
||||
from pprint import pformat
|
||||
from warnings import warn
|
||||
from collections import OrderedDict
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
|
@ -25,7 +25,7 @@ from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt
|
|||
from abipy.flowtk import PseudoTable
|
||||
from abipy.core.mixins import NotebookWriter
|
||||
from abipy.core.symmetries import AbinitSpaceGroup
|
||||
from abipy.iotools import as_etsfreader, Visualizer, xsf
|
||||
from abipy.iotools import as_etsfreader, Visualizer
|
||||
from abipy.flowtk.abiobjects import structure_from_abivars, structure_to_abivars
|
||||
|
||||
|
||||
|
@ -1264,7 +1264,6 @@ class Structure(pymatgen.Structure, NotebookWriter):
|
|||
"""
|
||||
from pymatgen.electronic_structure.plotter import plot_brillouin_zone, plot_brillouin_zone_from_kpath
|
||||
labels = None if not with_labels else self.hsym_kpath.kpath["kpoints"]
|
||||
#pprint(labels)
|
||||
if pmg_path:
|
||||
return plot_brillouin_zone_from_kpath(self.hsym_kpath, ax=ax, show=False, **kwargs)
|
||||
else:
|
||||
|
|
|
@ -10,6 +10,7 @@ import spglib
|
|||
from monty.string import is_string
|
||||
from monty.itertools import iuptri
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from monty.collections import dict2namedtuple
|
||||
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
|
||||
from pymatgen.util.serialization import SlotPickleMixin
|
||||
|
@ -699,17 +700,17 @@ class AbinitSpaceGroup(OpSequence):
|
|||
has_timerev=has_timrev_from_kptopt(kptopt),
|
||||
inord=inord)
|
||||
|
||||
@classmethod
|
||||
def from_file(cls, ncfile, inord="F"):
|
||||
"""
|
||||
Initialize the object from a Netcdf file.
|
||||
"""
|
||||
r, closeit = as_etsfreader(ncfile)
|
||||
new = cls.from_ncreader(r)
|
||||
if closeit:
|
||||
file.close()
|
||||
#@classmethod
|
||||
#def from_file(cls, ncfile, inord="F"):
|
||||
# """
|
||||
# Initialize the object from a Netcdf file.
|
||||
# """
|
||||
# r, closeit = as_etsfreader(ncfile)
|
||||
# new = cls.from_ncreader(r)
|
||||
# if closeit:
|
||||
# file.close()
|
||||
|
||||
return new
|
||||
# return new
|
||||
|
||||
@classmethod
|
||||
def from_structure(cls, structure, has_timerev=True, symprec=1e-5, angle_tolerance=5):
|
||||
|
|
|
@ -199,8 +199,7 @@ class AnaddbNcFile(AbinitNcFile, Has_Structure, NotebookWriter):
|
|||
try:
|
||||
return InteratomicForceConstants.from_file(self.filepath)
|
||||
except Exception as exc:
|
||||
#print(exc)
|
||||
#cprint("Interatomic force constants have not been calculated. Returning None", "red")
|
||||
cprint("Interatomic force constants have not been calculated. Returning None", "red")
|
||||
return None
|
||||
|
||||
@lazy_property
|
||||
|
|
|
@ -11,12 +11,12 @@ import abipy.core.abinit_units as abu
|
|||
from collections import OrderedDict
|
||||
from functools import lru_cache
|
||||
from monty.string import marquee, list_strings
|
||||
from monty.collections import AttrDict, dict2namedtuple, tree
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from monty.dev import deprecated
|
||||
from pymatgen.core.units import eV_to_Ha, bohr_to_angstrom, ang_to_bohr, Energy
|
||||
from abipy.flowtk import NetcdfReader, AnaddbTask
|
||||
from pymatgen.core.units import eV_to_Ha, bohr_to_angstrom, Energy
|
||||
from abipy.flowtk import AnaddbTask
|
||||
from abipy.core.mixins import TextFile, Has_Structure, NotebookWriter
|
||||
from abipy.core.symmetries import AbinitSpaceGroup
|
||||
from abipy.core.structure import Structure
|
||||
|
@ -28,7 +28,7 @@ from abipy.dfpt.phonons import PhononDosPlotter, PhononBandsPlotter
|
|||
from abipy.dfpt.ifc import InteratomicForceConstants
|
||||
from abipy.dfpt.elastic import ElasticData
|
||||
from abipy.core.abinit_units import phfactor_ev2units, phunit_tag
|
||||
from abipy.tools.plotting import Marker, add_fig_kwargs, get_ax_fig_plt, set_axlims, get_axarray_fig_plt
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
from abipy.tools import duck
|
||||
from abipy.tools.tensors import DielectricTensor, ZstarTensor, Stress
|
||||
from abipy.abio.robots import Robot
|
||||
|
@ -1138,7 +1138,7 @@ class DdbFile(TextFile, Has_Structure, NotebookWriter):
|
|||
plotter: |PhononDosPlotter| object.
|
||||
Client code can use ``plotter.gridplot()`` to visualize the results.
|
||||
"""
|
||||
num_cpus = get_ncpus() // 2 if num_cpus is None else num_cpus
|
||||
#num_cpus = get_ncpus() // 2 if num_cpus is None else num_cpus
|
||||
if num_cpus <= 0: num_cpus = 1
|
||||
num_cpus = min(num_cpus, len(nqsmalls))
|
||||
|
||||
|
@ -1840,7 +1840,7 @@ class DielectricTensorGenerator(Has_Structure):
|
|||
# the possible imaginary parts of degenerate modes will cancel.
|
||||
if duck.is_listlike(gamma_ev):
|
||||
gammas = np.asarray(gamma_ev)
|
||||
assert len(gammas) == len(phfreqs)
|
||||
assert len(gammas) == len(self.phfreqs)
|
||||
else:
|
||||
gammas = np.ones(len(self.phfreqs)) * float(gamma_ev)
|
||||
|
||||
|
@ -1850,17 +1850,9 @@ class DielectricTensorGenerator(Has_Structure):
|
|||
t += self.oscillator_strength[i].real / (self.phfreqs[i]**2 - w**2 - 1j*g)
|
||||
|
||||
vol = self.structure.volume / bohr_to_angstrom ** 3
|
||||
t = 4 * np.pi * t / vol / eV_to_Ha**2
|
||||
t = 4 * np.pi * t / vol / eV_to_Ha ** 2
|
||||
t += self.epsinf
|
||||
|
||||
#t = np.zeros((3, 3))
|
||||
#w = w * eV_to_Ha
|
||||
#for i in range(3, len(self.phfreqs)):
|
||||
# phw = self.phfreqs[i] * eV_to_Ha
|
||||
# t += self.oscillator_strength[i].real / (phw**2 - w**2)
|
||||
#t *= 4 * np.pi / (self.structure.volume * ang_to_bohr ** 3)
|
||||
#t += self.epsinf
|
||||
|
||||
return DielectricTensor(t)
|
||||
|
||||
@add_fig_kwargs
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# coding: utf-8
|
||||
import sys
|
||||
import functools
|
||||
import numpy as np
|
||||
import itertools
|
||||
|
@ -11,7 +10,7 @@ import abipy.core.abinit_units as abu
|
|||
|
||||
from collections import OrderedDict
|
||||
from monty.string import is_string, list_strings, marquee
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.collections import dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from pymatgen.core.units import eV_to_Ha, Energy
|
||||
|
@ -3671,7 +3670,6 @@ class PhononDosPlotter(NotebookWriter):
|
|||
titles = list(self._phdoses_dict.keys())
|
||||
phdos_list = list(self._phdoses_dict.values())
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
nrows, ncols = 1, 1
|
||||
numeb = len(phdos_list)
|
||||
if numeb > 1:
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import ipywidgets as ipw
|
||||
|
||||
from collections import OrderedDict
|
||||
from abipy.tools.plotting import get_ax_fig_plt
|
||||
|
||||
|
||||
#def add_docstrings(*tuples):
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
# coding: utf-8
|
||||
"""Classes for the analysis of BSE calculations"""
|
||||
import sys
|
||||
import os
|
||||
import itertools
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from collections import OrderedDict
|
||||
from monty.collections import AttrDict
|
||||
from monty.functools import lazy_property
|
||||
from monty.string import marquee, is_string
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
|
@ -232,12 +230,6 @@ class DielectricFunction(object):
|
|||
# """String with the type of calculation."""
|
||||
# return self.info["calc_type"]
|
||||
|
||||
#def show_info(self, stream=sys.stdout):
|
||||
# """Pretty print of the info."""
|
||||
# import pprint
|
||||
# printer = pprint.PrettyPrinter(self, width=80, depth=None, stream=stream)
|
||||
# printer.pprint(self.info)
|
||||
|
||||
@add_fig_kwargs
|
||||
def plot(self, ax=None, **kwargs):
|
||||
"""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"""Density/potential files in netcdf/fortran format."""
|
||||
import os
|
||||
import tempfile
|
||||
import numpy as np
|
||||
#import numpy as np
|
||||
|
||||
from monty.string import marquee
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# coding: utf-8
|
||||
"""Classes to analyse electronic structures."""
|
||||
import sys
|
||||
import os
|
||||
import copy
|
||||
import itertools
|
||||
|
@ -16,7 +15,7 @@ from collections import OrderedDict, namedtuple
|
|||
from collections.abc import Iterable
|
||||
from monty.string import is_string, list_strings, marquee
|
||||
from monty.termcolor import cprint
|
||||
from monty.json import MSONable, MontyEncoder
|
||||
from monty.json import MontyEncoder
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from monty.bisect import find_le, find_gt
|
||||
|
@ -25,7 +24,7 @@ from pymatgen.electronic_structure.core import Spin as PmgSpin
|
|||
from abipy.core.func1d import Function1D
|
||||
from abipy.core.mixins import Has_Structure, NotebookWriter
|
||||
from abipy.core.kpoints import (Kpoint, KpointList, Kpath, IrredZone, KSamplingInfo, KpointsReaderMixin,
|
||||
Ktables, has_timrev_from_kptopt, map_grid2ibz, kmesh_from_mpdivs)
|
||||
Ktables, has_timrev_from_kptopt, map_grid2ibz) #, kmesh_from_mpdivs)
|
||||
from abipy.core.structure import Structure
|
||||
from abipy.iotools import ETSF_Reader
|
||||
from abipy.tools import gaussian, duck
|
||||
|
@ -2951,7 +2950,6 @@ class ElectronBandsPlotter(NotebookWriter):
|
|||
# Merge frames ignoring index (not meaningful)
|
||||
data = pd.concat(frames, ignore_index=True)
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
if not spin_polarized:
|
||||
ax, fig, plt = get_ax_fig_plt(ax=ax)
|
||||
|
@ -2961,6 +2959,7 @@ class ElectronBandsPlotter(NotebookWriter):
|
|||
sns.swarmplot(x="band", y="eig", data=data, hue="label", color=".25", ax=ax)
|
||||
else:
|
||||
# Generate two subplots for spin-up / spin-down channels.
|
||||
import matplotlib.pyplot as plt
|
||||
if ax is not None:
|
||||
raise NotImplementedError("ax == None not implemented when nsppol==2")
|
||||
fig, ax_list = plt.subplots(nrows=2, ncols=1, sharex=True, squeeze=False)
|
||||
|
@ -3939,7 +3938,7 @@ class Bands3D(Has_Structure):
|
|||
for ikuc, ik_ibz in enumerate(self.uc2ibz):
|
||||
ucdata_sbk[:, :, ikuc] = scalars[:, :, ik_ibz]
|
||||
else:
|
||||
raise ValueError("Wrong inshape: %s" % str(insp))
|
||||
raise ValueError("Wrong inshape: %s" % str(inshape))
|
||||
|
||||
return ucdata_sbk
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ from collections import OrderedDict, defaultdict
|
|||
from tabulate import tabulate
|
||||
from monty.termcolor import cprint
|
||||
from monty.functools import lazy_property
|
||||
from monty.string import marquee, list_strings
|
||||
from monty.string import marquee #, list_strings
|
||||
from pymatgen.core.periodic_table import Element
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.electrons.ebands import ElectronsReader
|
||||
from abipy.tools import gaussian
|
||||
from abipy.tools.plotting import set_axlims, get_axarray_fig_plt, add_fig_kwargs, get_ax_fig_plt
|
||||
from abipy.tools.plotting import set_axlims, get_axarray_fig_plt, add_fig_kwargs #, get_ax_fig_plt
|
||||
|
||||
|
||||
def gaussians_dos(dos, mesh, width, values, energies, weights):
|
||||
|
@ -256,7 +256,7 @@ class FatBandsFile(AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, N
|
|||
else:
|
||||
print("natsph < natom. Will set to zero the PJDOS contributions for the atoms that are not included.")
|
||||
assert self.natsph < self.natom
|
||||
filedata = np.reshape(r.read_value(key),
|
||||
filedata = np.reshape(self.reader.read_value(key),
|
||||
(self.natsph, self.mbesslang**2, self.nsppol, self.mband, self.nkpt))
|
||||
for i, iatom in enumerate(self.iatsph):
|
||||
walm_sbk[iatom] = filedata[i]
|
||||
|
@ -608,7 +608,7 @@ class FatBandsFile(AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, N
|
|||
|
||||
# Build plot grid.
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
|
||||
from matplotlib.gridspec import GridSpec #, GridSpecFromSubplotSpec
|
||||
fig = plt.figure()
|
||||
nrows, ncols = 2 * (mylmax+1), mylmax + 1
|
||||
gspec = GridSpec(nrows=nrows, ncols=ncols, wspace=0.1, hspace=0.1)
|
||||
|
@ -1407,6 +1407,7 @@ class FatBandsFile(AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, N
|
|||
|
||||
# Build plot grid.
|
||||
nrows, ncols = np.count_nonzero(self.has_atom), self.lsize
|
||||
ax_mat = None
|
||||
ax_mat, fig, plt = get_axarray_fig_plt(ax_mat, nrows=nrows, ncols=ncols,
|
||||
sharex=True, sharey=True, squeeze=False)
|
||||
ax_mat = np.reshape(ax_mat, (nrows, ncols))
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
import os
|
||||
import numpy as np
|
||||
|
||||
from collections import OrderedDict
|
||||
from monty.string import marquee # is_string, list_strings,
|
||||
from monty.string import marquee
|
||||
from monty.functools import lazy_property
|
||||
from monty.collections import dict2namedtuple
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -7,13 +7,13 @@ import pandas as pd
|
|||
import pymatgen.core.units as units
|
||||
import abipy.core.abinit_units as abu
|
||||
|
||||
from collections import OrderedDict, defaultdict
|
||||
from collections import OrderedDict
|
||||
from tabulate import tabulate
|
||||
from monty.string import is_string, list_strings, marquee
|
||||
from monty.string import list_strings, marquee
|
||||
from monty.termcolor import cprint
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from pymatgen.core.units import EnergyArray, ArrayWithUnit
|
||||
from pymatgen.core.units import ArrayWithUnit
|
||||
from pymatgen.entries.computed_entries import ComputedEntry, ComputedStructureEntry
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_axarray_fig_plt
|
||||
|
|
|
@ -6,11 +6,11 @@ import warnings
|
|||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from collections import namedtuple, OrderedDict, defaultdict
|
||||
from collections import namedtuple, OrderedDict
|
||||
from io import StringIO
|
||||
from tabulate import tabulate
|
||||
from monty.string import list_strings, is_string, marquee
|
||||
from monty.collections import AttrDict, dict2namedtuple
|
||||
from monty.collections import dict2namedtuple
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from monty.bisect import find_le, find_ge
|
||||
|
@ -19,7 +19,7 @@ from abipy.core.kpoints import Kpoint, KpointList, Kpath, IrredZone, has_timrev_
|
|||
from abipy.core.mixins import AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.iotools import ETSF_Reader
|
||||
from abipy.tools.plotting import (ArrayPlotter, add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt, Marker,
|
||||
set_axlims, set_visible, rotate_ticklabels, ax_append_title)
|
||||
set_axlims, set_visible, rotate_ticklabels)
|
||||
from abipy.tools import duck
|
||||
from abipy.abio.robots import Robot
|
||||
from abipy.electrons.ebands import ElectronBands, RobotWithEbands
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
# coding: utf-8
|
||||
"""Objects to analyze the screening files produced by the GW code (optdriver 3)."""
|
||||
import numpy as np
|
||||
import abc
|
||||
import pymatgen.core.units as pmgu
|
||||
|
||||
from monty.string import marquee # is_string, list_strings,
|
||||
from monty.string import marquee
|
||||
from monty.inspect import all_subclasses
|
||||
from monty.termcolor import cprint
|
||||
from monty.collections import AttrDict
|
||||
from monty.functools import lazy_property
|
||||
from monty.bisect import index as bs_index
|
||||
from abipy.core.func1d import Function1D
|
||||
from abipy.core.kpoints import Kpoint, KpointList
|
||||
from abipy.core.kpoints import KpointList
|
||||
from abipy.core.gsphere import GSphere
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, NotebookWriter
|
||||
from abipy.electrons.ebands import ElectronBands
|
||||
from abipy.iotools import ETSF_Reader
|
||||
from abipy.tools.plotting import ArrayPlotter, plot_array, data_from_cplx_mode, add_fig_kwargs, get_ax_fig_plt, set_axlims
|
||||
from abipy.tools.plotting import ArrayPlotter, data_from_cplx_mode, add_fig_kwargs, get_ax_fig_plt, set_axlims
|
||||
from abipy.tools import duck
|
||||
|
||||
import logging
|
||||
|
|
|
@ -1188,6 +1188,7 @@ class A2fRobot(Robot, RobotWithEbands, RobotWithPhbands):
|
|||
if hue is None:
|
||||
params_are_string = duck.is_string(params[0])
|
||||
xvals = params if not params_are_string else range(len(params))
|
||||
l = None
|
||||
for iq, qsamp in enumerate(qsamps):
|
||||
a2f_list = [ncfile.get_a2f_qsamp(qsamp) for ncfile in ncfiles]
|
||||
yvals = [getattr(a2f, what) for a2f in a2f_list]
|
||||
|
|
|
@ -4,10 +4,7 @@ Objects to plot electronic, vibrational and e-ph properties.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from monty.string import marquee, list_strings
|
||||
from monty.termcolor import cprint
|
||||
from abipy.tools.plotting import (add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt, set_axlims, set_visible,
|
||||
rotate_ticklabels, ax_append_title, set_ax_xylabels, ax_share)
|
||||
from abipy.tools.plotting import (add_fig_kwargs, get_axarray_fig_plt, set_axlims, set_visible, ax_share)
|
||||
from abipy.tools import duck
|
||||
from abipy.electrons.ebands import ElectronBands
|
||||
from abipy.dfpt.ddb import DdbFile
|
||||
|
|
|
@ -8,7 +8,6 @@ import abipy.core.abinit_units as abu
|
|||
from collections import OrderedDict
|
||||
from monty.string import marquee
|
||||
from monty.functools import lazy_property
|
||||
from monty.termcolor import cprint
|
||||
from abipy.core.kpoints import Kpoint
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
|
@ -546,6 +545,7 @@ class GkqRobot(Robot, RobotWithEbands):
|
|||
"""
|
||||
nbformat, nbv, nb = self.get_nbformat_nbv_nb(title=None)
|
||||
|
||||
args = [(l, f.filepath) for l, f in self.items()]
|
||||
nb.cells.extend([
|
||||
#nbv.new_markdown_cell("# This is a markdown cell"),
|
||||
nbv.new_code_cell("robot = abilab.GkqRobot(*%s)\nrobot.trim_paths()\nrobot" % str(args)),
|
||||
|
|
|
@ -27,7 +27,7 @@ from abipy.tools.plotting import (add_fig_kwargs, get_ax_fig_plt, get_axarray_fi
|
|||
rotate_ticklabels, ax_append_title, set_ax_xylabels, linestyles)
|
||||
from abipy.tools import gaussian, duck
|
||||
from abipy.electrons.ebands import ElectronBands, ElectronDos, RobotWithEbands, ElectronBandsPlotter, ElectronDosPlotter
|
||||
from abipy.dfpt.phonons import PhononDos # PhononBands, RobotWithPhbands, factor_ev2units, unit_tag, dos_label_from_units
|
||||
#from abipy.dfpt.phonons import PhononDos # PhononBands, RobotWithPhbands, factor_ev2units, unit_tag, dos_label_from_units
|
||||
from abipy.abio.robots import Robot
|
||||
from abipy.eph.common import BaseEphReader
|
||||
|
||||
|
|
|
@ -53,47 +53,6 @@ class TransportFile(AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands,
|
|||
od = self.get_ebands_params()
|
||||
return od
|
||||
|
||||
# These methods are related to the old Bolztrap2 interface
|
||||
def get_transport_result(self,itemp=None,el_temp=300):
|
||||
"""
|
||||
Get one instance of TransportResult according to a temperature
|
||||
|
||||
Args:
|
||||
itemp: the index of the temperature from which to create the TransportResult class
|
||||
if None, read the transport value without tau
|
||||
el_temp: temperature to use in the Fermi integrations
|
||||
"""
|
||||
reader = self.reader
|
||||
wmesh, dos, idos = reader.read_dos()
|
||||
|
||||
if itemp is None:
|
||||
wmesh, vvdos = reader.read_vvdos()
|
||||
tau_temp = None
|
||||
else:
|
||||
wmesh, vvdos = reader.read_vvdos_tau(itemp)
|
||||
tau_temp = reader.tmesh[itemp]
|
||||
el_temp = tau_temp
|
||||
|
||||
# TODO spin
|
||||
#self.nsppol
|
||||
dos = dos[0]
|
||||
vvdos = vvdos[:,:,0]
|
||||
|
||||
volume_b3 = self.structure.volume * abu.Ang_Bohr**3
|
||||
fermi_ha = self.ebands.fermie * abu.eV_Ha
|
||||
tr = TransportResult(wmesh,wmesh,dos,vvdos,fermi_ha,el_temp,volume_b3,self.nelect,
|
||||
tau_temp=tau_temp,nsppol=reader.nsppol)
|
||||
tr._L0,tr._L1,tr._L2 = reader.read_onsager(itemp)
|
||||
tr._sigma,tr._seebeck,tr._kappa,_ = reader.read_transport(itemp)
|
||||
return tr
|
||||
|
||||
def get_all_transport_results(self):
|
||||
"""
|
||||
Return multiple instances of TransportResults from the data in the TRANSPORT.nc file
|
||||
"""
|
||||
results = [self.get_transport_result(itemp=itemp) for itemp in list(range(self.ntemp))]
|
||||
return TransportResultRobot(results)
|
||||
|
||||
@add_fig_kwargs
|
||||
def plot_dos(self, ax=None, **kwargs):
|
||||
"""
|
||||
|
|
|
@ -7,7 +7,7 @@ import numpy as np
|
|||
from collections import OrderedDict
|
||||
from monty.string import list_strings, marquee
|
||||
from monty.functools import lazy_property
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt, linestyles
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Structure, NotebookWriter
|
||||
from abipy.core.kpoints import Kpath
|
||||
from abipy.abio.robots import Robot
|
||||
|
@ -370,6 +370,7 @@ class V1qAvgRobot(Robot):
|
|||
"""
|
||||
nbformat, nbv, nb = self.get_nbformat_nbv_nb(title=None)
|
||||
|
||||
args = [(l, f.filepath) for l, f in self.items()]
|
||||
nb.cells.extend([
|
||||
#nbv.new_markdown_cell("# This is a markdown cell"),
|
||||
nbv.new_code_cell("robot = abilab.V1qAvgRobot(*%s)\nrobot.trim_paths()\nrobot" % str(args)),
|
||||
|
|
|
@ -7,7 +7,7 @@ import numpy as np
|
|||
from collections import OrderedDict
|
||||
from monty.string import marquee
|
||||
from monty.functools import lazy_property
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Structure, NotebookWriter
|
||||
from abipy.core.kpoints import KpointList, Kpoint
|
||||
from abipy.tools import duck
|
||||
|
|
|
@ -37,10 +37,9 @@ class V1symFile(AbinitNcFile, Has_Structure, NotebookWriter):
|
|||
"""
|
||||
Determine the symmetrical perturbations. Meaning of pertsy:
|
||||
|
||||
0 for non-target perturbations.
|
||||
1 for basis perturbations.
|
||||
-1 for perturbations that can be found from basis perturbations.
|
||||
|
||||
0 for non-target perturbations.
|
||||
1 for basis perturbations.
|
||||
-1 for perturbations that can be found from basis perturbations.
|
||||
"""
|
||||
# Fortran array: nctkarr_t("pertsy_qpt", "int", "three, mpert, nqpt")))
|
||||
return self.reader.read_value("pertsy_qpt")
|
||||
|
|
|
@ -10,7 +10,6 @@ from __future__ import print_function, division, unicode_literals, absolute_impo
|
|||
|
||||
import sys
|
||||
import os
|
||||
import numpy as np
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
|
|
|
@ -16,7 +16,7 @@ import abipy.flowtk as flowtk
|
|||
|
||||
def make_scf_nscf_inputs(paral_kgb=0, usepaw=0):
|
||||
"""Returns two input files: GS run and NSCF on a high symmetry k-mesh."""
|
||||
pseudos = abidata.pseudos("14si.pspnc") if usepaw == 0 else data.pseudos("Si.GGA_PBE-JTH-paw.xml")
|
||||
pseudos = abidata.pseudos("14si.pspnc") if usepaw == 0 else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
|
||||
|
||||
# Get structure from cif file.
|
||||
multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"), pseudos=pseudos, ndtset=2)
|
||||
|
|
|
@ -10,7 +10,6 @@ from __future__ import division, print_function, unicode_literals, absolute_impo
|
|||
|
||||
import sys
|
||||
import os
|
||||
import numpy as np
|
||||
|
||||
import abipy.abilab as abilab
|
||||
import abipy.data as data
|
||||
|
|
|
@ -10,7 +10,7 @@ from __future__ import division, print_function
|
|||
|
||||
from abipy import abilab
|
||||
import abipy.data as abidata
|
||||
import numpy as np
|
||||
|
||||
|
||||
with abilab.abiopen(abidata.ref_file("h6_FOLD2BLOCH.nc")) as ncfile:
|
||||
print(ncfile)
|
||||
|
|
|
@ -7,7 +7,7 @@ from pymatgen.io.abinit.pseudos import Pseudo, PseudoTable, PseudoParser
|
|||
from pymatgen.io.abinit.netcdf import NetcdfReader
|
||||
from .launcher import PyFlowScheduler, PyLauncher
|
||||
from .qadapters import show_qparams, all_qtypes
|
||||
from .wrappers import Mrgscr, Mrgddb, Mrggkk, Cut3D, Fold2Bloch
|
||||
from .wrappers import Mrgscr, Mrgddb, Cut3D, Fold2Bloch
|
||||
from .nodes import Status
|
||||
from .tasks import *
|
||||
from .tasks import EphTask, ElasticTask
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# coding: utf-8
|
||||
"""Work subclasses related to DFTP."""
|
||||
|
||||
import numpy as np
|
||||
|
||||
from .works import Work, MergeDdb
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import abc
|
|||
import logging
|
||||
import numpy as np
|
||||
|
||||
from monty.string import indent, is_string, list_strings
|
||||
from monty.string import indent, is_string
|
||||
from monty.fnmatch import WildCard
|
||||
from monty.termcolor import colored
|
||||
from monty.inspect import all_subclasses
|
||||
|
|
|
@ -10,10 +10,10 @@ import time
|
|||
import collections
|
||||
import warnings
|
||||
import shutil
|
||||
import copy
|
||||
import tempfile
|
||||
import numpy as np
|
||||
|
||||
from io import StringIO
|
||||
from pprint import pprint
|
||||
from tabulate import tabulate
|
||||
from pydispatch import dispatcher
|
||||
|
@ -30,14 +30,12 @@ from pymatgen.util.serialization import pmg_pickle_load, pmg_pickle_dump, pmg_se
|
|||
from pymatgen.core.units import Memory
|
||||
from pymatgen.util.io_utils import AtomicFile
|
||||
from pymatgen.util.plotting import add_fig_kwargs, get_ax_fig_plt
|
||||
|
||||
from abipy.flowtk import wrappers
|
||||
from .nodes import Status, Node, NodeError, NodeResults, Dependency, GarbageCollector, check_spectator
|
||||
from .tasks import ScfTask, DdkTask, DdeTask, TaskManager, FixQueueCriticalError
|
||||
from .tasks import ScfTask, TaskManager, FixQueueCriticalError
|
||||
from .utils import File, Directory, Editor
|
||||
from pymatgen.io.abinit.abiinspect import yaml_read_irred_perts
|
||||
from .works import NodeContainer, Work, BandStructureWork, PhononWork, BecWork, G0W0Work, QptdmWork, DteWork
|
||||
from .events import EventsParser # autodoc_event_handlers
|
||||
from .events import EventsParser
|
||||
|
||||
|
||||
import logging
|
||||
|
@ -54,7 +52,6 @@ __all__ = [
|
|||
"G0W0WithQptdmFlow",
|
||||
"bandstructure_flow",
|
||||
"g0w0_flow",
|
||||
#"phonon_flow",
|
||||
]
|
||||
|
||||
|
||||
|
@ -1894,16 +1891,6 @@ class Flow(Node, NodeContainer, MSONable):
|
|||
|
||||
return self
|
||||
|
||||
#def new_from_input_decorators(self, new_workdir, decorators)
|
||||
# """
|
||||
# Return a new :class:`Flow` in which all the Abinit inputs have been
|
||||
# decorated by decorators.
|
||||
# """
|
||||
# # The trick part here is how to assign a new id to the new nodes while maintaing the
|
||||
# # correct dependencies! The safest approach would be to pass through __init__
|
||||
# # instead of using copy.deepcopy()
|
||||
# return flow
|
||||
|
||||
def show_dependencies(self, stream=sys.stdout):
|
||||
"""Writes to the given stream the ASCII representation of the dependency tree."""
|
||||
def child_iter(node):
|
||||
|
@ -2883,177 +2870,3 @@ class NonLinearCoeffFlow(Flow):
|
|||
print("retcode", retcode)
|
||||
#if retcode != 0: return retcode
|
||||
return retcode
|
||||
|
||||
|
||||
#def phonon_flow(workdir, scf_input, ph_inputs, with_nscf=False, with_ddk=False, with_dde=False,
|
||||
# manager=None, flow_class=PhononFlow, allocate=True):
|
||||
# """
|
||||
# Build a :class:`PhononFlow` for phonon calculations.
|
||||
#
|
||||
# Args:
|
||||
# workdir: Working directory.
|
||||
# scf_input: Input for the GS SCF run.
|
||||
# ph_inputs: List of Inputs for the phonon runs.
|
||||
# with_nscf: add an nscf task in front of al phonon tasks to make sure the q point is covered
|
||||
# with_ddk: add the ddk step
|
||||
# with_dde: add the dde step it the dde is set ddk is switched on automatically
|
||||
# manager: :class:`TaskManager` used to submit the jobs
|
||||
# Initialized from manager.yml if manager is None.
|
||||
# flow_class: Flow class
|
||||
#
|
||||
# Returns:
|
||||
# :class:`Flow` object
|
||||
# """
|
||||
# logger.critical("phonon_flow is deprecated and could give wrong results")
|
||||
# if with_dde:
|
||||
# with_ddk = True
|
||||
#
|
||||
# natom = len(scf_input.structure)
|
||||
#
|
||||
# # Create the container that will manage the different works.
|
||||
# flow = flow_class(workdir, manager=manager)
|
||||
#
|
||||
# # Register the first work (GS calculation)
|
||||
# # register_task creates a work for the task, registers it to the flow and returns the work
|
||||
# # the 0the element of the work is the task
|
||||
# scf_task = flow.register_task(scf_input, task_class=ScfTask)[0]
|
||||
#
|
||||
# # Build a temporary work with a shell manager just to run
|
||||
# # ABINIT to get the list of irreducible pertubations for this q-point.
|
||||
# shell_manager = flow.manager.to_shell_manager(mpi_procs=1)
|
||||
#
|
||||
# if with_ddk:
|
||||
# logger.info('add ddk')
|
||||
# # TODO
|
||||
# # MG Warning: be careful here because one should use tolde or tolwfr (tolvrs shall not be used!)
|
||||
# ddk_input = ph_inputs[0].deepcopy()
|
||||
# ddk_input.set_vars(qpt=[0, 0, 0], rfddk=1, rfelfd=2, rfdir=[1, 1, 1])
|
||||
# ddk_task = flow.register_task(ddk_input, deps={scf_task: 'WFK'}, task_class=DdkTask)[0]
|
||||
#
|
||||
# if with_dde:
|
||||
# logger.info('add dde')
|
||||
# dde_input = ph_inputs[0].deepcopy()
|
||||
# dde_input.set_vars(qpt=[0, 0, 0], rfddk=1, rfelfd=2)
|
||||
# dde_input_idir = dde_input.deepcopy()
|
||||
# dde_input_idir.set_vars(rfdir=[1, 1, 1])
|
||||
# dde_task = flow.register_task(dde_input, deps={scf_task: 'WFK', ddk_task: 'DDK'}, task_class=DdeTask)[0]
|
||||
#
|
||||
# if not isinstance(ph_inputs, (list, tuple)):
|
||||
# ph_inputs = [ph_inputs]
|
||||
#
|
||||
# for i, ph_input in enumerate(ph_inputs):
|
||||
# fake_input = ph_input.deepcopy()
|
||||
#
|
||||
# # Run abinit on the front-end to get the list of irreducible pertubations.
|
||||
# tmp_dir = os.path.join(workdir, "__ph_run" + str(i) + "__")
|
||||
# w = PhononWork(workdir=tmp_dir, manager=shell_manager)
|
||||
# fake_task = w.register(fake_input)
|
||||
#
|
||||
# # Use the magic value paral_rf = -1 to get the list of irreducible perturbations for this q-point.
|
||||
# abivars = dict(
|
||||
# paral_rf=-1,
|
||||
# rfatpol=[1, natom], # Set of atoms to displace.
|
||||
# rfdir=[1, 1, 1], # Along this set of reduced coordinate axis.
|
||||
# )
|
||||
#
|
||||
# fake_task.set_vars(abivars)
|
||||
# w.allocate()
|
||||
# w.start(wait=True)
|
||||
#
|
||||
# # Parse the file to get the perturbations.
|
||||
# try:
|
||||
# irred_perts = yaml_read_irred_perts(fake_task.log_file.path)
|
||||
# except Exception:
|
||||
# print("Error in %s" % fake_task.log_file.path)
|
||||
# raise
|
||||
#
|
||||
# logger.info(irred_perts)
|
||||
#
|
||||
# w.rmtree()
|
||||
#
|
||||
# # Now we can build the final list of works:
|
||||
# # One work per q-point, each work computes all
|
||||
# # the irreducible perturbations for a singe q-point.
|
||||
#
|
||||
# work_qpt = PhononWork()
|
||||
#
|
||||
# if with_nscf:
|
||||
# # MG: Warning this code assume 0 is Gamma!
|
||||
# nscf_input = copy.deepcopy(scf_input)
|
||||
# nscf_input.set_vars(kptopt=3, iscf=-3, qpt=irred_perts[0]['qpt'], nqpt=1)
|
||||
# nscf_task = work_qpt.register_nscf_task(nscf_input, deps={scf_task: "DEN"})
|
||||
# deps = {nscf_task: "WFQ", scf_task: "WFK"}
|
||||
# else:
|
||||
# deps = {scf_task: "WFK"}
|
||||
#
|
||||
# if with_ddk:
|
||||
# deps[ddk_task] = 'DDK'
|
||||
#
|
||||
# logger.info(irred_perts[0]['qpt'])
|
||||
#
|
||||
# for irred_pert in irred_perts:
|
||||
# #print(irred_pert)
|
||||
# new_input = ph_input.deepcopy()
|
||||
#
|
||||
# #rfatpol 1 1 # Only the first atom is displaced
|
||||
# #rfdir 1 0 0 # Along the first reduced coordinate axis
|
||||
# qpt = irred_pert["qpt"]
|
||||
# idir = irred_pert["idir"]
|
||||
# ipert = irred_pert["ipert"]
|
||||
#
|
||||
# # TODO this will work for phonons, but not for the other types of perturbations.
|
||||
# rfdir = 3 * [0]
|
||||
# rfdir[idir - 1] = 1
|
||||
# rfatpol = [ipert, ipert]
|
||||
#
|
||||
# new_input.set_vars(
|
||||
# #rfpert=1,
|
||||
# qpt=qpt,
|
||||
# rfdir=rfdir,
|
||||
# rfatpol=rfatpol,
|
||||
# )
|
||||
#
|
||||
# if with_ddk:
|
||||
# new_input.set_vars(rfelfd=3)
|
||||
#
|
||||
# work_qpt.register_phonon_task(new_input, deps=deps)
|
||||
#
|
||||
# flow.register_work(work_qpt)
|
||||
#
|
||||
# if allocate: flow.allocate()
|
||||
#
|
||||
# return flow
|
||||
#
|
||||
#
|
||||
#def phonon_conv_flow(workdir, scf_input, qpoints, params, manager=None, allocate=True):
|
||||
# """
|
||||
# Create a :class:`Flow` to perform convergence studies for phonon calculations.
|
||||
#
|
||||
# Args:
|
||||
# workdir: Working directory of the flow.
|
||||
# scf_input: :class:`AbinitInput` object defining a GS-SCF calculation.
|
||||
# qpoints: List of list of lists with the reduced coordinates of the q-point(s).
|
||||
# params:
|
||||
# To perform a converge study wrt ecut: params=["ecut", [2, 4, 6]]
|
||||
# manager: :class:`TaskManager` object responsible for the submission of the jobs.
|
||||
# If manager is None, the object is initialized from the yaml file
|
||||
# located either in the working directory or in the user configuration dir.
|
||||
# allocate: True if the flow should be allocated before returning.
|
||||
#
|
||||
# Return:
|
||||
# :class:`Flow` object.
|
||||
# """
|
||||
# qpoints = np.reshape(qpoints, (-1, 3))
|
||||
#
|
||||
# flow = Flow(workdir=workdir, manager=manager)
|
||||
#
|
||||
# for qpt in qpoints:
|
||||
# for gs_inp in scf_input.product(*params):
|
||||
# # Register the SCF task
|
||||
# work = flow.register_scf_task(gs_inp)
|
||||
#
|
||||
# # Add the PhononWork connected to this scf_task.
|
||||
# flow.register_work(PhononWork.from_scf_task(work[0], qpoints=qpt))
|
||||
#
|
||||
# if allocate: flow.allocate()
|
||||
# return flow
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: utf-8
|
||||
"""Work subclasses related to GS calculations."""
|
||||
import json
|
||||
import numpy as np
|
||||
|
||||
from .works import Work
|
||||
from abipy.core.structure import Structure
|
||||
|
|
|
@ -424,8 +424,8 @@ def check_spectator(node_method):
|
|||
node = args[0]
|
||||
if node.in_spectator_mode:
|
||||
#raise node.SpectatorError("You should not call this method when the node in spectator_mode")
|
||||
#warnings.warn("You should not call %s when the node in spectator_mode" % node_method)
|
||||
import warnings
|
||||
#warnings.warn("You should not call %s when the node in spectator_mode" % node_method)
|
||||
|
||||
return node_method(*args, **kwargs)
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ Tools and workflows for calculations within the quasi-harmonic approximation.
|
|||
|
||||
WARNING: This code is still under development.
|
||||
"""
|
||||
import os
|
||||
import numpy as np
|
||||
|
||||
from abipy.core.structure import Structure
|
||||
from abipy.abio.inputs import AbinitInput
|
||||
from abipy.flowtk.works import Work, RelaxWork, PhononWork, MergeDdb
|
||||
#from abipy.abio.inputs import AbinitInput
|
||||
from abipy.flowtk.works import Work, MergeDdb # RelaxWork, PhononWork,
|
||||
from abipy.flowtk.flows import Flow
|
||||
|
||||
import logging
|
||||
|
|
|
@ -25,7 +25,7 @@ from .utils import File, Directory, irdvars_for_ext, abi_splitext, FilepathFixer
|
|||
from .qadapters import make_qadapter, QueueAdapter, QueueAdapterError
|
||||
from . import qutils as qu
|
||||
from .db import DBConnector
|
||||
from .nodes import Status, Node, NodeError, NodeResults, NodeCorrections, FileNode, check_spectator
|
||||
from .nodes import Status, Node, NodeError, NodeResults, FileNode #, check_spectator
|
||||
from . import abiinspect
|
||||
from . import events
|
||||
from .abitimer import AbinitTimerParser
|
||||
|
@ -539,7 +539,6 @@ class TaskManager(MSONable):
|
|||
|
||||
@classmethod
|
||||
def autodoc(cls):
|
||||
from abipy.flowtk.db import DBConnector
|
||||
s = """
|
||||
# TaskManager configuration file (YAML Format)
|
||||
|
||||
|
@ -564,7 +563,6 @@ batch_adapter:
|
|||
"""
|
||||
s += "policy: " + TaskPolicy.autodoc() + "\n"
|
||||
s += "qadapter: " + QueueAdapter.autodoc() + "\n"
|
||||
#s += "db_connector: " + DBConnector.autodoc()
|
||||
return s
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -854,7 +854,7 @@ class SparseHistogram(object):
|
|||
if num is None and step is None:
|
||||
raise ValueError("Either num or step must be specified")
|
||||
|
||||
from collections import defaultdict, OrderedDict
|
||||
from collections import defaultdict
|
||||
|
||||
values = [key(item) for item in items] if key is not None else items
|
||||
start, stop = min(values), max(values)
|
||||
|
@ -933,11 +933,11 @@ class Dirviz(object):
|
|||
|
||||
# Add input attributes.
|
||||
if graph_attr is not None:
|
||||
fg.graph_attr.update(**graph_attr)
|
||||
g.graph_attr.update(**graph_attr)
|
||||
if node_attr is not None:
|
||||
fg.node_attr.update(**node_attr)
|
||||
g.node_attr.update(**node_attr)
|
||||
if edge_attr is not None:
|
||||
fg.edge_attr.update(**edge_attr)
|
||||
g.edge_attr.update(**edge_attr)
|
||||
|
||||
def node_kwargs(path):
|
||||
return dict(
|
||||
|
|
|
@ -19,7 +19,6 @@ __date__ = "$Feb 21, 2013M$"
|
|||
|
||||
__all__ = [
|
||||
"Mrgscr",
|
||||
"Mrggkk",
|
||||
"Mrgddb",
|
||||
"Mrgdvdb",
|
||||
]
|
||||
|
@ -144,68 +143,6 @@ class Mrgscr(ExecWrapper):
|
|||
self.execute(workdir)
|
||||
|
||||
|
||||
class Mrggkk(ExecWrapper):
|
||||
_name = "mrggkk"
|
||||
|
||||
def merge(self, workdir, gswfk_file, dfpt_files, gkk_files, out_gkk, binascii=0):
|
||||
"""
|
||||
Merge GGK files, return the absolute path of the new database.
|
||||
|
||||
Args:
|
||||
gswfk_file: Ground-state WFK filename
|
||||
dfpt_files: List of 1WFK files to merge.
|
||||
gkk_files: List of GKK files to merge.
|
||||
out_gkk: Name of the output GKK file
|
||||
binascii: Integer flat. 0 --> binary output, 1 --> ascii formatted output
|
||||
"""
|
||||
raise NotImplementedError("This method should be tested")
|
||||
#out_gkk = out_gkk if cwd is None else os.path.join(os.path.abspath(cwd), out_gkk)
|
||||
|
||||
# We work with absolute paths.
|
||||
gswfk_file = os.path.absath(gswfk_file)
|
||||
dfpt_files = [os.path.abspath(s) for s in list_strings(dfpt_files)]
|
||||
gkk_files = [os.path.abspath(s) for s in list_strings(gkk_files)]
|
||||
|
||||
print("Will merge %d 1WF files, %d GKK file in output %s" %
|
||||
(len(dfpt_files), len(gkk_files), out_gkk))
|
||||
|
||||
if self.verbose:
|
||||
for i, f in enumerate(dfpt_files): print(" [%d] 1WF %s" % (i, f))
|
||||
for i, f in enumerate(gkk_files): print(" [%d] GKK %s" % (i, f))
|
||||
|
||||
self.stdin_fname, self.stdout_fname, self.stderr_fname = \
|
||||
map(os.path.join, 3 * [workdir], ["mrggkk.stdin", "mrggkk.stdout", "mrggkk.stderr"])
|
||||
|
||||
inp = StringIO()
|
||||
inp.write(out_gkk + "\n") # Name of the output file
|
||||
inp.write(str(binascii) + "\n") # Integer flag: 0 --> binary output, 1 --> ascii formatted output
|
||||
inp.write(gswfk_file + "\n") # Name of the groud state wavefunction file WF
|
||||
|
||||
#dims = len(dfpt_files, gkk_files, ?)
|
||||
dims = " ".join([str(d) for d in dims])
|
||||
inp.write(dims + "\n") # Number of 1WF, of GKK files, and number of 1WF files in all the GKK files
|
||||
|
||||
# Names of the 1WF files...
|
||||
for fname in dfpt_files:
|
||||
inp.write(fname + "\n")
|
||||
|
||||
# Names of the GKK files...
|
||||
for fname in gkk_files:
|
||||
inp.write(fname + "\n")
|
||||
|
||||
self.stdin_data = [s for s in inp.getvalue()]
|
||||
|
||||
with open(self.stdin_fname, "w") as fh:
|
||||
fh.writelines(self.stdin_data)
|
||||
# Force OS to write data to disk.
|
||||
fh.flush()
|
||||
os.fsync(fh.fileno())
|
||||
|
||||
self.execute(workdir)
|
||||
|
||||
return out_gkk
|
||||
|
||||
|
||||
class Mrgddb(ExecWrapper):
|
||||
_name = "mrgddb"
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Integration tests for BSE flows."""
|
||||
import pytest
|
||||
#import pytest
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
|
||||
from abipy.core.testing import has_abinit, has_matplotlib
|
||||
#from abipy.core.testing import has_abinit, has_matplotlib
|
||||
|
||||
# TODO
|
||||
#def itest_bse_with_mdf(fwp, tvars):
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
"""Integration tests for GW flows."""
|
||||
|
||||
import pytest
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
|
||||
from abipy.core.testing import has_abinit, has_matplotlib
|
||||
#from abipy.core.testing import has_abinit, has_matplotlib
|
||||
|
||||
|
||||
def make_g0w0_inputs(ngkpt, tvars):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
import sys
|
||||
import os
|
||||
import pytest
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
"""Integration tests for structural relaxations."""
|
||||
|
||||
import pytest
|
||||
import numpy as np
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
|
||||
from abipy.core.testing import has_abinit, has_matplotlib
|
||||
from abipy.core.testing import has_matplotlib
|
||||
|
||||
|
||||
def ion_relaxation(tvars, ntime=50):
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
"""Integration tests for the scheduler."""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import numpy as np
|
||||
|
||||
from pymatgen.core.units import Energy, EnergyArray, ArrayWithUnit
|
||||
from pymatgen.core.units import Energy, EnergyArray #, ArrayWithUnit
|
||||
from abipy.tools import transpose_last3dims, add_periodic_replicas
|
||||
|
||||
|
||||
|
|
|
@ -4,11 +4,9 @@ Interface to the database of ABINIT input variables
|
|||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import abipy.flowtk as flowtk
|
||||
|
||||
from pprint import pprint
|
||||
from monty.functools import prof_main
|
||||
from monty.termcolor import cprint
|
||||
from abipy.core.release import __version__
|
||||
|
|
|
@ -7,9 +7,7 @@ Alternatively, it is possible to generate automatically a jupyter notebook to ex
|
|||
"""
|
||||
import sys
|
||||
import os
|
||||
import io
|
||||
import argparse
|
||||
import tempfile
|
||||
|
||||
from monty.os.path import which
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -9,7 +9,6 @@ import numpy as np
|
|||
|
||||
from pprint import pprint
|
||||
from tabulate import tabulate
|
||||
from warnings import warn
|
||||
from monty.string import marquee
|
||||
from monty.functools import prof_main
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -6,7 +6,6 @@ or convert data from Abinit files (usually netcdf) to other formats.
|
|||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import numpy as np
|
||||
|
||||
from monty.functools import prof_main
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"""This module provides functions to compute integrals of Bessel functions."""
|
||||
import numpy as np
|
||||
|
||||
from collections import deque
|
||||
from scipy.special import spherical_jn
|
||||
from scipy.interpolate import UnivariateSpline
|
||||
from scipy.integrate import simps # cumtrapz, quad
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
Python interface to fftprof. Provides objects to benchmark
|
||||
the FFT libraries used by ABINIT and plot the results with matplotlib.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
import numpy as np
|
||||
|
@ -10,7 +9,7 @@ import numpy as np
|
|||
from subprocess import Popen, PIPE
|
||||
from monty.os.path import which
|
||||
from monty.fnmatch import WildCard
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt
|
||||
from abipy.tools.plotting import add_fig_kwargs
|
||||
|
||||
__all__ = [
|
||||
"FFTBenchmark",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: utf-8
|
||||
"""IO related utilities."""
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from subprocess import call
|
||||
from monty.termcolor import cprint
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: utf-8
|
||||
"""Numeric tools."""
|
||||
import numpy as np
|
||||
import bisect as bs
|
||||
|
||||
from monty.collections import dict2namedtuple
|
||||
from abipy.tools import duck
|
||||
|
@ -437,7 +436,7 @@ class BlochRegularGridInterpolator(object):
|
|||
frac_coords = np.reshape(frac_coords, (-1, 3))
|
||||
if cartesian:
|
||||
red_from_cart = self.structure.lattice.inv_matrix.T
|
||||
frac_coords = [np.dot(red_from, v) for v in frac_coords]
|
||||
frac_coords = [np.dot(red_from_cart, v) for v in frac_coords]
|
||||
|
||||
uc_coords = np.reshape(frac_coords, (-1, 3)) % 1
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import itertools
|
|||
import numpy as np
|
||||
|
||||
from collections import OrderedDict, namedtuple
|
||||
from monty.string import list_strings
|
||||
from monty.functools import lazy_property
|
||||
from pymatgen.util.plotting import add_fig_kwargs, get_ax_fig_plt, get_ax3d_fig_plt, get_axarray_fig_plt
|
||||
from .numtools import data_from_cplx_mode
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
# coding: utf-8
|
||||
"""This module contains the class describing a planewave wavefunction."""
|
||||
import tempfile
|
||||
import copy
|
||||
import itertools
|
||||
#import copy
|
||||
import numpy as np
|
||||
|
||||
from monty.termcolor import cprint
|
||||
from abipy.core import Mesh3D
|
||||
from abipy.core.kpoints import Kpoint
|
||||
#from abipy.core.kpoints import Kpoint
|
||||
from abipy.iotools import Visualizer
|
||||
from abipy.iotools.xsf import xsf_write_structure, xsf_write_data
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt
|
||||
|
@ -23,7 +21,7 @@ def latex_label_ispinor(ispinor, nspinor):
|
|||
return ""
|
||||
elif nspinor == 2:
|
||||
return {k: v.replace("myuparrow", "uparrow") for k, v in
|
||||
{0: r"$\sigma=\myuparrow$", 1: r"$\sigma=\downarrow$"}.items()}[ispden]
|
||||
{0: r"$\sigma=\myuparrow$", 1: r"$\sigma=\downarrow$"}.items()}[ispinor]
|
||||
else:
|
||||
raise ValueError("Wrong value for nspinor: %s" % nspinor)
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# coding: utf-8
|
||||
"""Wavefunction file."""
|
||||
import numpy as np
|
||||
#import numpy as np
|
||||
|
||||
from monty.functools import lazy_property
|
||||
from monty.string import marquee
|
||||
from abipy.core import Mesh3D, GSphere, Structure
|
||||
from abipy.core import Mesh3D, GSphere
|
||||
from abipy.core.mixins import AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands, NotebookWriter
|
||||
from abipy.iotools import ETSF_Reader, Visualizer
|
||||
from abipy.iotools import Visualizer
|
||||
from abipy.electrons.ebands import ElectronsReader
|
||||
from abipy.waves.pwwave import PWWaveFunction
|
||||
from abipy.tools import duck
|
||||
|
|
10
setup.cfg
10
setup.cfg
|
@ -17,7 +17,13 @@ exclude-dir=abipy/gui
|
|||
|
||||
[pycodestyle]
|
||||
count = True
|
||||
ignore = E116,E121,E122,E123,E124,E126,E128,E129,E131,E133,E201,E203,E226,E231,E241,E242,E261,E262,E265,E266,E306,E401,E402,E704,W503,W504,W505,E701,E702,E731,E741,W605
|
||||
max-line-length = 130
|
||||
statistics = True
|
||||
exclude=abipy/gui,abipy/abio/abivar_database,dev_scripts,docs,.ipynb_checkpoints,abipy/examples/flows/develop/,test_*.py,abipy/benchmarks,abipy/data/refs
|
||||
ignore = E116,E121,E122,E123,E124,E126,E128,E129,E131,E133,E201,E203,E226,E231,E241,E242,E261,E262,E265,E266,E306,E401,E402,E704,W503,W504,W505,E701,E702,E731,E741,W605
|
||||
exclude= .git,__pycache__,abipy/gui,abipy/abio/abivar_database,dev_scripts,docs,.ipynb_checkpoints,abipy/examples/flows/develop/,test_*.py,abipy/benchmarks,abipy/data/refs
|
||||
|
||||
[flake8]
|
||||
# max-complexity = 10
|
||||
max-line-length = 130
|
||||
exclude= .git,__pycache__,abipy/gui,abipy/abio/abivar_database,dev_scripts,docs,.ipynb_checkpoints,abipy/examples/flows/develop/,test_*.py,abipy/benchmarks,abipy/data/refs
|
||||
extend_ignore = E116,E121,E122,E123,E124,E126,E128,E129,E131,E133,E201,E203,E226,E231,E241,E242,E261,E262,E265,E266,E306,E401,E402,E704,W503,W504,W505,E701,E702,E731,E741,W605,F841
|
||||
|
|
Loading…
Reference in New Issue