Commit fb365b4a authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Improved the handling of issues with geometry optimization data.

parent 5fa00024
Pipeline #95245 passed with stages
in 27 minutes and 3 seconds
......@@ -225,30 +225,34 @@ export default function DFTEntryOverview({data}) {
// Gather energies, trajectory and energy change threshold from geometry
// optimization
if (wfType === 'geometry_optimization') {
const calculations = section_wf.calculations_ref
let failed = false
let energies = []
const trajectory = []
let initialEnergy = null
let failed = false
if (calculations) {
try {
const calculations = section_wf.calculations_ref
let initialEnergy = null
if (!calculations) {
throw Error('no calculations')
}
for (let i = 0; i < calculations.length; ++i) {
let ref = calculations[i]
const calc = resolveRef(ref, archive)
let e = calc?.energy_total
let e = calc.energy_total
if (e === undefined) {
failed = true
break
if (i === calculations.length - 1) {
break
} else {
throw Error('invalid energy value')
}
}
if (i === 0) {
initialEnergy = e
}
energies.push(e - initialEnergy)
let sys = calc?.single_configuration_calculation_to_system_ref
let sys = calc.single_configuration_calculation_to_system_ref
sys = resolveRef(sys, archive)
if (sys === undefined) {
failed = true
break
throw Error('invalid system reference')
}
trajectory.push({
species: sys.atom_species,
......@@ -257,6 +261,8 @@ export default function DFTEntryOverview({data}) {
pbc: sys.configuration_periodic_dimensions
})
}
} catch (err) {
failed = true
}
if (!failed) {
energies = convertSI(energies, 'joule', {energy: 'electron_volt'}, false)
......
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