Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ladinesa committed Aug 19, 2024
1 parent decd6bc commit 4c5bc00
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 700 deletions.
138 changes: 69 additions & 69 deletions simulationworkflowschema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,82 @@


__all__ = [
"SimulationWorkflow",
"SimulationWorkflowMethod",
"SimulationWorkflowResults",
"ParallelSimulation",
"SerialSimulation",
"BeyondDFT",
"DFTMethod",
"ElectronicStructureOutputs",
"MagneticOutputs",
"SinglePoint",
"SinglePointMethod",
"SinglePointResults",
"GeometryOptimization",
"GeometryOptimizationMethod",
"GeometryOptimizationResults",
"MolecularDynamics",
"MolecularDynamicsMethod",
"MolecularDynamicsResults",
"Phonon",
"PhononMethod",
"PhononResults",
"EquationOfState",
"EquationOfStateMethod",
"EquationOfStateResults",
"ChemicalReaction",
"ChemicalReactionMethod",
"ChemicalReactionResults",
"Elastic",
"ElasticMethod",
"ElasticResults",
"FirstPrinciplesPlusTB",
"FirstPrinciplesPlusTBMethod",
"FirstPrinciplesPlusTBResults",
"DFTPlusGW",
"DFTPlusGWMethod",
"DFTPlusGWResults",
"XS",
"XSMethod",
"XSResults",
"DFTPlusTBPlusDMFT",
"DFTPlusTBPlusDMFTMethod",
"DFTPlusTBPlusDMFTResults",
"DMFTPlusMaxEnt",
"DMFTPlusMaxEntMethod",
"DMFTPlusMaxEntResults",
"PhotonPolarization",
"PhotonPolarizationMethod",
"PhotonPolarizationResults",
"Thermodynamics",
"ThermodynamicsMethod",
"ThermodynamicsResults",
'SimulationWorkflow',
'SimulationWorkflowMethod',
'SimulationWorkflowResults',
'ParallelSimulation',
'SerialSimulation',
'BeyondDFT',
'DFTMethod',
'ElectronicStructureOutputs',
'MagneticOutputs',
'SinglePoint',
'SinglePointMethod',
'SinglePointResults',
'GeometryOptimization',
'GeometryOptimizationMethod',
'GeometryOptimizationResults',
'MolecularDynamics',
'MolecularDynamicsMethod',
'MolecularDynamicsResults',
'Phonon',
'PhononMethod',
'PhononResults',
'EquationOfState',
'EquationOfStateMethod',
'EquationOfStateResults',
'ChemicalReaction',
'ChemicalReactionMethod',
'ChemicalReactionResults',
'Elastic',
'ElasticMethod',
'ElasticResults',
'FirstPrinciplesPlusTB',
'FirstPrinciplesPlusTBMethod',
'FirstPrinciplesPlusTBResults',
'DFTPlusGW',
'DFTPlusGWMethod',
'DFTPlusGWResults',
'XS',
'XSMethod',
'XSResults',
'DFTPlusTBPlusDMFT',
'DFTPlusTBPlusDMFTMethod',
'DFTPlusTBPlusDMFTResults',
'DMFTPlusMaxEnt',
'DMFTPlusMaxEntMethod',
'DMFTPlusMaxEntResults',
'PhotonPolarization',
'PhotonPolarizationMethod',
'PhotonPolarizationResults',
'Thermodynamics',
'ThermodynamicsMethod',
'ThermodynamicsResults',
]


def load_modules():
sub_modules = [
"general",
"single_point",
"geometry_optimization",
"molecular_dynamics",
"phonon",
"equation_of_state",
"chemical_reaction",
"elastic",
"tb",
"gw",
"xs",
"dmft",
"max_ent",
"photon_polarization",
"thermodynamics",
'general',
'single_point',
'geometry_optimization',
'molecular_dynamics',
'phonon',
'equation_of_state',
'chemical_reaction',
'elastic',
'tb',
'gw',
'xs',
'dmft',
'max_ent',
'photon_polarization',
'thermodynamics',
]
import simulationworkflowschema

for name in sub_modules:
sub_module = importlib.import_module(f"simulationworkflowschema.{name}")
sub_module = importlib.import_module(f'simulationworkflowschema.{name}')
for method in sub_module.__dict__:
if method in __all__:
setattr(simulationworkflowschema, method, sub_module.__dict__[method])
Expand All @@ -113,6 +113,6 @@ def load(self):


simulationworkflow_schema_entry_point = SimulationWorkflowSchemaEntryPoint(
name="SimulationWorkflowSchema",
description="Schema for the nomad simulation workflows.",
name='SimulationWorkflowSchema',
description='Schema for the nomad simulation workflows.',
)
10 changes: 5 additions & 5 deletions simulationworkflowschema/molecular_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,11 +1245,11 @@ def normalize(self, archive, logger):
else []
)
sec_diffusion.error_type = 'Pearson correlation coefficient'
sec_diffusion.errors = (
self._msd_results['error_diffusion_constant'][i_type]
if self._msd_results.get('error_diffusion_constant') is not None
else []
)
if self._msd_results.get('error_diffusion_constant') is not None:
errors = self._msd_results['error_diffusion_constant'][i_type]
sec_diffusion.errors = (
list(errors) if isinstance(errors, (list, np.ndarray)) else [errors]
)


class MolecularDynamicsResults(ThermodynamicsResults):
Expand Down
38 changes: 26 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
import ase.build
import re

# Load schemas first
import runschema
runschema.run_schema_entry_point.load()
import simulationworkflowschema
simulationworkflowschema.simulationworkflow_schema_entry_point.load()

from nomad.units import ureg
from nomad.normalizing import normalizers
from nomad.utils import get_logger
Expand Down Expand Up @@ -89,16 +83,36 @@
RadialDistributionFunctionValues,
)
from simulationworkflowschema.equation_of_state import EOSFit
from simulationworkflowschema.molecular_dynamics import MolecularDynamics, MolecularDynamicsMethod, MolecularDynamicsResults
from simulationworkflowschema.molecular_dynamics import (
MolecularDynamics,
MolecularDynamicsMethod,
MolecularDynamicsResults,
)
from simulationworkflowschema.single_point import SinglePoint
from simulationworkflowschema.geometry_optimization import GeometryOptimization, GeometryOptimizationMethod
from simulationworkflowschema.geometry_optimization import (
GeometryOptimization,
GeometryOptimizationMethod,
)
from simulationworkflowschema.elastic import Elastic, ElasticResults
from simulationworkflowschema.equation_of_state import EquationOfState, EquationOfStateResults
from simulationworkflowschema.equation_of_state import (
EquationOfState,
EquationOfStateResults,
)
from simulationworkflowschema.gw import DFTPlusGWMethod, DFTPlusGW as GWworkflow
from simulationworkflowschema.dmft import DFTPlusTBPlusDMFTMethod, DFTPlusTBPlusDMFT as DMFTworkflow
from simulationworkflowschema.photon_polarization import PhotonPolarization, PhotonPolarizationMethod, PhotonPolarizationResults
from simulationworkflowschema.dmft import (
DFTPlusTBPlusDMFTMethod,
DFTPlusTBPlusDMFT as DMFTworkflow,
)
from simulationworkflowschema.photon_polarization import (
PhotonPolarization,
PhotonPolarizationMethod,
PhotonPolarizationResults,
)
from simulationworkflowschema.xs import XS as XSworkflow
from simulationworkflowschema.max_ent import DMFTPlusMaxEntMethod, DMFTPlusMaxEnt as MaxEntworkflow
from simulationworkflowschema.max_ent import (
DMFTPlusMaxEntMethod,
DMFTPlusMaxEnt as MaxEntworkflow,
)


LOGGER = get_logger(__name__)
Expand Down
Loading

0 comments on commit 4c5bc00

Please sign in to comment.