Compare commits
10 Commits
feature/ae
...
master
Author | SHA1 | Date |
---|---|---|
Sylvain Tricot | c9aa391634 | |
Sylvain Tricot | cf74431c31 | |
Sylvain Tricot | 0699f193b3 | |
Sylvain Tricot | 2bdc9943b9 | |
Sylvain Tricot | b6f2531999 | |
Sylvain Tricot | a4351f5606 | |
Sylvain Tricot | 74ca8f467f | |
Sylvain Tricot | 38023dcd52 | |
Sylvain Tricot | 75c599de95 | |
Sylvain Tricot | e36373a576 |
7
Makefile
7
Makefile
|
@ -32,10 +32,17 @@ devel: venv pybinding wx
|
||||||
@$(INSIDE_VENV) pip install -e src/
|
@$(INSIDE_VENV) pip install -e src/
|
||||||
|
|
||||||
|
|
||||||
|
light: VENV_PATH = ./_venv
|
||||||
|
light: venv
|
||||||
|
@$(INSIDE_VENV) pip install src/
|
||||||
|
|
||||||
|
|
||||||
_build_wx/wxPython.target:
|
_build_wx/wxPython.target:
|
||||||
@$(INSIDE_VENV) echo "Building wxPython for your `python --version 2>&1` under Linux $(DISTRO_RELEASE)..."
|
@$(INSIDE_VENV) echo "Building wxPython for your `python --version 2>&1` under Linux $(DISTRO_RELEASE)..."
|
||||||
# Create a folder to build wx into
|
# Create a folder to build wx into
|
||||||
@mkdir -p _build_wx
|
@mkdir -p _build_wx
|
||||||
|
@$(INSIDE_VENV) pip install attrdict sip
|
||||||
|
# TODO: attrdict is no longer compatible with collections package. The build will fail
|
||||||
# download the wheel or the source if it cannot find a wheel
|
# download the wheel or the source if it cannot find a wheel
|
||||||
@$(INSIDE_VENV) cd _build_wx && pip download -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/$(DISTRO_RELEASE) wxPython
|
@$(INSIDE_VENV) cd _build_wx && pip download -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/$(DISTRO_RELEASE) wxPython
|
||||||
# Build the source if a tar.gz was downloaded
|
# Build the source if a tar.gz was downloaded
|
||||||
|
|
|
@ -727,15 +727,15 @@ class SpecIO(object):
|
||||||
content += line
|
content += line
|
||||||
|
|
||||||
nat = p.extra_nat
|
nat = p.extra_nat
|
||||||
nra_arr = np.ones((nat), dtype=np.int)
|
nra_arr = np.ones((nat), dtype=int)
|
||||||
thfwd_arr = np.ones((nat))
|
thfwd_arr = np.ones((nat))
|
||||||
path_filtering = p.extra_parameters['calculation'].get_parameter(
|
path_filtering = p.extra_parameters['calculation'].get_parameter(
|
||||||
'path_filtering').value
|
'path_filtering').value
|
||||||
if (path_filtering is not None and
|
if (path_filtering is not None and
|
||||||
'backward_scattering' in path_filtering):
|
'backward_scattering' in path_filtering):
|
||||||
ibwd_arr = np.ones((nat), dtype=np.int)
|
ibwd_arr = np.ones((nat), dtype=int)
|
||||||
else:
|
else:
|
||||||
ibwd_arr = np.zeros((nat), dtype=np.int)
|
ibwd_arr = np.zeros((nat), dtype=int)
|
||||||
thbwd_arr = np.ones((nat))
|
thbwd_arr = np.ones((nat))
|
||||||
for at in p.extra_atoms:
|
for at in p.extra_atoms:
|
||||||
i = at.get('proto_index') - 1
|
i = at.get('proto_index') - 1
|
||||||
|
|
|
@ -301,7 +301,7 @@ class _MSCALCULATOR(Calculator):
|
||||||
wf = 4.5
|
wf = 4.5
|
||||||
source_energy = self.source_parameters.get_parameter('energy').value
|
source_energy = self.source_parameters.get_parameter('energy').value
|
||||||
ke = source_energy - binding_energy - wf
|
ke = source_energy - binding_energy - wf
|
||||||
#return np.array(ke, dtype=np.float).flatten()
|
#return np.array(ke, dtype=float).flatten()
|
||||||
return ke
|
return ke
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ class _MSCALCULATOR(Calculator):
|
||||||
'NODES_EX_M' : 3,
|
'NODES_EX_M' : 3,
|
||||||
'NSPIN_M' : 1, # to change for spin dependent
|
'NSPIN_M' : 1, # to change for spin dependent
|
||||||
'NTH_M' : 2000,
|
'NTH_M' : 2000,
|
||||||
'NPH_M' : 2000,
|
'NPH_M' : 8000,
|
||||||
'NDIM_M' : 100000,
|
'NDIM_M' : 100000,
|
||||||
'N_TILT_M' : 11, # to change see extdir.f
|
'N_TILT_M' : 11, # to change see extdir.f
|
||||||
'N_ORD_M' : 250,
|
'N_ORD_M' : 250,
|
||||||
|
@ -615,7 +615,7 @@ class _PED(_MSCALCULATOR):
|
||||||
def _get_scan(self, scan_type='theta', phi=0,
|
def _get_scan(self, scan_type='theta', phi=0,
|
||||||
theta=np.linspace(-70, 70, 141), level=None,
|
theta=np.linspace(-70, 70, 141), level=None,
|
||||||
kinetic_energy=None, data=None,
|
kinetic_energy=None, data=None,
|
||||||
malloc={}):
|
malloc={}, other_parameters={}):
|
||||||
LOGGER.info("Computting the %s scan...", scan_type)
|
LOGGER.info("Computting the %s scan...", scan_type)
|
||||||
if data:
|
if data:
|
||||||
self.iodata = data
|
self.iodata = data
|
||||||
|
@ -650,6 +650,13 @@ class _PED(_MSCALCULATOR):
|
||||||
|
|
||||||
self.spectroscopy_parameters.set_parameter('level', level)
|
self.spectroscopy_parameters.set_parameter('level', level)
|
||||||
|
|
||||||
|
# It is still possible to modify any option right before runing phagen
|
||||||
|
# and spec
|
||||||
|
for k, v in other_parameters.items():
|
||||||
|
grp_str, param_str = k.split('.')
|
||||||
|
grp = getattr(self, grp_str)
|
||||||
|
grp.set_parameter(param_str, v, force=True)
|
||||||
|
|
||||||
self.get_tmatrix()
|
self.get_tmatrix()
|
||||||
self.run_spec(malloc)
|
self.run_spec(malloc)
|
||||||
|
|
||||||
|
@ -851,7 +858,7 @@ class _PED(_MSCALCULATOR):
|
||||||
return self.iodata
|
return self.iodata
|
||||||
|
|
||||||
def get_scattering_factors(self, level='1s', kinetic_energy=None,
|
def get_scattering_factors(self, level='1s', kinetic_energy=None,
|
||||||
data=None):
|
data=None, **kwargs):
|
||||||
"""Computes the scattering factors of all prototypical atoms in the
|
"""Computes the scattering factors of all prototypical atoms in the
|
||||||
cluster.
|
cluster.
|
||||||
|
|
||||||
|
@ -870,11 +877,11 @@ class _PED(_MSCALCULATOR):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = self._get_scan(scan_type='scatf', level=level, data=data,
|
data = self._get_scan(scan_type='scatf', level=level, data=data,
|
||||||
kinetic_energy=kinetic_energy)
|
kinetic_energy=kinetic_energy, **kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_theta_scan(self, phi=0, theta=np.linspace(-70, 70, 141),
|
def get_theta_scan(self, phi=0, theta=np.linspace(-70, 70, 141),
|
||||||
level=None, kinetic_energy=None, data=None):
|
level=None, kinetic_energy=None, data=None, **kwargs):
|
||||||
"""Computes a polar scan of the emitted photoelectrons.
|
"""Computes a polar scan of the emitted photoelectrons.
|
||||||
|
|
||||||
:param phi: The azimuthal angle in degrees. See
|
:param phi: The azimuthal angle in degrees. See
|
||||||
|
@ -891,11 +898,12 @@ class _PED(_MSCALCULATOR):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = self._get_scan(scan_type='theta', level=level, theta=theta,
|
data = self._get_scan(scan_type='theta', level=level, theta=theta,
|
||||||
phi=phi, kinetic_energy=kinetic_energy, data=data)
|
phi=phi, kinetic_energy=kinetic_energy,
|
||||||
|
data=data, **kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_phi_scan(self, phi=np.linspace(0, 359, 359), theta=0,
|
def get_phi_scan(self, phi=np.linspace(0, 359, 359), theta=0,
|
||||||
level=None, kinetic_energy=None, data=None):
|
level=None, kinetic_energy=None, data=None, **kwargs):
|
||||||
"""Computes an azimuthal scan of the emitted photoelectrons.
|
"""Computes an azimuthal scan of the emitted photoelectrons.
|
||||||
|
|
||||||
:param phi: All the values of the azimuthal angle to be computed. See
|
:param phi: All the values of the azimuthal angle to be computed. See
|
||||||
|
@ -912,12 +920,13 @@ class _PED(_MSCALCULATOR):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = self._get_scan(scan_type='phi', level=level, theta=theta,
|
data = self._get_scan(scan_type='phi', level=level, theta=theta,
|
||||||
phi=phi, kinetic_energy=kinetic_energy, data=data)
|
phi=phi, kinetic_energy=kinetic_energy,
|
||||||
|
data=data, **kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_theta_phi_scan(self, phi=np.linspace(0, 360),
|
def get_theta_phi_scan(self, phi=np.linspace(0, 360),
|
||||||
theta=np.linspace(0, 90, 45), level=None,
|
theta=np.linspace(0, 90, 45), level=None,
|
||||||
kinetic_energy=None, data=None):
|
kinetic_energy=None, data=None, **kwargs):
|
||||||
"""Computes a stereographic scan of the emitted photoelectrons.
|
"""Computes a stereographic scan of the emitted photoelectrons.
|
||||||
|
|
||||||
The azimuth ranges from 0 to 360° and the polar angle ranges from 0 to
|
The azimuth ranges from 0 to 360° and the polar angle ranges from 0 to
|
||||||
|
@ -934,11 +943,11 @@ class _PED(_MSCALCULATOR):
|
||||||
"""
|
"""
|
||||||
data = self._get_scan(scan_type='theta_phi', level=level, theta=theta,
|
data = self._get_scan(scan_type='theta_phi', level=level, theta=theta,
|
||||||
phi=phi, kinetic_energy=kinetic_energy, data=data,
|
phi=phi, kinetic_energy=kinetic_energy, data=data,
|
||||||
malloc={'NPH_M': 8000})
|
**kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_energy_scan(self, phi=0, theta=0,
|
def get_energy_scan(self, phi=0, theta=0,
|
||||||
level=None, kinetic_energy=None, data=None):
|
level=None, kinetic_energy=None, data=None, **kwargs):
|
||||||
"""Computes an energy scan of the emitted photoelectrons.
|
"""Computes an energy scan of the emitted photoelectrons.
|
||||||
|
|
||||||
:param phi: All the values of the azimuthal angle to be computed. See
|
:param phi: All the values of the azimuthal angle to be computed. See
|
||||||
|
@ -955,7 +964,8 @@ class _PED(_MSCALCULATOR):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
data = self._get_scan(scan_type='energy', level=level, theta=theta,
|
data = self._get_scan(scan_type='energy', level=level, theta=theta,
|
||||||
phi=phi, kinetic_energy=kinetic_energy, data=data)
|
phi=phi, kinetic_energy=kinetic_energy,
|
||||||
|
data=data, **kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1310,8 +1310,8 @@ class ScanParameters(BaseParameters):
|
||||||
# LOGGER.error('Incompatible options!')
|
# LOGGER.error('Incompatible options!')
|
||||||
# raise ValueError(msg)
|
# raise ValueError(msg)
|
||||||
|
|
||||||
# p._value = np.array(p.value, dtype=np.float).flatten()
|
# p._value = np.array(p.value, dtype=float).flatten()
|
||||||
arr = np.array(p.value, dtype=np.float).flatten()
|
arr = np.array(p.value, dtype=float).flatten()
|
||||||
|
|
||||||
theta0 = arr[0]
|
theta0 = arr[0]
|
||||||
theta1 = arr[-1]
|
theta1 = arr[-1]
|
||||||
|
@ -1345,7 +1345,7 @@ class ScanParameters(BaseParameters):
|
||||||
# LOGGER.error('Incompatible options')
|
# LOGGER.error('Incompatible options')
|
||||||
# raise ValueError(msg)
|
# raise ValueError(msg)
|
||||||
|
|
||||||
arr = np.array(p.value, dtype=np.float).flatten()
|
arr = np.array(p.value, dtype=float).flatten()
|
||||||
|
|
||||||
phi0 = arr[0]
|
phi0 = arr[0]
|
||||||
phi1 = arr[-1]
|
phi1 = arr[-1]
|
||||||
|
@ -1539,7 +1539,7 @@ class CalculationParameters(BaseParameters):
|
||||||
Parameter('cutoff_factor', types=(int, float),
|
Parameter('cutoff_factor', types=(int, float),
|
||||||
limits=(1e-4, 999.9999), default=0.01, private=False),
|
limits=(1e-4, 999.9999), default=0.01, private=False),
|
||||||
Parameter('mean_free_path', types=(int, float, str),
|
Parameter('mean_free_path', types=(int, float, str),
|
||||||
default='SeahDench', allowed_values=('mono', 'SeahDench'),
|
default='SeahDench', #allowed_values=('mono', 'SeahDench'),
|
||||||
doc="""
|
doc="""
|
||||||
The electron mean free path value. You can either:
|
The electron mean free path value. You can either:
|
||||||
- Enter a value (in Angströms), in this case any value <=0 will disable the damping
|
- Enter a value (in Angströms), in this case any value <=0 will disable the damping
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/utils.py
|
# Source file : src/msspec/utils.py
|
||||||
# Last modified: ven. 10 avril 2020 15:49:35
|
# Last modified: Thu, 06 Oct 2022 18:19:16 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes1.fr> 1665073156 +0200
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +38,11 @@ import ase.atom
|
||||||
from ase import Atom
|
from ase import Atom
|
||||||
from ase import Atoms
|
from ase import Atoms
|
||||||
|
|
||||||
|
try:
|
||||||
from msspec.iodata import Data
|
from msspec.iodata import Data
|
||||||
|
except ImportError as err:
|
||||||
|
print(err)
|
||||||
|
|
||||||
from msspec.misc import LOGGER
|
from msspec.misc import LOGGER
|
||||||
|
|
||||||
|
|
||||||
|
@ -476,7 +480,7 @@ def hemispherical_cluster(cluster, emitter_tag=0, emitter_plane=0, diameter=0,
|
||||||
a = cell[:, 0].max() # a lattice parameter
|
a = cell[:, 0].max() # a lattice parameter
|
||||||
|
|
||||||
# the number of planes in the cluster
|
# the number of planes in the cluster
|
||||||
p = np.alen(np.unique(np.round(cluster.get_positions()[:, 2], 4)))
|
p = len(np.unique(np.round(cluster.get_positions()[:, 2], 4)))
|
||||||
# the symbol of your emitter
|
# the symbol of your emitter
|
||||||
symbol = cluster[np.where(cluster.get_tags() == emitter_tag)[0][0]].symbol
|
symbol = cluster[np.where(cluster.get_tags() == emitter_tag)[0][0]].symbol
|
||||||
|
|
||||||
|
@ -581,7 +585,7 @@ def hemispherical_cluster(cluster, emitter_tag=0, emitter_plane=0, diameter=0,
|
||||||
# an array of all unique remaining z
|
# an array of all unique remaining z
|
||||||
all_z = np.sort(np.unique(np.round(cluster.get_positions()[:, 2], 4)))
|
all_z = np.sort(np.unique(np.round(cluster.get_positions()[:, 2], 4)))
|
||||||
|
|
||||||
assert emitter_plane < np.alen(all_z), ("There are not enough existing "
|
assert emitter_plane < len(all_z), ("There are not enough existing "
|
||||||
"plans.")
|
"plans.")
|
||||||
ze = all_z[- emitter_plane - 1] # the z-coordinate of the emitter
|
ze = all_z[- emitter_plane - 1] # the z-coordinate of the emitter
|
||||||
Atoms.translate(cluster, [0, 0, -ze]) # put the emitter in (0,0,0)
|
Atoms.translate(cluster, [0, 0, -ze]) # put the emitter in (0,0,0)
|
||||||
|
|
|
@ -16,39 +16,38 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/version.py
|
# Source file : src/msspec/version.py
|
||||||
# Last modified: ven. 10 avril 2020 17:34:38
|
# Last modified: Thu, 06 Oct 2022 18:19:16 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes1.fr> 1665073156 +0200
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pkg_resources import DistributionNotFound
|
from importlib.metadata import version
|
||||||
from pkg_resources import get_distribution
|
import subprocess
|
||||||
from pkg_resources import parse_version
|
|
||||||
|
|
||||||
# find the version number
|
# find the version number
|
||||||
# 1- Try to read it from the git info
|
# 1- If it fails, try to read it from the distribution file
|
||||||
# 2- If it fails, try to read it from the distribution file
|
# 2- Try to read it from the git info
|
||||||
# 3- If it fails, try to read it from the VERSION file
|
# 3- If it fails, try to read it from the VERSION file
|
||||||
|
|
||||||
|
PKGNAME = 'msspec'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools_scm import get_version
|
__version__ = version(PKGNAME)
|
||||||
v = get_version(root='../../', relative_to=__file__, version_scheme="post-release")
|
|
||||||
v = parse_version(v)
|
|
||||||
if v._version.post[-1] == 0:
|
|
||||||
__version__ = v.base_version
|
|
||||||
else:
|
|
||||||
__version__ = v.public
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
try:
|
try:
|
||||||
__version__ = get_distribution(__name__.strip('.version')).version
|
p = subprocess.run(["git", "describe"], capture_output=True, text=True)
|
||||||
|
if p.stdout not in ("", None):
|
||||||
|
__version__ = p.stdout.strip()
|
||||||
|
else:
|
||||||
|
raise NameError("git describe failed!")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
try:
|
try:
|
||||||
thisfile_path = os.path.abspath(__file__)
|
thisfile_path = os.path.abspath(__file__)
|
||||||
thisfile_dir = os.path.dirname(thisfile_path)
|
thisfile_dir = os.path.dirname(thisfile_path)
|
||||||
versionfile = os.path.join(thisfile_dir, "../VERSION")
|
versionfile = os.path.join(thisfile_dir, "../VERSION")
|
||||||
with open(versionfile, "r") as fd:
|
with open(versionfile, "r") as fd:
|
||||||
__version__ = fd.readline()
|
__version__ = fd.readline().strip()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("Unable to get the version number!")
|
print("Unable to get the version number!")
|
||||||
__version__ = "9.9.9"
|
__version__ = "9.9.9"
|
||||||
|
|
|
@ -41,8 +41,7 @@ F2PYFLAGS_DBG = --debug-capi --debug
|
||||||
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
|
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
|
||||||
# CORE CONFIGURATION #
|
# CORE CONFIGURATION #
|
||||||
################################################################################
|
################################################################################
|
||||||
#VERSION:=$(shell python -c "import msspec; print(msspec.__version__)")
|
VERSION:=$(shell git describe)
|
||||||
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
|
|
||||||
VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION)
|
VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ ase
|
||||||
h5py
|
h5py
|
||||||
ipython
|
ipython
|
||||||
lxml
|
lxml
|
||||||
matplotlib
|
matplotlib==3.4.3
|
||||||
numpy
|
numpy
|
||||||
Pint
|
Pint
|
||||||
pandas
|
pandas
|
||||||
|
|
Loading…
Reference in New Issue