diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e34beb9..38882ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 - name: Set up Python @@ -29,6 +29,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Lint with flake8 + if: ${{ matrix.python-version != '3.7' }} run: | flake8 qeschema --max-line-length=100 --statistics - name: Run tests diff --git a/README.rst b/README.rst index 755c778..d8541e1 100644 --- a/README.rst +++ b/README.rst @@ -60,10 +60,10 @@ Loaded data can be decoded to Python data dictionary or written to JSON or YAML Authors ------- -Davide Brunato -Pietro Delugas -Giovanni Borghi -Alexandr Fonari +* Davide Brunato +* Pietro Delugas +* Giovanni Borghi +* Alexandr Fonari License diff --git a/docs/conf.py b/docs/conf.py index 1084625..ea48291 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,11 +18,11 @@ # -- Project information ----------------------------------------------------- project = 'qeschema' -copyright = '2015-2022, Quantum Espresso Foundation and SISSA' +copyright = '2015-2023, Quantum Espresso Foundation and SISSA' author = 'Davide Brunato, Pietro Delugas' # The full version, including alpha/beta/rc tags -release = '1.4.0' +release = '1.5.0' # -- General configuration --------------------------------------------------- diff --git a/qeschema/__init__.py b/qeschema/__init__.py index 60707c1..5110e2f 100644 --- a/qeschema/__init__.py +++ b/qeschema/__init__.py @@ -8,18 +8,20 @@ # Authors: Davide Brunato # from .documents import XmlDocument, QeDocument, PwDocument, PhononDocument, \ - NebDocument, TdDocument, TdSpectrumDocument, XSpectraDocument -from .converters import RawInputConverter, PwInputConverter, PhononInputConverter, \ - NebInputConverter, TdInputConverter, TdSpectrumInputConverter, XSpectraInputConverter + NebDocument, TdDocument, TdSpectrumDocument, XSpectraDocument, EPWDocument +from .converters import RawInputConverter, PwInputConverter, \ + PhononInputConverter, NebInputConverter, TdInputConverter, \ + TdSpectrumInputConverter, XSpectraInputConverter, EPWInputConverter from .exceptions import QESchemaError, XmlDocumentError from .utils import set_logger -__version__ = '1.4.0' +__version__ = '1.5.0' __all__ = [ 'XmlDocument', 'QeDocument', 'PwDocument', 'PhononDocument', 'NebDocument', - 'TdDocument', 'TdSpectrumDocument', 'RawInputConverter', 'PwInputConverter', - 'PhononInputConverter', 'TdInputConverter', 'TdSpectrumInputConverter', - 'NebInputConverter', 'QESchemaError', 'XmlDocumentError', 'set_logger', 'hdf5', - 'XSpectraDocument', 'XSpectraInputConverter' + 'TdDocument', 'TdSpectrumDocument', 'EPWDocument', 'RawInputConverter', + 'PwInputConverter', 'PhononInputConverter', 'TdInputConverter', + 'TdSpectrumInputConverter', 'NebInputConverter', 'QESchemaError', + 'XmlDocumentError', 'set_logger', 'hdf5', 'XSpectraDocument', + 'XSpectraInputConverter', 'EPWInputConverter' ] diff --git a/qeschema/cards.py b/qeschema/cards.py index 4b6fda2..53b6560 100644 --- a/qeschema/cards.py +++ b/qeschema/cards.py @@ -11,7 +11,6 @@ Conversion functions for Quantum Espresso cards. """ import logging -from typing import Union, List logger = logging.getLogger('qeschema') @@ -130,24 +129,19 @@ def get_atomic_constraints_card(name, **kwargs): :return: List of strings """ try: - num_of_constraints = kwargs['num_of_constraints'] - tolerance = kwargs['tolerance'] - atomic_constraints = kwargs['atomic_constraints'] + num_of_constraints = kwargs['atomic_constraints']['num_of_constraints'] + tolerance = kwargs['atomic_constraints']['tolerance'] + atomic_constraints = kwargs['atomic_constraints']['atomic_constraint'] except KeyError: logger.error("Missing required arguments when building CONSTRAINTS card!") return [] - lines = [name, '{0} {1}'.format(num_of_constraints, tolerance)] + lines = [name, f"{num_of_constraints} {tolerance}"] for constraint in atomic_constraints: - constr_parms = constraint['constr_parms'] # list with 4 float items - constr_parms.extend([0] * max(0, 4 - len(constr_parms))) + constr_parms = constraint['constr_parms'] # list with at most 4 float items constr_type = constraint['constr_type'] # string - constr_target = constraint['constr_target'] # float - lines.append('{0} {1} {2}'.format( - constr_type, - ' '.join([str(item) for item in constr_parms]), - constr_target - )) + constr_target = constraint.get('constr_target', "") # float or empty + lines.append(f"{constr_type} {' '.join([str(_) for _ in constr_parms])} {constr_target}") return lines @@ -195,6 +189,77 @@ def get_k_points_card(name, **kwargs): return lines +def get_hubbard_card(name, **kwargs): + """ + writes the hubbard card for new format + """ + try: + new_format = kwargs['dftU']['@new_format'] + except KeyError: + new_format = False + if not new_format: + return [] + try: + dftu = kwargs['dftU'] + except KeyError as err: + logger.error("Missing required argument %s when building " + "parameter %r", str(err), name) + return [] + + projtype = kwargs.get('U_projection_type', 'atomic') + lines = [f"{name} {projtype}"] + for tag in iter(['U', 'J0', 'alpha', 'beta']): + lines.extend(_hubbard_lines(dftu, tag)) + for tag in iter(['J', 'U2', 'V']): + lines.extend(_hubbard_special_lines(dftu, tag)) + return lines + + +def _hubbard_lines(dftu, tag): + related_data = dftu.get(f"Hubbard_{tag}", []) + lines = [] + for value in iter(related_data if isinstance(related_data, list) else [related_data]): + specie = value['@specie'] + label = value['@label'] + if label != 'no Hubbard': + lines.append(f"{tag} {specie}-{label} {value['$']:8.3f}") + return lines + + +def _hubbard_special_lines(dftu, tag): + related_data = dftu.get(f"Hubbard_{tag}", []) + llabels = ['s', 'p', 'd', 'f'] + lines = [] + for value in iter(related_data if isinstance(related_data, list) else [related_data]): + specie = value['@specie'] + label = value.get('@label', 'not found') + if label != 'no Hubbard': + if tag == 'J': + lines.append(f"J {specie}-{label} {value['$'][0]:8.3f}") + if 'd' in label: + lines.append(f"B {specie}-{label} {value['$'][1]:8.3f}") + elif 'f' in label: + lines.extend([f"E2 {specie}-{label} {value['$'][1]:8.3f}", + f"E3 {specie}-{label} {value['$'][2]:8.3f}"]) + elif tag == 'U2': + background = value['@background'] + if label == 'not found': + def labnl(nnum, lnum): + return f"{nnum}{llabels[lnum-1]}" + + label = labnl(value['n2_number'], value['l2_number']) + if 'two' in background: + label = f"{label}-{labnl(value['n3_number'],value['l3_number'])}" + lines.append(f"U {specie}-{label} {value['$']:8.3f}") + elif tag == 'V': + speclab1 = f"{value['@specie1']}-{value['@label1']}" + speclab2 = f"{value['@specie2']}-{value['@label2']}" + index1 = value['@index1'] + index2 = value['@index2'] + lines.append(f"{tag} {speclab1} {speclab2} {index1} {index2} {value['$']:8.3f}") + return lines + + def get_atomic_forces_card(name, **kwargs): """ Convert XML data to ATOMIC_FORCES card diff --git a/qeschema/converters.py b/qeschema/converters.py index 26294f7..daef2b8 100644 --- a/qeschema/converters.py +++ b/qeschema/converters.py @@ -23,7 +23,7 @@ FCP_NAMELIST = 'FCP' PH_NAT_TODO_CARD = 'ph_nat_todo_card' -OPTIONAL_CARDS = {PH_NAT_TODO_CARD} +OPTIONAL_CARDS = {PH_NAT_TODO_CARD, "CONSTRAINTS", "HUBBARD", "SOLVENTS"} def conversion_maps_builder(template_map): @@ -363,27 +363,42 @@ class PwInputConverter(RawInputConverter): 'ecutvcut': ('SYSTEM[ecutvcut]', options.ha2ry, None) }, 'dftU': { - 'lda_plus_u_kind': 'SYSTEM[lda_plus_u_kind]', + '@new_format': [('HUBBARD', cards.get_hubbard_card, None), + ('SYSTEM[lda_plus_u_kind]', options.set_lda_plus_u_kind, None), + ('SYSTEM[lda_plus_u]', options.set_lda_plus_u_flag, None), + ('SYSTEM[Hubbard_U]', options.get_specie_related_values, None), + ('SYSTEM[Hubbard_J]', options.get_specie_related_values, None), + ('SYSTEM[Hubbard_J0]', options.get_specie_related_values, None), + ('SYSTEM[Hubbard_alpha]', options.get_specie_related_values, None), + ('SYSTEM[Hubbard_beta]', options.get_specie_related_values, None), + ('SYSTEM[U_projection_type]', options.set_u_projection_type, None)], + 'lda_plus_u_kind': ('SYSTEM[lda_plus_u_kind]', options.set_lda_plus_u_kind, None), 'Hubbard_U': { '$': [('SYSTEM[Hubbard_U]', options.get_specie_related_values, None), + ('HUBBARD', cards.get_hubbard_card, None), ('SYSTEM[lda_plus_u]', options.set_lda_plus_u_flag, None)] }, 'Hubbard_J0': { - '$': ('SYSTEM[Hubbard_J0]', options.get_specie_related_values, None), + '$': [('SYSTEM[Hubbard_J0]', options.get_specie_related_values, None), + ('HUBBARD', cards.get_hubbard_card, None)] }, 'Hubbard_alpha': { - '$': ('SYSTEM[Hubbard_alpha]', options.get_specie_related_values, None), + '$': [('SYSTEM[Hubbard_alpha]', options.get_specie_related_values, None), + ('HUBBARD', cards.get_hubbard_card, None)] }, 'Hubbard_beta': { - '$': ('SYSTEM[Hubbard_beta]', options.get_specie_related_values, None), + '$': [('SYSTEM[Hubbard_beta]', options.get_specie_related_values, None), + ('HUBBARD', cards.get_hubbard_card, None)] }, 'Hubbard_J': { - '$': ('SYSTEM[Hubbard_J]', options.get_specie_related_values, None), + '$': [('SYSTEM[Hubbard_J]', options.get_specie_related_values, None), + ('HUBBARD', cards.get_hubbard_card, None)] }, 'starting_ns': { '$': ('SYSTEM[starting_ns_eigenvalue]', options.get_specie_related_values, None) }, - 'U_projection_type': 'SYSTEM[U_projection_type]', + 'U_projection_type': ('SYSTEM[U_projection_type]', + options.set_u_projection_type, None) }, 'vdW': { 'vdw_corr': 'SYSTEM[vdw_corr]', @@ -561,7 +576,7 @@ def __init__(self, **kwargs): input_namelists=('CONTROL', 'SYSTEM', 'ELECTRONS', 'IONS', 'CELL', FCP_NAMELIST), input_cards=('ATOMIC_SPECIES', 'ATOMIC_POSITIONS', 'K_POINTS', - 'CELL_PARAMETERS', 'ATOMIC_FORCES') + 'CELL_PARAMETERS', 'ATOMIC_FORCES', 'CONSTRAINTS', 'SOLVENTS', 'HUBBARD') ) if 'xml_file' in kwargs: self._input['CONTROL']['input_xml_schema_file'] = "{!r}".format( @@ -578,7 +593,7 @@ class PhononInputConverter(RawInputConverter): """ PHONON_TEMPLATE_MAP = { 'xq': { - '$': ('qPointsSpecs', cards.get_qpoints_card, None), + '$': ('qPointsSpecs', cards.get_qpoints_card, None), }, 'scf_ph': { 'tr2_ph': "INPUTPH[tr2_ph]", @@ -741,7 +756,7 @@ def __init__(self, **_kwargs): *conversion_maps_builder(self.NEB_TEMPLATE_MAP), input_namelists=('PATH', 'CONTROL', 'SYSTEM', 'ELECTRONS', 'IONS', 'CELL'), input_cards=('CLIMBING_IMAGES', 'ATOMIC_SPECIES', 'ATOMIC_POSITIONS', 'K_POINTS', - 'CELL_PARAMETERS', 'ATOMIC_FORCES') + 'CELL_PARAMETERS', 'ATOMIC_FORCES', 'CONSTRAINTS') ) def get_qe_input(self): @@ -851,9 +866,7 @@ def get_qe_input(self): Overrides superclass get_qe_input with use_defaults set to False. :return: the input as obtained from its input builder """ - temp = super(TdInputConverter, self).get_qe_input().split('\n') - for i, j in enumerate(temp): - print(i, " - ", j) + temp = super().get_qe_input().split('\n') td = temp[1] start = temp.index('&lr_input') end = start + temp[start:].index('/') @@ -985,3 +998,107 @@ def __init__(self, **_kwargs): input_namelists=('input_xspectra', 'plot', 'pseudos', 'cut_occ'), input_cards=("K_POINTS",) ) + + +class EPWInputConverter(RawInputConverter): + """ + converts the XML input file for EPW to the namelist format + expected by epw.x + """ + EPW_TEMPLATE_MAP = { + 'control_variables': { + 'prefix': "inputepw[prefix]", + 'outdir': "inputepw[outdir]", + 'iverbosity': "inputepw[iverbosity]", + 'dvscf_dir': "inputepw[dvscf_dir]", + 'filukk': "inputepw[filukk]", + 'elph': "inputepw[elph]", + 'ep_coupling': "inputepw[ep_coupling]", + 'elecselfen': "inputepw[elecselfen]", + 'phonselfen': "inputepw[phonselfen]", + 'lindabs': "inputepw[lindabs]", + 'band_plot': "inputepw[band_plot]", + 'fermi_plot': "inputepw[fermi_plot]", + 'cumulant': "inputepw[cumulant]", + 'prtgkk': "inputepw[prtgkk]", + 'epbread': "inputepw[epbread]", + 'epbwrite': "inputepw[epbwrite]", + 'epwread': "inputepw[epwread]", + 'epwwrite': "inputepw[epwwrite]", + 'ephwrite': "inputepw[ephwrite]", + 'eig_read': "inputepw[eig_read]", + 'delta_approx': "inputepw[delta_approx]", + 'eps_acustic': "inputepw[eps_acustic]", + 'etf_mem': "inputepw[etcmem]", + 'nbndsub': "inputepw[nbndsub]", + 'nq1': "inputepw[nq1]", + 'nq2': "inputepw[nq2]", + 'nq3': "inputepw[nq3]", + 'nk1': "inputepw[nk1]", + 'nk2': "inputepw[nk2]", + 'nk3': "inputepw[nk3]", + 'nqf1': "inputepw[nqf1]", + 'nqf2': "inputepw[nqf2]", + 'nqf3': "inputepw[nqf3]", + 'nkf1': "inputepw[nkf1]", + 'nkf2': "inputepw[nkf2]", + 'nkf3': "inputepw[nkf3]", + 'mp_mesh_k': "inputepw[mp_mesh_k]", + 'filqf': "inputepw[filqf]", + 'filkf': "inputepw[filkf]", + 'vme': "inputepw[vme]", + 'degaussw': "inputepw[degaussw]", + 'degaussq': "inputepw[degaussq]", + 'fsthick': "inputepw[fsthick]", + 'ngaussw': "inputepw[ngaussw]", + 'nsmear': "inputepw[nsmear]", + 'delta_smear': "inputepw[delta_smear]", + 'restart': "inputepw[restart]", + 'restart_step': "inputepw[restart_step]", + 'scissor': "inputepw[scissor]", + 'lphase': "inputepw[lphase]", + 'lpolar': "inputepw[lpolar]", + 'efermi_read': "inputepw[efermi_read]", + 'fermi_energy': "inputepw[fermi_energy]", + 'lscreen': "inputepw[lscreen]", + 'scr_typ': "inputepw[scr_typ]", + 'fermi_diff': "inputepw[fermi_diff]", + 'smear_rpa': "inputepw[smear_rpa]", + 'lifc': "inputepw[lifc]", + 'asr_typ': "inputepw[asr_typ]", + 'wannierize': "inputepw[wannierize]", + 'amass': {'$': ("inputepw[amass]", options.set_one_amass_line, None)} + }, + 'wannier90': { + 'num_iter': "inputepw[num_iter]", + 'dis_win_max': "inputepw[dis_win_max]", + 'dis_win_min': "inputepw[dis_win_min]", + 'dis_froz_min': "inputepw[dis_froz_min]", + 'dis_froz_max': "inputepw[dis_frox_max]", + 'proj': {'$': ("inputepw[proj]", options.set_one_proj_line, None)}, + 'bands_skipped': "inputepw[bands_skipped]", + 'iprint': "inputepw[iprint]", + 'wannier_plot': ["inputepw[wannier_plot]", + ("inputepw[wdata]", options.set_wdata_lines, None) + ], + 'wannier_plot_supercell': "inputepw[wannier_plot_supercell]", + 'wannier_plot_scale': "inputepw[wannier_plot_scale]", + 'wannier_plot_radius': "inputepw[wannier_plot_radius]", + 'wannier_plot_list': {'@segment': ("inputepw[wdata]", + options.set_wdata_lines, None)}, + 'wannier_plot_format': ('inputepw[wdata]', + options.set_wdata_lines, None), + 'use_ws': ("inputepw[wdata]", options.set_wdata_lines, None), + 'reduce_unk': "inputepw[reduce_unk]", + 'scdm_proj': "inputepw[scdm_proj]", + 'scdm_sigma': "inputepw[scdm_sigma]", + 'auto_projections': "inputepw[auto_projections]", + 'scdm_entanglement': "inputepw[scdm_entaglement]", + 'scdm_mu': "inputepw[scdm_mu]", + } + } + + def __init__(self, **kwargs): + super().__init__(*conversion_maps_builder(self.EPW_TEMPLATE_MAP), + input_namelists=['inputepw'], + input_cards=[]) diff --git a/qeschema/documents.py b/qeschema/documents.py index 2f9c8cb..281b599 100644 --- a/qeschema/documents.py +++ b/qeschema/documents.py @@ -14,7 +14,8 @@ from functools import wraps from xml.etree import ElementTree import xmlschema -from xmlschema.etree import etree_tostring +from xmlschema import etree_tostring + try: import yaml @@ -24,7 +25,7 @@ from .namespaces import XSD_NAMESPACE from .converters import RawInputConverter, PwInputConverter, PhononInputConverter, \ NebInputConverter, TdInputConverter, TdSpectrumInputConverter, \ - XSpectraInputConverter + XSpectraInputConverter, EPWInputConverter from .exceptions import XmlDocumentError from .utils import etree_iter_path @@ -447,7 +448,8 @@ def __init__(self, source=None, schema=None, input_builder=None): self.input_builder = input_builder self.default_namespace = self.schema.target_namespace - qe_prefixes = ['qes', 'neb', 'qes_ph', 'qes_lr', 'qes_spectrum', 'qes_xspectra'] + qe_prefixes = ['qes', 'neb', 'qes_ph', 'qes_lr', 'qes_spectrum', + 'qes_xspectra', 'epw'] qe_nslist = list(map(self.schema.namespaces.get, qe_prefixes)) if self.default_namespace not in qe_nslist: raise NotImplementedError( @@ -713,3 +715,27 @@ class XSpectraDocument(QeDocument): @property def input_path(self): return 'input' + + +class EPWDocument(QeDocument): + """ + class to manage EPW XML documents + """ + DEFAULT_SCHEMA = 'epw.xsd' + DEFAULT_INPUT_BUILDER = EPWInputConverter + + @property + def input_path(self): + return 'input' + + def get_fortran_input(self, use_defaults=False): + """overrides get_fortran_input adding title-line on top and + and setting *use_defaults* optional argument to false + """ + path = './input/control_variables/title' + element = self.find(path) + if element is not None: + title = str(element.text) + else: + title = "---" + return "\n".join([title, super().get_fortran_input(use_defaults)]) diff --git a/qeschema/options.py b/qeschema/options.py index 35b0393..e3227b9 100644 --- a/qeschema/options.py +++ b/qeschema/options.py @@ -33,6 +33,14 @@ def get_specie_related_values(name, **kwargs): """ related_tag = kwargs['_related_tag'] related_data = kwargs[related_tag] + try: + new_format = kwargs['dftU']['@new_format'] + except KeyError: + new_format = False + + if new_format and related_tag in ['Hubbard_U', 'Hubbard_J', 'Hubbard_alpha', + 'Hubbard_beta', 'Hubbard_J0']: + return [] try: atomic_species = kwargs['atomic_species'] species = atomic_species['species'] @@ -276,7 +284,58 @@ def set_one_amass_line(name, **kwargs): return lines +def set_one_proj_line(name, **kwargs): + """ + writes projlines for epw input + """ + lines = [] + try: + node = kwargs['proj'] + value = str(node['$']) + index = node['@atom'] + lines.append(f" {name}({index})='{value}'") + except TypeError: + for node in kwargs['proj']: + value = str(node['$']) + index = node['@atom'] + lines.append(f" {name}({index})='{value}'") + return lines + + +def set_wdata_lines(name, **kwargs): + """ + writes wdata strings for epw input + """ + res = [] + if kwargs.get('wannier_plot', False): + res = [" wdata(1) = 'bands_plot = .true.'", + " wdata(2) = 'begin kpoint_path'"] + iline = 2 + points = kwargs['wannier_plot_list'] + points.sort(key=lambda s: s['@segment']) + for ppt in points: + iline += 1 + res.append(f" wdata({iline}) = '{ppt['$'].strip()}'") + iline += 1 + res.append(f" wdata({iline}) = 'end kpoint_path'") + if kwargs.get('wannier_plot_format', None): + iline += 1 + plot_format = kwargs['wannier_plot_format'].strip() + res.append(f" wdata{iline} = 'bands_plot_format = {plot_format}'") + use_ws_distance = "T" if kwargs.get('use_ws', False) else "F" + iline += 1 + res.append(f" wdata({iline}) = 'use_ws_distance = {use_ws_distance}'") + return res + + def set_lda_plus_u_flag(name, **kwargs): + """ + writes SYSTEM[set_lda_plus_u_flag] for old format + """ + dftu = kwargs.get('dftU', None) + if dftu: + if dftu.get('@new_format'): + return [] assert isinstance(name, str) lines = [] related_tag = kwargs['_related_tag'] @@ -289,6 +348,38 @@ def set_lda_plus_u_flag(name, **kwargs): return lines +def set_lda_plus_u_kind(name, **kwargs): + """ + writes SYSTEM[lda_plus_u_kind] flag for old format + """ + dftu = kwargs.get('dftU', None) + if dftu: + if dftu.get('@new_format', False): + return [] + # + assert isinstance(name, str) + lines = [] + if kwargs.get('lda_plus_u_kind', None) is not None: + lines.append(f" lda_plus_u_kind = {kwargs['lda_plus_u_kind']}") + return lines + + +def set_u_projection_type(name, **kwargs): + """ + writes U_projection_type for old Hubbard format + """ + assert isinstance(name, str) + dftu = kwargs.get('dftU', None) + if dftu: + if dftu.get('@new_format', False): + return [] + lines = [] + related_tag = kwargs['_related_tag'] + related_data = kwargs[related_tag] + lines.append(f" {related_tag} = '{related_data}'") + return lines + + def set_boolean_flag(name, **kwargs): assert isinstance(name, str) lines = [] diff --git a/qeschema/schemas/epw.xsd b/qeschema/schemas/epw.xsd new file mode 100644 index 0000000..76ee661 --- /dev/null +++ b/qeschema/schemas/epw.xsd @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qeschema/schemas/releases/qes_211101.xsd b/qeschema/schemas/releases/qes_211101.xsd index 1d3c468..e501a16 100644 --- a/qeschema/schemas/releases/qes_211101.xsd +++ b/qeschema/schemas/releases/qes_211101.xsd @@ -488,6 +488,7 @@ datecode 211101 + diff --git a/qeschema/schemas/releases/qes_230310.xsd b/qeschema/schemas/releases/qes_230310.xsd new file mode 100644 index 0000000..dd615fc --- /dev/null +++ b/qeschema/schemas/releases/qes_230310.xsd @@ -0,0 +1,1367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qeschema/schemas/releases/qes_neb-211101.xsd b/qeschema/schemas/releases/qes_neb-211101.xsd new file mode 100644 index 0000000..3fc29f2 --- /dev/null +++ b/qeschema/schemas/releases/qes_neb-211101.xsd @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/requirements-dev.txt b/requirements-dev.txt index a956eb8..4c85cd8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ # Requirements for setup a development environment for the qeschema package. setuptools -tox +tox>=4.0 flake8 coverage xmlschema>=1.6.4 diff --git a/scripts/xml2qeinput.py b/scripts/xml2qeinput.py index 3e3975b..c4f1cb9 100755 --- a/scripts/xml2qeinput.py +++ b/scripts/xml2qeinput.py @@ -26,6 +26,8 @@ def parse_args(): parser.add_argument("-v", "--verbosity", action="count", default=1, help="Increase output verbosity.") parser.add_argument('-in', metavar='FILE', required=True, help="XML input filename.") + parser.add_argument('-schema', metavar='FILE', required=False, + help="Specify XSD schema in input", default=None) return parser.parse_args() @@ -49,21 +51,24 @@ def parse_args(): qeschema.set_logger(args.verbosity) input_fn = getattr(args, 'in') + schema_fn = getattr(args, 'schema', None) tree = Etree.parse(input_fn) root = tree.getroot() element_name = root.tag.split('}')[-1] if element_name == 'espresso': - xml_document = qeschema.PwDocument() + xml_document = qeschema.PwDocument(source=input_fn, schema=schema_fn) elif element_name == 'nebRun': - xml_document = qeschema.NebDocument() + xml_document = qeschema.NebDocument(source=input_fn, schema=schema_fn) elif element_name == 'espressoph': - xml_document = qeschema.PhononDocument() + xml_document = qeschema.PhononDocument(source=input_fn, schema=schema_fn) elif element_name == 'tddfpt': - xml_document = qeschema.TdDocument() + xml_document = qeschema.TdDocument(source=input_fn, schema=schema_fn) elif element_name == 'spectrumDoc': - xml_document = qeschema.TdSpectrumDocument() + xml_document = qeschema.TdSpectrumDocument(source=input_fn, schema=schema_fn) elif element_name == 'xspectra': - xml_document = qeschema.XSpectraDocument() + xml_document = qeschema.XSpectraDocument(source=input_fn, schema=schema_fn) + elif element_name == 'epw': + xml_document = qeschema.EPWDocument(souce=input_fn, schema=schema_fn) else: sys.stderr.write("Could not find correct XML in %s, exiting...\n" % input_fn) sys.exit(1) @@ -71,7 +76,6 @@ def parse_args(): root = None tree = None - xml_document.read(input_fn) qe_in = xml_document.get_fortran_input() input_fn_name, input_fn_ext = os.path.splitext(input_fn) diff --git a/setup.py b/setup.py index 2a68998..fdf3a6b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='qeschema', - version='1.4.0', + version='1.5.0', install_requires=['xmlschema>=1.6.4', 'numpy'], extras_require={ 'HDF5': ['h5py'], @@ -41,6 +41,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Utilities', diff --git a/tests/resources/epw/epw_test1.in.test b/tests/resources/epw/epw_test1.in.test new file mode 100644 index 0000000..2f94af4 --- /dev/null +++ b/tests/resources/epw/epw_test1.in.test @@ -0,0 +1,25 @@ +diamond +&inputepw + amass(1)= 12.011 + dis_frox_max=7.0 + dis_win_max=12.0 + elph=.true. + epbwrite=.true. + epwread=.false. + iprint=0 + iverbosity=0 + mp_mesh_k=.false. + nbndsub=4 + nk1=3 + nk2=3 + nk3=3 + nq1=3 + nq2=3 + nq3=3 + num_iter=300 + outdir='./' + prefix='diam' + proj(1)='f=0,0,0:l=3' + wannier_plot=.false. + wannierize=.true. +/ \ No newline at end of file diff --git a/tests/resources/epw/epw_test1.xml b/tests/resources/epw/epw_test1.xml new file mode 100644 index 0000000..be90c9b --- /dev/null +++ b/tests/resources/epw/epw_test1.xml @@ -0,0 +1,35 @@ + + + + + diamond + diam + ./ + 0 + true + true + false + 4 + 12.01078 + 3 + 3 + 3 + 3 + 3 + 3 + false + true + + + 300 + 12 + 7 + f=0,0,0:l=3 + 0 + false + + + + diff --git a/tests/resources/epw/epw_test2.in.test b/tests/resources/epw/epw_test2.in.test new file mode 100644 index 0000000..5c784af --- /dev/null +++ b/tests/resources/epw/epw_test2.in.test @@ -0,0 +1,39 @@ +sic +&inputepw + amass(2)= 12.011 + amass(1)= 28.085 + dis_frox_max=7.0 + dis_win_max=12.0 + elph=.true. + epbread=.false. + epbwrite=.true. + epwread=.false. + epwwrite=.true. + etcmem=1 + iprint=2 + iverbosity=0 + lphase=.true. + lpolar=.true. + mp_mesh_k=.false. + nbndsub=4 + nk1=3 + nk2=3 + nk3=3 + nq1=3 + nq2=3 + nq3=3 + num_iter=300 + outdir='./' + prefix='sic' + proj(1)='Si:sp3' + vme='dipole' + wannier_plot=.true. + wannierize=.true. + wdata(1) = 'bands_plot = .true.' + wdata(2) = 'begin kpoint_path' + wdata(3) = 'L 0.50 0.00 0.00 G 0.00 0.00 0.00' + wdata(4) = 'G 0.00 0.00 0.00 X 0.50 0.50 0.00' + wdata(5) = 'end kpoint_path' + wdata6 = 'bands_plot_format = gnuplot' + wdata(7) = 'use_ws_distance = T' +/ diff --git a/tests/resources/epw/epw_test2.xml b/tests/resources/epw/epw_test2.xml new file mode 100644 index 0000000..bc33615 --- /dev/null +++ b/tests/resources/epw/epw_test2.xml @@ -0,0 +1,50 @@ + + + + + sic + sic + ./ + 0 + true + false + true + false + true + 1 + 4 + 12.01078 + 28.0855 + 3 + 3 + 3 + 3 + 3 + 3 + false + dipole + true + true + true + + + 300 + 12 + 7 + Si:sp3 + 2 + true + + L 0.50 0.00 0.00 G 0.00 0.00 0.00 + + + G 0.00 0.00 0.00 X 0.50 0.50 0.00 + + true + gnuplot + + + + diff --git a/tests/resources/neb/Al001+H_pbc.xml b/tests/resources/neb/Al001+H_pbc.xml index 696b4cb..af1a582 100644 --- a/tests/resources/neb/Al001+H_pbc.xml +++ b/tests/resources/neb/Al001+H_pbc.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.quantum-espresso.org/ns/neb releases/qes_neb-211101.xsd" > neb diff --git a/tests/resources/neb/Al001_plus_H_bc3.xml b/tests/resources/neb/Al001_plus_H_bc3.xml index 45b0766..98c223f 100644 --- a/tests/resources/neb/Al001_plus_H_bc3.xml +++ b/tests/resources/neb/Al001_plus_H_bc3.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.quantum-espresso.org/ns/neb releases/qes_neb-211101.xsd" > neb diff --git a/tests/resources/neb/H2+H.xml b/tests/resources/neb/H2+H.xml index e9ba45a..9304426 100644 --- a/tests/resources/neb/H2+H.xml +++ b/tests/resources/neb/H2+H.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.quantum-espresso.org/ns/neb releases/qes_neb-211101.xsd" > neb diff --git a/tests/resources/neb/H2+H_crystal.xml b/tests/resources/neb/H2+H_crystal.xml index 243f80d..03a8f2b 100644 --- a/tests/resources/neb/H2+H_crystal.xml +++ b/tests/resources/neb/H2+H_crystal.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.quantum-espresso.org/ns/neb releases/qes_neb-211101.xsd" > neb diff --git a/tests/resources/neb/periodic_dft_65_WaterP1_0_neb_0.xml b/tests/resources/neb/periodic_dft_65_WaterP1_0_neb_0.xml index 1ad46f4..e0ed02e 100644 --- a/tests/resources/neb/periodic_dft_65_WaterP1_0_neb_0.xml +++ b/tests/resources/neb/periodic_dft_65_WaterP1_0_neb_0.xml @@ -1,6 +1,6 @@ +xsi:schemaLocation="http://www.quantum-espresso.org/ns/qes/qes-1.0 releases/qes_neb-211101.xsd"> neb diff --git a/tests/resources/pw/FeO_LDAU_standard.in.test b/tests/resources/pw/FeO_LDAU_standard.in.test index 714795a..52596af 100644 --- a/tests/resources/pw/FeO_LDAU_standard.in.test +++ b/tests/resources/pw/FeO_LDAU_standard.in.test @@ -26,7 +26,7 @@ ibrav=0 input_dft='PZ' lda_plus_u = .true. - lda_plus_u_kind=0 + lda_plus_u_kind = 0 lspinorb=.false. nat=4 nbnd=20 @@ -43,7 +43,7 @@ starting_magnetization(2)=0.5 starting_magnetization(3)=-0.5 tot_charge=0.0 - U_projection_type='atomic' + U_projection_type = 'atomic' use_all_frac=.false. / &ELECTRONS diff --git a/tests/resources/pw/FeO_LDAU_standard_230310.in.test b/tests/resources/pw/FeO_LDAU_standard_230310.in.test new file mode 100644 index 0000000..c0159d7 --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_standard_230310.in.test @@ -0,0 +1,88 @@ +&CONTROL + calculation='scf' + disk_io='low' + etot_conv_thr=0.0001 + forc_conv_thr=0.001 + input_xml_schema_file='FeO_LDAU_standard_230310.xml' + iprint=100000 + max_seconds=10000000 + outdir='/scratch/pdelugas/espresso-xsd/tempdir/' + prefix='feo_af' + pseudo_dir='/scratch/pdelugas/espresso-xsd/pseudo/' + restart_mode='from_scratch' + title='FeO_LDA+U' + tprnfor=.true. + tstress=.true. + verbosity='low' + wf_collect=.false. +/ +&SYSTEM + degauss=0.01 + ecutrho=240.0 + ecutwfc=30.0 + force_symmorphic=.false. + ibrav=0 + input_dft='PZ' + lspinorb=.false. + nat=4 + nbnd=20 + no_t_rev=.false. + noinv=.false. + noncolin=.false. + nosym=.false. + nosym_evc=.false. + nspin=2 + ntyp=3 + occupations='smearing' + smearing='gaussian' + starting_magnetization(1)=0.0 + starting_magnetization(2)=0.5 + starting_magnetization(3)=-0.5 + tot_charge=0.0 + use_all_frac=.false. +/ +&ELECTRONS + conv_thr=1e-06 + diago_cg_maxiter=20 + diago_full_acc=.false. + diago_thr_init=0.0 + diagonalization='davidson' + electron_maxstep=100 + mixing_beta=0.3 + mixing_mode='plain' + mixing_ndim=8 + tbeta_smoothing=.false. + tq_smoothing=.false. + tqr=.false. +/ +&IONS + ion_dynamics='none' + refold_pos=.false. + remove_rigid_rot=.false. +/ +&CELL + cell_dynamics='none' + cell_factor=0.0 + press=0.0 + press_conv_thr=0.5 + wmass=3645.777 +/ +ATOMIC_SPECIES + O1 1.0 O.pz-rrkjus.UPF + Fe1 1.0 Fe.pz-nd-rrkjus.UPF + Fe2 1.0 Fe.pz-nd-rrkjus.UPF +ATOMIC_POSITIONS bohr +O1 0.50000000 0.50000000 0.50000000 +O1 1.50000000 1.50000000 1.50000000 +Fe1 0.00000000 0.00000000 0.00000000 +Fe2 1.00000000 1.00000000 1.00000000 +K_POINTS automatic + 2 2 2 0 0 0 +CELL_PARAMETERS bohr + 0.50000000 0.50000000 1.00000000 + 0.50000000 1.00000000 0.50000000 + 1.00000000 0.50000000 0.50000000 +HUBBARD atomic +U Fe1-3d 0.316 +U Fe2-3d 0.326 +J0 Fe2-3d 0.410 \ No newline at end of file diff --git a/tests/resources/pw/FeO_LDAU_standard_230310.xml b/tests/resources/pw/FeO_LDAU_standard_230310.xml new file mode 100644 index 0000000..9b8e833 --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_standard_230310.xml @@ -0,0 +1,258 @@ + + + + FeO_LDA+U + scf + from_scratch + feo_af + /scratch/pdelugas/espresso-xsd/pseudo/ + /scratch/pdelugas/espresso-xsd/tempdir/ + + true + + + true + + + false + + low + + 10000000 + + + 0.1000000E-03 + + + 0.1000000E-02 + + + 0.5000000E+00 + + low + + 100000 + + false + false + + + + + 0.1000000E+01 + + O.pz-rrkjus.UPF + + 0.0000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + 0.5000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + -0.5000000E+00 + + + + + + + 0.5000000E+00 0.5000000E+00 0.5000000E+00 + + + 0.1500000E+01 0.1500000E+01 0.1500000E+01 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.1000000E+01 0.1000000E+01 0.1000000E+01 + + + + + 0.5000000E+00 0.5000000E+00 0.1000000E+01 + + + 0.5000000E+00 0.1000000E+01 0.5000000E+00 + + + 0.1000000E+01 0.5000000E+00 0.5000000E+00 + + + + + PZ + + 0 + + 0.0000000E+00 + + + 0.3160442E+00 + + + 0.3260442E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.41 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + atomic + + + + + true + + + false + + + false + + + + + 20 + + gaussian + + 0.0000000E+00 + + smearing + + + + 0.3000000E+02 + + + 0.2400000E+03 + + + + davidson + plain + + 0.3000000E+00 + + + 0.1000000E-05 + + + 8 + + + 100 + + + false + + false + false + + 0.0000000E+00 + + + false + + + 20 + + + + + Monckhort-Pack + + + + none + + false + + + false + + + + none + 0.0 + + 0.3645777E+04 + + + 0.0000000E+00 + + + 1 1 1 + 1 1 1 + 1 1 1 + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + diff --git a/tests/resources/pw/FeO_LDAU_with_no_U.in.test b/tests/resources/pw/FeO_LDAU_with_no_U.in.test index e9b3d80..5796094 100644 --- a/tests/resources/pw/FeO_LDAU_with_no_U.in.test +++ b/tests/resources/pw/FeO_LDAU_with_no_U.in.test @@ -26,7 +26,7 @@ ibrav=0 input_dft='PZ' lda_plus_u = .true. - lda_plus_u_kind=0 + lda_plus_u_kind = 0 lspinorb=.false. nat=4 nbnd=20 @@ -43,7 +43,7 @@ starting_magnetization(2)=0.5 starting_magnetization(3)=-0.5 tot_charge=0.0 - U_projection_type='atomic' + U_projection_type = 'atomic' use_all_frac=.false. / &ELECTRONS diff --git a/tests/resources/pw/FeO_LDAU_with_no_U_230310.in.test b/tests/resources/pw/FeO_LDAU_with_no_U_230310.in.test new file mode 100644 index 0000000..3be8faa --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_with_no_U_230310.in.test @@ -0,0 +1,87 @@ +&CONTROL + calculation='scf' + disk_io='low' + etot_conv_thr=0.0001 + forc_conv_thr=0.001 + input_xml_schema_file='FeO_LDAU_with_no_U_230310.xml' + iprint=100000 + max_seconds=10000000 + outdir='/scratch/pdelugas/espresso-xsd/tempdir/' + prefix='feo_af' + pseudo_dir='/scratch/pdelugas/espresso-xsd/pseudo/' + restart_mode='from_scratch' + title='FeO_LDA+U=0' + tprnfor=.true. + tstress=.true. + verbosity='low' + wf_collect=.false. +/ +&SYSTEM + degauss=0.01 + ecutrho=240.0 + ecutwfc=30.0 + force_symmorphic=.false. + ibrav=0 + input_dft='PZ' + lspinorb=.false. + nat=4 + nbnd=20 + no_t_rev=.false. + noinv=.false. + noncolin=.false. + nosym=.false. + nosym_evc=.false. + nspin=2 + ntyp=3 + occupations='smearing' + smearing='gaussian' + starting_magnetization(1)=0.0 + starting_magnetization(2)=0.5 + starting_magnetization(3)=-0.5 + tot_charge=0.0 + use_all_frac=.false. +/ +&ELECTRONS + conv_thr=1e-06 + diago_cg_maxiter=20 + diago_full_acc=.false. + diago_thr_init=0.0 + diagonalization='davidson' + electron_maxstep=100 + mixing_beta=0.3 + mixing_mode='plain' + mixing_ndim=8 + tbeta_smoothing=.false. + tq_smoothing=.false. + tqr=.false. +/ +&IONS + ion_dynamics='none' + refold_pos=.false. + remove_rigid_rot=.false. +/ +&CELL + cell_dynamics='none' + cell_factor=0.0 + press=0.0 + press_conv_thr=0.5 + wmass=3645.777 +/ +ATOMIC_SPECIES + O1 1.0 O.pz-rrkjus.UPF + Fe1 1.0 Fe.pz-nd-rrkjus.UPF + Fe2 1.0 Fe.pz-nd-rrkjus.UPF +ATOMIC_POSITIONS bohr +O1 0.50000000 0.50000000 0.50000000 +O1 1.50000000 1.50000000 1.50000000 +Fe1 0.00000000 0.00000000 0.00000000 +Fe2 1.00000000 1.00000000 1.00000000 +K_POINTS automatic + 2 2 2 0 0 0 +CELL_PARAMETERS bohr + 0.50000000 0.50000000 1.00000000 + 0.50000000 1.00000000 0.50000000 + 1.00000000 0.50000000 0.50000000 +HUBBARD atomic +U Fe1-3d 0.000 +U Fe2-3d 0.000 \ No newline at end of file diff --git a/tests/resources/pw/FeO_LDAU_with_no_U_230310.xml b/tests/resources/pw/FeO_LDAU_with_no_U_230310.xml new file mode 100644 index 0000000..41b17ad --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_with_no_U_230310.xml @@ -0,0 +1,262 @@ + + + + FeO_LDA+U=0 + scf + from_scratch + feo_af + /scratch/pdelugas/espresso-xsd/pseudo/ + /scratch/pdelugas/espresso-xsd/tempdir/ + + true + + + true + + + false + + low + + 10000000 + + + 0.1000000E-03 + + + 0.1000000E-02 + + + 0.5000000E+00 + + low + + 100000 + + false + false + + + + + 0.1000000E+01 + + O.pz-rrkjus.UPF + + 0.0000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + 0.5000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + -0.5000000E+00 + + + + + + + 0.5000000E+00 0.5000000E+00 0.5000000E+00 + + + 0.1500000E+01 0.1500000E+01 0.1500000E+01 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.1000000E+01 0.1000000E+01 0.1000000E+01 + + + + + 0.5000000E+00 0.5000000E+00 0.1000000E+01 + + + 0.5000000E+00 0.1000000E+01 0.5000000E+00 + + + 0.1000000E+01 0.5000000E+00 0.5000000E+00 + + + + + PZ + + 0 + + 0.0000000E+00 + + + 0.7349865E-09 + + + 0.7349865E-09 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + atomic + + + + + true + + + false + + + false + + + + + 20 + + gaussian + + 0.0000000E+00 + + + smearing + + + + + 0.3000000E+02 + + + 0.2400000E+03 + + + + davidson + plain + + 0.3000000E+00 + + + 0.1000000E-05 + + + 8 + + + 100 + + + false + + false + false + + 0.0000000E+00 + + + false + + + 20 + + + + +Monckhort-Pack + + + + +none + + + false + + + false + + + + none + 0.00 + + 0.3645777E+04 + + + 0.0000000E+00 + + + 1 1 1 + 1 1 1 + 1 1 1 + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + diff --git a/tests/resources/pw/FeO_LDAU_with_starting_ns.in.test b/tests/resources/pw/FeO_LDAU_with_starting_ns.in.test index c93b01d..30f9cad 100644 --- a/tests/resources/pw/FeO_LDAU_with_starting_ns.in.test +++ b/tests/resources/pw/FeO_LDAU_with_starting_ns.in.test @@ -26,7 +26,7 @@ ibrav=0 input_dft='PZ' lda_plus_u = .true. - lda_plus_u_kind=0 + lda_plus_u_kind = 0 lspinorb=.false. nat=4 nbnd=20 @@ -45,7 +45,7 @@ starting_ns_eigenvalue(3,1,3)=1.0 starting_ns_eigenvalue(3,2,2)=1.0 tot_charge=0.0 - U_projection_type='atomic' + U_projection_type = 'atomic' use_all_frac=.false. / &ELECTRONS diff --git a/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.in.test b/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.in.test new file mode 100644 index 0000000..70c5509 --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.in.test @@ -0,0 +1,99 @@ +&CONTROL + calculation='scf' + disk_io='low' + etot_conv_thr=0.0001 + forc_conv_thr=0.001 + input_xml_schema_file='FeO_LDAU_with_starting_ns_230210.xml' + iprint=100000 + max_seconds=10000000 + outdir='./' + prefix='pwscf' + pseudo_dir='/u/cm/pdelugas/espresso/pseudo/' + restart_mode='from_scratch' + title='uffa' + tprnfor=.false. + tstress=.false. + verbosity='low' + wf_collect=.false. +/ +&SYSTEM + degauss=0.01 + ecutrho=240.0 + ecutwfc=30.0 + force_symmorphic=.false. + ibrav=0 + input_dft='PZ' + lspinorb=.false. + nat=4 + nbnd=20 + no_t_rev=.false. + noinv=.false. + noncolin=.false. + nosym=.false. + nosym_evc=.false. + nspin=2 + ntyp=3 + occupations='smearing' + smearing='gaussian' + starting_magnetization(1)=0.0 + starting_magnetization(2)=0.5 + starting_magnetization(3)=-0.5 + starting_ns_eigenvalue(3,1,3)=1.0 + starting_ns_eigenvalue(3,2,2)=1.0 + tot_charge=0.0 + use_all_frac=.false. +/ +&ELECTRONS + conv_thr=1e-08 + diago_cg_maxiter=20 + diago_full_acc=.false. + diago_thr_init=0.0 + diagonalization='davidson' + electron_maxstep=100 + mixing_beta=0.3 + mixing_mode='plain' + mixing_ndim=8 + tbeta_smoothing=.false. + tq_smoothing=.false. + tqr=.false. +/ +&IONS + ion_dynamics='none' + refold_pos=.false. + remove_rigid_rot=.false. +/ +&CELL + cell_dynamics='none' + cell_factor=0.0 + press=0.0 + press_conv_thr=0.5 + wmass=3645.777 +/ +ATOMIC_SPECIES + O1 1.0 O.pz-rrkjus.UPF + Fe1 1.0 Fe.pz-nd-rrkjus.UPF + Fe2 1.0 Fe.pz-nd-rrkjus.UPF +ATOMIC_POSITIONS bohr +O1 4.09500000 4.09500000 4.09500000 +O1 12.28500000 12.28500000 12.28500000 +Fe1 0.00000000 0.00000000 0.00000000 +Fe2 8.19000000 8.19000000 8.19000000 +K_POINTS automatic + 2 2 2 0 0 0 +CELL_PARAMETERS bohr + 4.09500000 4.09500000 8.19000000 + 4.09500000 8.19000000 4.09500000 + 8.19000000 4.09500000 4.09500000 +HUBBARD atomic +U Fe1-3d 0.316 +U Fe2-3d 0.316 +J0 Fe1-3d 0.000 +J0 Fe2-3d 0.000 +alpha Fe1-3d 0.000 +alpha Fe2-3d 0.000 +beta Fe1-3d 0.000 +beta Fe2-3d 0.000 +J Fe1-3d 0.000 +B Fe1-3d 0.000 +J Fe2-3d 0.000 +B Fe2-3d 0.000 diff --git a/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.xml b/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.xml new file mode 100644 index 0000000..655cd7c --- /dev/null +++ b/tests/resources/pw/FeO_LDAU_with_starting_ns_230210.xml @@ -0,0 +1,242 @@ + + + + uffa + scf + from_scratch + pwscf + /u/cm/pdelugas/espresso/pseudo/ + ./ + false + false + false + low + + 10000000 + + + 0.1000000E-03 + + + 0.1000000E-02 + + + 0.5000000E+00 + + low + + 100000 + + false + false + + + + + 0.1000000E+01 + + O.pz-rrkjus.UPF + + 0.0000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + 0.5000000E+00 + + + + + 0.1000000E+01 + + Fe.pz-nd-rrkjus.UPF + + -0.5000000E+00 + + + + + + + 0.4095000E+01 0.4095000E+01 0.4095000E+01 + + + 0.1228500E+02 0.1228500E+02 0.1228500E+02 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.8190000E+01 0.8190000E+01 0.8190000E+01 + + + + + 0.4095000E+01 0.4095000E+01 0.8190000E+01 + + + 0.4095000E+01 0.8190000E+01 0.4095000E+01 + + + 0.8190000E+01 0.4095000E+01 0.4095000E+01 + + + + + PZ + + 0 + + 0.0000000E+00 + + + 0.3160442E+00 + + + 0.3160442E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + 0.0000000E+00 0.0000000E+00 0.0000000E+00 + + + -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + + -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + + -0.1000000E+01 -0.1000000E+01 0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + + -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + + -0.1000000E+01 -0.1000000E+01 0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + + -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 -0.1000000E+01 + + atomic + + + + true + false + false + + + + 20 + + gaussian + + 0.0000000E+00 + + smearing + + + + 0.3000000E+02 + + + 0.2400000E+03 + + + + davidson + plain + + 0.3000000E+00 + + + 0.1000000E-07 + + + 8 + + + 100 + + false + false + false + + 0.0000000E+00 + + false + + 20 + + + + Monkhorst-Pack + + + none + false + false + + + none + 0.0 + + 0.3645777E+04 + + + 0.0000000E+00 + + + 1 1 1 + 1 1 1 + 1 1 1 + + + + false + false + false + false + false + false + + + diff --git a/tests/test_cards.py b/tests/test_cards.py index fe20e58..747d99e 100755 --- a/tests/test_cards.py +++ b/tests/test_cards.py @@ -153,16 +153,20 @@ def test_get_atomic_constraints_card(self): 'when building CONSTRAINTS card!']) result = get_atomic_constraints_card( - 'CONSTRAINTS', num_of_constraints=1, tolerance=0.2, atomic_constraints=[] - ) + 'CONSTRAINTS', **{'atomic_constraints': {'num_of_constraints': 1, + 'tolerance': 0.2, + 'atomic_constraint': []}}) self.assertListEqual(result, ['CONSTRAINTS', '1 0.2']) result = get_atomic_constraints_card( - 'CONSTRAINTS', num_of_constraints=1, tolerance=0.2, atomic_constraints=[{ - 'constr_parms': [0.2, 0.3, 0.1, 0.9], - 'constr_type': 'test_constraint', - 'constr_target': 0.3, - }] - ) + 'CONSTRAINTS', + **{'atomic_constraints': {'num_of_constraints': 1, 'tolerance': 0.2, + 'atomic_constraint': [ + {'constr_parms': [0.2, 0.3, 0.1, 0.9], + 'constr_type': 'test_constraint', + 'constr_target': 0.3 + }] + } + }) self.assertListEqual(result, ['CONSTRAINTS', '1 0.2', 'test_constraint 0.2 0.3 0.1 0.9 0.3']) diff --git a/tests/test_converters.py b/tests/test_converters.py index cec5136..fce3d00 100755 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -43,6 +43,8 @@ def test(self): xml_conf = qeschema.TdSpectrumDocument(source=xml_file) elif element_name == 'xspectra': xml_conf = qeschema.XSpectraDocument(source=xml_file) + elif element_name == 'epw': + xml_conf = qeschema.EPWDocument(source=xml_file) else: raise ValueError("XML file %r is not a Quantum ESPRESSO document!" % xml_file) diff --git a/tox.ini b/tox.ini index 2406d3e..88be00f 100644 --- a/tox.ini +++ b/tox.ini @@ -4,9 +4,8 @@ # and then run "tox" from this directory. [tox] -envlist = py{37,38,39,310}, docs, flake8, coverage +envlist = py{37,38,39,310,311}, docs, flake8, coverage skip_missing_interpreters = true -toxworkdir = {homedir}/.tox/qeschema [testenv] deps = @@ -18,7 +17,7 @@ deps = docs: sphinx_rtd_theme coverage: coverage commands = python -m unittest -whitelist_externals = make +allowlist_externals = make [testenv:docs] commands =