Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import physical constants from qe-tools instead of aiida-core #388

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aiida_quantumespresso/data/force_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import numpy
from six.moves import range

from qe_tools.constants import bohr_to_ang
from aiida.orm import SinglefileData
from aiida_quantumespresso.parsers.constants import bohr_to_ang


class ForceConstantsData(SinglefileData):
Expand Down
33 changes: 0 additions & 33 deletions aiida_quantumespresso/parsers/constants.py

This file was deleted.

7 changes: 2 additions & 5 deletions aiida_quantumespresso/parsers/cp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
from aiida.parsers import Parser
from six.moves import zip

from aiida_quantumespresso.parsers.constants import (bohr_to_ang,
hartree_to_ev,
timeau_to_sec)
from aiida_quantumespresso.parsers.parse_raw.cp import (parse_cp_raw_output,
parse_cp_traj_stanzas)
from qe_tools.constants import bohr_to_ang, hartree_to_ev, timeau_to_sec
from aiida_quantumespresso.parsers.parse_raw.cp import parse_cp_raw_output, parse_cp_traj_stanzas


class CpParser(Parser):
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/parsers/matdyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from aiida import orm
from aiida.common import exceptions
from aiida.parsers.parser import Parser
from aiida_quantumespresso.parsers.constants import invcm_to_THz
from qe_tools.constants import invcm_to_THz
from aiida_quantumespresso.calculations.matdyn import MatdynCalculation


Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/parsers/parse_raw/neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import string
from aiida_quantumespresso.parsers import QEOutputParsingError, get_parser_info
from aiida_quantumespresso.parsers.constants import ry_to_ev,hartree_to_ev,bohr_to_ang,ry_si,bohr_si
from qe_tools.constants import ry_to_ev,hartree_to_ev,bohr_to_ang,ry_si,bohr_si
from aiida_quantumespresso.parsers.parse_raw.pw import convert_qe_time_to_sec
import six
from six.moves import range
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/parsers/parse_raw/ph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from six.moves import zip

from aiida_quantumespresso.parsers import QEOutputParsingError, get_parser_info
from aiida_quantumespresso.parsers.constants import *
from qe_tools.constants import *
from aiida_quantumespresso.parsers.parse_xml.pw.legacy import parse_xml_child_bool, read_xml_card
from aiida_quantumespresso.parsers.parse_raw.pw import convert_qe_time_to_sec
from aiida_quantumespresso.utils.mapping import get_logging_container
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/parsers/parse_raw/pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from six.moves import range

from aiida_quantumespresso.parsers import QEOutputParsingError
from aiida_quantumespresso.parsers.constants import ry_to_ev, bohr_to_ang, ry_si, bohr_si
from aiida_quantumespresso.utils.mapping import get_logging_container
from qe_tools.constants import ry_to_ev, bohr_to_ang, ry_si, bohr_si

lattice_tolerance = 1.e-5
units_suffix = '_units'
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/parsers/parse_xml/pw/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from aiida.common.extendeddicts import AttributeDict
from aiida_quantumespresso.parsers import QEOutputParsingError
from aiida_quantumespresso.parsers.constants import ry_to_ev, hartree_to_ev, bohr_to_ang
from qe_tools.constants import ry_to_ev, hartree_to_ev, bohr_to_ang

units_suffix = '_units'
default_energy_units = 'eV'
Expand Down
4 changes: 3 additions & 1 deletion aiida_quantumespresso/parsers/parse_xml/pw/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from xmlschema.exceptions import URLError

from aiida.common.extendeddicts import AttributeDict
from aiida_quantumespresso.parsers.constants import hartree_to_ev, bohr_to_ang, e_bohr2_to_coulomb_m2
from qe_tools.constants import hartree_to_ev, bohr_to_ang

from .exceptions import XMLParseError
from .legacy import parse_pw_xml_pre_6_2
Expand Down Expand Up @@ -70,6 +70,8 @@ def parse_pw_xml_post_6_2(xml, include_deprecated_v2_keys=False):
:param include_deprecated_v2_keys: boolean, if True, includes deprecated keys from old parser v2
:returns: tuple of two dictionaries, with the parsed data and log messages, respectively
"""
e_bohr2_to_coulomb_m2 = 57.214766 # e/a0^2 to C/m^2 (electric polarization) from Wolfram Alpha

logs = AttributeDict({
'warning': [],
'error': [],
Expand Down
6 changes: 3 additions & 3 deletions aiida_quantumespresso/tools/dbexporters/tcod_plugins/pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def get_kinetic_energy_cutoff_wavefunctions(cls, calc, **kwargs): # pylint: dis
"""
Returns kinetic energy cutoff for wavefunctions in eV.
"""
from aiida.common.constants import ry_to_ev
from qe_tools.constants import ry_to_ev
parameters = calc.inputs.parameters
ecutwfc = None
try:
Expand All @@ -339,7 +339,7 @@ def get_kinetic_energy_cutoff_charge_density(cls, calc, **kwargs): # pylint: di
.. note :: by default returns 4 * ecutwfc, as indicated in
http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
"""
from aiida.common.constants import ry_to_ev
from qe_tools.constants import ry_to_ev
parameters = calc.inputs.parameters
try:
return parameters.get_dict()['SYSTEM']['ecutrho'] * ry_to_ev
Expand All @@ -359,7 +359,7 @@ def get_kinetic_energy_cutoff_EEX(cls, calc, **kwargs): # pylint: disable=inval
.. note :: by default returns ecutrho, as indicated in
http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html
"""
from aiida.common.constants import ry_to_ev
from qe_tools.constants import ry_to_ev
parameters = calc.inputs.parameters
try:
return parameters.get_dict()['SYSTEM']['ecutfock'] * ry_to_ev
Expand Down
2 changes: 1 addition & 1 deletion aiida_quantumespresso/utils/validation/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def verify_convergence_forces(trajectory, index=-1, threshold=None):
:param threshold: the force threshold in Ry / bohr
:return: `None` if the `forces` array or given index does not exist, `True` if threshold is valid, `False` otherwise
"""
from aiida.common.constants import ry_to_ev, bohr_to_ang
from qe_tools.constants import ry_to_ev, bohr_to_ang

if threshold is None:
return None
Expand Down