From e36373a57678f2631e7cc67c4e049af6ed876bac Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Tue, 30 Nov 2021 16:56:20 +0100 Subject: [PATCH 1/5] Fixed bug in 'mean_free_path' option. It was impossible to enter a numerical value. The 'allowed_values' keyword was set in the definition of the 'mean_free_path' parameter, I commented it to allow any value for this option. --- src/msspec/parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msspec/parameters.py b/src/msspec/parameters.py index 493a279..17f8ac8 100644 --- a/src/msspec/parameters.py +++ b/src/msspec/parameters.py @@ -1539,7 +1539,7 @@ class CalculationParameters(BaseParameters): Parameter('cutoff_factor', types=(int, float), limits=(1e-4, 999.9999), default=0.01, private=False), Parameter('mean_free_path', types=(int, float, str), - default='SeahDench', allowed_values=('mono', 'SeahDench'), + default='SeahDench', #allowed_values=('mono', 'SeahDench'), doc=""" 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 From 75c599de953a9d5c118cbddb7c620791f6dd3c75 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Tue, 30 Nov 2021 17:53:47 +0100 Subject: [PATCH 2/5] Added 'other_parameters' keyword in _get_scan. This allows to set or modify any option right before runing Phagen and Spec. Mostly for debug purposes. --- src/msspec/calculator.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/msspec/calculator.py b/src/msspec/calculator.py index d5ba42c..6234094 100644 --- a/src/msspec/calculator.py +++ b/src/msspec/calculator.py @@ -615,7 +615,7 @@ class _PED(_MSCALCULATOR): def _get_scan(self, scan_type='theta', phi=0, theta=np.linspace(-70, 70, 141), level=None, kinetic_energy=None, data=None, - malloc={}): + malloc={}, other_parameters={}): LOGGER.info("Computting the %s scan...", scan_type) if data: self.iodata = data @@ -650,6 +650,13 @@ class _PED(_MSCALCULATOR): 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.run_spec(malloc) @@ -851,7 +858,7 @@ class _PED(_MSCALCULATOR): return self.iodata 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 cluster. @@ -870,11 +877,11 @@ class _PED(_MSCALCULATOR): """ data = self._get_scan(scan_type='scatf', level=level, data=data, - kinetic_energy=kinetic_energy) + kinetic_energy=kinetic_energy, **kwargs) return data 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. :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, - phi=phi, kinetic_energy=kinetic_energy, data=data) + phi=phi, kinetic_energy=kinetic_energy, + data=data, **kwargs) return data 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. :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, - phi=phi, kinetic_energy=kinetic_energy, data=data) + phi=phi, kinetic_energy=kinetic_energy, + data=data, **kwargs) return data def get_theta_phi_scan(self, phi=np.linspace(0, 360), 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. 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, phi=phi, kinetic_energy=kinetic_energy, data=data, - malloc={'NPH_M': 8000}) + malloc={'NPH_M': 8000}, **kwargs) return data 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. :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, - phi=phi, kinetic_energy=kinetic_energy, data=data) + phi=phi, kinetic_energy=kinetic_energy, + data=data, **kwargs) return data From 38023dcd5246ffa70e03b4b74930e0830d654f47 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Thu, 2 Dec 2021 12:20:40 +0100 Subject: [PATCH 3/5] Bug in matplotlib 3.5.0 There is presumably a bug when using pcolormesh with msspec in matplotlib 3.5.0. The stereo projection does not work properly and the CPU is rising at 100% as well as the memory usage. Meanwhile, the event loop of Wx is affected freezing the GUI. Reverting to last stable 3.4.3 version fixes the problem for now. A true fix should be found asap. --- src/pip.freeze | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip.freeze b/src/pip.freeze index 406ab63..196bfa6 100644 --- a/src/pip.freeze +++ b/src/pip.freeze @@ -2,7 +2,7 @@ ase h5py ipython lxml -matplotlib +matplotlib==3.4.3 numpy Pint pandas From 74ca8f467f59400bae4b2ae2d3b6e135f641deaf Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Mon, 13 Dec 2021 18:51:12 +0100 Subject: [PATCH 4/5] Removed malloc NPH_M parameter. In get_theta_phi_scan, the malloc keyword was given with NPH_M=8000. It was enough for most of calculations but it was also impossible to change in cases where more memory was needed. The keyword is now removed so that it can be direclty specified by the user if needed. The default value was increased to 8000 instead of 2000. --- src/msspec/calculator.py | 4 ++-- utils/dockerized/linux/msspec | 0 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 utils/dockerized/linux/msspec diff --git a/src/msspec/calculator.py b/src/msspec/calculator.py index 6234094..8b937be 100644 --- a/src/msspec/calculator.py +++ b/src/msspec/calculator.py @@ -383,7 +383,7 @@ class _MSCALCULATOR(Calculator): 'NODES_EX_M' : 3, 'NSPIN_M' : 1, # to change for spin dependent 'NTH_M' : 2000, - 'NPH_M' : 2000, + 'NPH_M' : 8000, 'NDIM_M' : 100000, 'N_TILT_M' : 11, # to change see extdir.f 'N_ORD_M' : 250, @@ -943,7 +943,7 @@ class _PED(_MSCALCULATOR): """ data = self._get_scan(scan_type='theta_phi', level=level, theta=theta, phi=phi, kinetic_energy=kinetic_energy, data=data, - malloc={'NPH_M': 8000}, **kwargs) + **kwargs) return data def get_energy_scan(self, phi=0, theta=0, diff --git a/utils/dockerized/linux/msspec b/utils/dockerized/linux/msspec old mode 100644 new mode 100755 From a4351f56067cb0dff1127310624609000f4e6bd5 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Wed, 5 Oct 2022 13:40:22 +0200 Subject: [PATCH 5/5] Add a "light" installation of msspec This is similar to a "devel" installation, but only the virtualenv is created and the msspec package is installed inside (not in edit mode). Bindings to the Fortran code are not built. It is intended to use msspec functions to create clusters but without having to install wx. --- Makefile | 5 +++++ src/msspec/utils.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a3d284a..1a49fa5 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,11 @@ devel: venv pybinding wx @$(INSIDE_VENV) pip install -e src/ +light: VENV_PATH = ./_venv +light: venv + @$(INSIDE_VENV) pip install src/ + + _build_wx/wxPython.target: @$(INSIDE_VENV) echo "Building wxPython for your `python --version 2>&1` under Linux $(DISTRO_RELEASE)..." # Create a folder to build wx into diff --git a/src/msspec/utils.py b/src/msspec/utils.py index 1dee866..38c289c 100644 --- a/src/msspec/utils.py +++ b/src/msspec/utils.py @@ -38,7 +38,11 @@ import ase.atom from ase import Atom from ase import Atoms -from msspec.iodata import Data +try: + from msspec.iodata import Data +except ImportError as err: + print(err) + from msspec.misc import LOGGER