Commit a386f779 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Merge branch 'v0.9.6' into 'master'

Merge for release v0.9.6.

Closes #443

See merge request !213
parents d0900fdf 3835e030
Pipeline #87092 passed with stages
in 8 seconds
Markus Scheidgen <markus.scheidgen@gmail.com>
Lauri Himanen <lauri.himanen@gmail.com>
Alvin Noe Ladines <ladinesalvinnoe@gmail.com>
Speckhard, Daniel <dts@physik.hu-berlin.de>
Martin Kuban <kuban@physik.hu-berlin.de>
Cuauhtémoc Salazar <temok@physik.hu-berlin.de>
\ No newline at end of file
# Copyright 2018 Markus Scheidgen
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an"AS IS" BASIS,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This dockerfile describes an image that can be used to run the
# - nomad processing worker
......
......@@ -10,6 +10,14 @@ Install from pypi
pip install nomad-lab
If pip tries to use and compile sources and this creates errors, it can be told to prefer binary version:
.. code-block:: sh
pip install nomad-lab --prefer-binary
Download and install latest release from nomad
.. code-block:: sh
......
Copyright The NOMAD Authors.
This file is part of NOMAD. See https://nomad-lab.eu for further info.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
......@@ -313,3 +313,19 @@ Keys that are present for events related to exceptions:
are stored automatically into this key. If you wish to search for exceptions
in Kibana, you will want to use this value as it will be indexed unlike the
full exception object.
Copyright Notices
-----------------
We follow this `recommendation <https://www.linuxfoundation.org/blog/2020/01/copyright-notices-in-open-source-software-projects/>`_
of the Linux Foundation for the copyright notice that is placed on top of each source
code file.
It is intended to provide a broad generic statement that allows all authors/contributors
of the NOMAD project to claim their copyright, independent of their organization or
individual ownership.
You can simply copy the notice from another file. From time to time we can use a tool
like `licenseheaders <https://pypi.org/project/licenseheaders/>`_ to ensure correct
notices. In addition we keep an purely informative AUTHORS file.
\ No newline at end of file
How to write a normalizer
=========================
Introduction
------------
A normalizer can be any Python algorithm that takes the archive of an entry as input
and manipulates (usually expands) the given archive. This way a normalizer can add
additional sections and quantities based on the information already available in the archive.
All normalizer are executed after parsing. Normalizer are run for each entry (i.e. each
set of files that represent a code run). Normalizer are run in a particular order and
you can make assumptions about the availability of data created by other normalizer.
A normalizer is run in any case, but it might chose not to do anything. A normalizer
can perform any operation on the archive, but in general should not alter existing information,
but just add more information.
Starting example
----------------
This is an example for a very simple normalizer that computes the unit cell volume from
a given lattice and adds it to the archive.
.. code-block:: python
from nomad.normalizing import Normalizer
from nomad.atomutils import get_volume
class UnitCellVolumeNormalizer(Normalizer):
def normalize(self):
for system in self.archive.section_run[-1].section_system:
system.unit_cell_volume = get_volume(lattice_vectors.magnitude)
self.logger.debug('computed unit cell volume', system_index=system.m_parent_index)
You simply inherit from ``Normalizer`` and implement the ``normalize`` method. The
``archive`` is available as a field. There is also a logger on the object that can be used.
Be aware that the processing will already report the run of the normalizer, log its execution
time, log any exceptions that might been thrown.
Of course, if you add new information to the archive, this needs also be defined in the
metainfo. For example you could extend the section system with a special system definition
that extends the existing section system definition:
.. code-block:: python
import numpy as np
from nomad.datamodel.metainfo.public import section_system as System
from nomad.metainfo import Section, Quantity
class UnitCellVolumeSystem(System):
m_def = Section(extends_base_section=True)
unit_cell_volume = Quantity(np.dtype(np.float64), unit='m^3')
Or you simply alter the ``section_system`` class (``nomad/datamodel/metainfo/public.py``).
System normalizer
-----------------
There is a special base-class for normalizing systems that allows to run the normalization
on all (or only the resulting `representative` system:
.. code-block:: python
from nomad.normalizing import SystemBasedNormalizer
from nomad.atomutils import get_volume
class UnitCellVolumeNormalizer(SystemBasedNormalizer):
def _normalize_system(self, system, is_representative):
system.unit_cell_volume = get_volume(lattice_vectors.magnitude)
The parameter ``is_representative`` will be true for the `representative` system, i.e.
the final step in a geometry optimization or other workflow.
Adding a normalizer to the processing
-------------------------------------
For any new normalizer class to be recognized by the processing, the normalizer class
needs to be added to the list of normalizers in ``nomad/normalizing/__init__.py``.
The order of the normalizers in this list will also determine the execution order of
the normalizers during processing.
.. code-block:: python
normalizers: Iterable[Type[Normalizer]] = [
SystemNormalizer,
UnitCellVolumeNormalizer,
OptimadeNormalizer,
DosNormalizer,
BandStructureNormalizer,
EncyclopediaNormalizer,
WorkflowNormalizer
]
Testing a normalizer
--------------------
To simply tryout a normalizer, you could use the CLI and run the parse command:
.. code-block:: sh
nomad --debug parse --show-archive <path-to-example-file>
But eventually you need to add a more formal test. Place your ``pytest``-tests in
``tests/normalizing/test_unitcellvolume.py`` similar to the existing tests. Necessary
test data can be added to ``tests/data/normalizers``.
......@@ -116,6 +116,12 @@ Finally, you can add nomad to the environment itself (including all extras)
pip install -e .[all]
```
If pip tries to use and compile sources and this creates errors, it can be told to prefer binary version:
```
pip install -e .[all] --prefer-binary
```
### Generate GUI artifacts
The NOMAD GUI requires static artifacts that are generated from the NOMAD Python codes.
```
......
......@@ -17,5 +17,6 @@ and infrastructure with a simplyfied architecture and consolidated code base.
dev/setup.md
dev/dev_guidelines.rst
dev/parser_tutorial.md
dev/normalizer.rst
api.rst
reference.rst
{
"name": "nomad-fair-gui",
"version": "0.9.5",
"version": "0.9.6",
"commit": "e98694e",
"private": true,
"dependencies": {
......
......@@ -9,7 +9,7 @@ window.nomadEnv = {
'matomoUrl': 'https://nomad-lab.eu/fairdi/stat',
'matomoSiteId': '2',
'version': {
'label': '0.9.5',
'label': '0.9.6',
'isBeta': false,
'isTest': true,
'usesBetaData': true,
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext, useLayoutEffect, useRef, useCallback, useEffect, useState } from 'react'
import {ReactComponent as AboutSvg} from './about.svg'
import PropTypes from 'prop-types'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, Tooltip, Typography, makeStyles } from '@material-ui/core'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useEffect, useState, useContext, useCallback, useRef, useMemo } from 'react'
import PropTypes from 'prop-types'
import { compose } from 'recompose'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, Tooltip } from '@material-ui/core'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import PropTypes from 'prop-types'
import Button from '@material-ui/core/Button'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import PropTypes from 'prop-types'
import clsx from 'clsx'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext, useState, useEffect } from 'react'
import { errorContext } from './errors'
import { apiContext } from './api'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import PropTypes from 'prop-types'
import FileSaver from 'file-saver'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import Button from '@material-ui/core/Button'
import TextField from '@material-ui/core/TextField'
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import clsx from 'clsx'
import { makeStyles } from '@material-ui/core/styles'
......
Markdown is supported
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