Commit 2412eb52 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Reverted to functionin tests, trying to speed up testing with parallelization.

parent 6903225e
Pipeline #66586 failed with stages
in 10 minutes and 6 seconds
......@@ -31,7 +31,7 @@ build:
stage: build
before_script:
- git submodule sync
- git submodule update --init
- git submodule update --init --jobs=4
- ./gitinfo.sh
script:
# ignore test directories of dependencies, there is a lot of data that we not use
......@@ -96,7 +96,7 @@ tests:
script:
- cd /app
- ls /builds
- python -m pytest --cov=nomad -sv tests
- python -m pytest -n 4 --cov=nomad -sv tests
except:
refs:
- tags
......
......@@ -25,8 +25,6 @@ import fractions
from matid import SymmetryAnalyzer
from matid.geometry import get_dimensionality
from matid import Classifier
from matid.classifications import Atom, Class0D, Class1D, Class3D, Material2D, Surface
from nomadcore.structure_types import structure_types_by_spacegroup as str_types_by_spg
......@@ -266,32 +264,31 @@ class SystemNormalizer(SystemBasedNormalizer):
def system_type_analysis(self, atoms) -> None:
"""
Determine the system type with Matid. Write the system type to the
backend. If it is too expensive to run Matid's system detection or if
the system is too large to analyze, the system type is left undefined
Determine the dimensionality and hence the system type of the system with
Matid. Write the system type to the backend.
"""
system_type = config.services.unavailable_value
try:
if atoms.get_number_of_atoms() <= config.normalize.system_classification_with_clusters_threshold:
classifier = Classifier(
max_2d_single_cell_size=config.normalize.max_2d_single_cell_size,
cluster_threshold=config.normalize.clusters_threshold
)
class_matid = classifier.classify(atoms)
if isinstance(class_matid, Class1D):
system_type = '1D'
elif isinstance(class_matid, Surface):
system_type = 'surface'
elif isinstance(class_matid, Material2D):
system_type = '2D'
elif isinstance(class_matid, Class3D):
system_type = 'bulk'
elif isinstance(class_matid, Atom):
if atoms.get_number_of_atoms() > config.normalize.system_classification_with_clusters_threshold:
# it is too expensive to run Matid's cluster detection, just check pbc
dimensionality = np.sum(atoms.get_pbc())
else:
dimensionality = get_dimensionality(
atoms, cluster_threshold=3.1, return_clusters=False)
if dimensionality is None:
pass
elif dimensionality == 0:
if atoms.get_number_of_atoms() == 1:
system_type = 'atom'
elif isinstance(class_matid, Class0D):
else:
system_type = 'molecule / cluster'
elif dimensionality == 1:
system_type = '1D'
elif dimensionality == 2:
system_type = '2D / surface'
elif dimensionality == 3:
system_type = 'bulk'
except Exception as e:
self.logger.error(
'matid project system classification failed', exc_info=e, error=str(e))
......@@ -315,9 +312,10 @@ class SystemNormalizer(SystemBasedNormalizer):
None: The method should write symmetry variables
to the backend which is member of this class.
"""
# Try to use Matid's symmetry analyzer to analyze the ASE object.
# Try to use Matid's symmetry analyzer to anlyze the ASE object.
# TODO: dts, find out what the symmetry_tol does.
try:
symm = SymmetryAnalyzer(atoms, symmetry_tol=config.normalize.symmetry_tolerance)
symm = SymmetryAnalyzer(atoms, symmetry_tol=0.1)
space_group_number = symm.get_space_group_number()
......
......@@ -63,6 +63,7 @@ pylint_plugin_utils==0.5
pylint_mongoengine==0.3.3
pycodestyle
pytest==3.10.0 # celery fixtures not compatible with 4.x
pytest-xdist
pytest-timeout
pytest-cov
rope
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment