Commit 10424cf2 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed to QCMS data.

parent a76b2e47
Pipeline #82206 canceled with stages
in 2 minutes and 35 seconds
......@@ -282,10 +282,23 @@ export const domains = ({
label: 'Formula'
},
'qcms.chemical': {
label: 'Chemical name'
label: 'Material name'
},
'qcms.quantum_computer_system': {
label: 'System'
},
'qcms.quantum_computing_libraries': {
label: 'Libraries'
},
'qcms.computation_datetime': {
label: 'Compute date',
supportsSort: true,
render: entry => new Date(entry.qcms.computation_datetime).toLocaleDateString()
}
},
defaultSearchResultColumns: ['formula', 'qcms.chemical'],
defaultSearchResultColumns: [
'formula', 'qcms.chemical', 'qcms.quantum_computer_system', 'qcms.quantum_computing_libraries',
'qcms.computation_datetime'],
/**
* A component to render the domain specific quantities in the metadata card of
* the entry view. Needs to work with props: data (the entry data from the API),
......
......@@ -99,11 +99,13 @@ class ArchiveEntryView extends React.Component {
if (doesNotExist) {
return (
<Typography className={classes.error}>
No archive exists for this entry. Either the archive was not generated due
to parsing or other processing errors (check the log tab), or the entry it
self does not exist.
</Typography>
<EntryPageContent>
<Typography className={classes.error}>
No archive exists for this entry. Either the archive was not generated due
to parsing or other processing errors (check the log tab), or the entry it
self does not exist.
</Typography>
</EntryPageContent>
)
}
......
......@@ -121,10 +121,12 @@ class ArchiveLogView extends React.Component {
if (doesNotExist) {
return (
<Typography>
No archive log does exist for this entry. Most likely the entry itself does not
exist.
</Typography>
<EntryPageContent>
<Typography>
No archive log does exist for this entry. Most likely the entry itself does not
exist.
</Typography>
</EntryPageContent>
)
}
......
import React from 'react'
import React, { useState } from 'react'
import PropTypes from 'prop-types'
import Quantity from '../Quantity'
import { Typography } from '@material-ui/core'
import { apiBase } from '../../config'
export default function QCMSEntryOverview(props) {
const [previewBroken, setPreviewBroken] = useState(false)
if (!props.data) {
return <Typography color="error">No metadata available</Typography>
}
const {data} = props
const dirname = data.mainfile.substring(0, data.mainfile.lastIndexOf('/'))
const relative_preview_url = `${apiBase}/raw/${data.upload_id}/${dirname}/circuit.png`
return (
<Quantity column>
<Quantity row>
<Quantity quantity="formula" label="formula" noWrap {...props} />
<Quantity quantity="qcms.chemical" label="chemical name" noWrap {...props} />
</Quantity>
<Quantity row>
<Quantity quantity="qcms.quantum_computer_system" label="system" noWrap {...props} />
<Quantity quantity="qcms.quantum_computing_libraries" label="libraries" noWrap {...props} />
</Quantity>
<Quantity label="compute time">
<Typography noWrap>{new Date(data.qcms.computation_datetime).toLocaleDateString()}</Typography>
</Quantity>
{!previewBroken &&
<Quantity label="circuit" {...props}>
<img alt="circuit" style={{maxWidth: '100%', height: 'auto'}} src={relative_preview_url} onError={() => setPreviewBroken(true)}></img>
</Quantity>}
</Quantity>
)
}
......
......@@ -44,9 +44,11 @@ def parse(
entry_archive = datamodel.EntryArchive()
metadata = entry_archive.m_create(datamodel.EntryMetadata)
try:
cwd = os.getcwd()
mainfile_path = os.path.abspath(mainfile_path)
os.chdir(os.path.abspath(os.path.dirname(mainfile_path)))
parser.parse(mainfile_path, entry_archive, logger=logger)
os.chdir(cwd)
except Exception as e:
logger.error('parsing was not successful', exc_info=e)
......
......@@ -12,11 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from nomad.metainfo import MSection, Quantity, Package
from nomad.metainfo import MSection, Quantity, Package, Datetime, SubSection
m_package = Package()
class QuantumCircuit(MSection):
processors = Quantity(type=str, shape=['0..*'])
number_of_registers = Quantity(type=int)
simulated = Quantity(type=bool)
class QuantumCMS(MSection):
'''
The root section for all (meta)data that belongs to a single calculation.
......@@ -33,5 +39,15 @@ class QuantumCMS(MSection):
type=str, shape=['1..*'],
description=''' Labels for the atoms/elements that comprise the simulated material ''')
transformation = Quantity(type=str)
quantum_computer_system = Quantity(type=str)
quantum_computing_libraries = Quantity(type=str, shape=['0..*'])
computation_datetime = Quantity(type=Datetime)
number_of_shots = Quantity(type=int)
quantum_volume = Quantity(type=int)
section_quantum_circuit = SubSection(sub_section=QuantumCircuit)
m_package.__init_metainfo__()
......@@ -17,7 +17,7 @@ Quantum computational materials science metadata
'''
from nomad import config
from nomad.metainfo import Quantity, MSection, Section
from nomad.metainfo import Quantity, MSection, Section, Datetime
from nomad.metainfo.search_extension import Search
......@@ -26,6 +26,9 @@ class QCMSMetadata(MSection):
# sample quantities
chemical = Quantity(type=str, default='not processed', a_search=Search())
quantum_computer_system = Quantity(type=str, a_search=Search())
quantum_computing_libraries = Quantity(type=str, shape=['0..*'], a_search=Search())
computation_datetime = Quantity(type=Datetime, a_search=Search())
# TODO move
quantities = Quantity(type=str, shape=['0..*'], default=[], a_search=Search())
......@@ -53,6 +56,11 @@ class QCMSMetadata(MSection):
if not self.chemical:
self.chemical = config.services.unavailable_value
self.quantum_computer_system = root_section.quantum_computer_system
if root_section.quantum_computing_libraries is not None:
self.quantum_computing_libraries = root_section.quantum_computing_libraries
self.computation_datetime = root_section.computation_datetime
quantities = set()
quantities.add(root_section.m_def.name)
......
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