diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 000000000..648276785 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,38 @@ +`Unreleased `_ +---------- + +`v0.2.0 `_ +------ + +- There are several breaking changes: + + - Changes to the object instantiation API. The former interface + ``InterpolationData(seedname)`` has been changed to + ``InterpolationData.from_castep(seedname)`,` in anticipation of more codes + being added which require more varied arguments. + - Changes to the Debye-Waller calculation API when calculating the structure + factor. The previous ``dw_arg`` kwarg accepted either a seedname or length + 3 list describing a grid. The new kwarg is now ``dw_data`` and accepts a + ``PhononData`` or ``InterpolationData`` object with the frequencies + calculated on a grid. This is to make it clearer to the user exactly what + arguments are being used when calculating phonons on the grid. + - Changes to parallel functionality. The previous parallel implementation + based on Python's multiprocessing has been removed and replaced by a + C/OpenMP version. This has both better performance and is more robust. As + a result the ``n_procs`` kwarg to ``calculate_fine_phonons`` has been + replaced by ``use_c`` and ``n_threads`` kwargs. + +- Improvements: + + - The parallel implementation based on Python's multiprocessing has been + removed and now uses C/OpenMP which both has better performance and is more + robust + - Documentation has been moved to readthedocs and is more detailed + - Clearer interface for calculating the Debye-Waller factor + - Better error handling (e.g. empty ``InterpolationData`` objects, Matplotlib + is not installed...) + +- Bug fixes: + + - Fix gwidth for DOS not being converted to correct units + - Fix qwidth for S(Q,w) broadening being incorrectly calculated \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst index 47b4b1b6e..83e545f56 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -50,8 +50,13 @@ Installing the C extension (optional) Euphonic has an optional C extension, which can lead to increased performance and enable use of multiple cores when interpolating phonons. By default Euphonic will attempt to install this extension, but will print a warning and -fall back to the pure Python version -if this fails. +fall back to the pure Python version if this fails. To determine if the C +extension is installing properly and investigate any problems, it is best to +increase pip's verbosity: + +.. code-block:: bash + + pip install -vvv euphonic **Windows** @@ -65,20 +70,10 @@ the same pip commands as above. **Linux** -The recommended compiler is ``gcc`` (currently tested with ``4.8.5``), first the -environment variable ``CC`` must be set to the gcc compiler: - -.. code-block:: bash +You should have a version of ``gcc`` on your path (currently tested with +``4.8.5``). If ``gcc`` can be found the Euphonic extension will be automatically +installed when using the same pip commands as above. - export CC=gcc - -Then the Euphonic extension will be automatically installed when using the same -pip commands as above. If installing the C extension is failing, you can -investigate by increasing pip's verbosity with the ``-vvv`` flag: - -.. code-block:: bash - - pip install -vvv euphonic .. toctree:: :hidden: diff --git a/euphonic/__init__.py b/euphonic/__init__.py index 233a54286..e2177bc5d 100644 --- a/euphonic/__init__.py +++ b/euphonic/__init__.py @@ -1,7 +1,16 @@ -from pint import UnitRegistry +__version__ = '0.2.0' + +try: + # Create ureg here so it is only created once. However, this __init__.py + # needs to be imported by setup.py to find __version__, so allow pint import + # to fail as in this case pint might not be installed yet + from pint import UnitRegistry + + ureg = UnitRegistry() + # All values from CODATA 2014 + ureg.define('rydberg = 13.605693009*eV = Ry') + ureg.define('bohr = 0.52917721067*angstrom = a_0') + ureg.define('electron_mass = 0.0005485799093*amu = e_mass') +except ImportError: + pass -ureg = UnitRegistry() -# All values from CODATA 2014 -ureg.define('rydberg = 13.605693009*eV = Ry') -ureg.define('bohr = 0.52917721067*angstrom = a_0') -ureg.define('electron_mass = 0.0005485799093*amu = e_mass') diff --git a/setup.py b/setup.py index 67812bda3..3f88fe2d2 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -import os +from euphonic import __version__ try: from setuptools import setup, find_packages, Extension @@ -8,6 +8,7 @@ def run_setup(build_c=True): if build_c: + import os import numpy as np include_dirs = [np.get_include(), 'c'] sources = ['c/_euphonic.c', 'c/dyn_mat.c', 'c/util.c', 'c/py_util.c', @@ -48,7 +49,7 @@ def run_setup(build_c=True): setup( name='euphonic', - version='0.1dev3', + version=__version__, author='Rebecca Fair', author_email='rebecca.fair@stfc.ac.uk', description=(