Skip to content

Commit

Permalink
update structure visualizer; bands explore button
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek committed Mar 26, 2024
1 parent d890ff3 commit 1f41aa6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"mc-react-header": "^0.3.1",
"mc-react-library": "^0.3.0",
"mc-react-ptable-materials-grid": "^0.6.1",
"mc-react-structure-visualizer": "^0.6.0",
"mc-react-structure-visualizer": "^0.6.1",
"react": "^18.2.0",
"react-bootstrap": "^2.10.0",
"react-dom": "^18.2.0",
Expand Down
7 changes: 5 additions & 2 deletions src/DetailPage/BandsSection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { useState, useEffect } from "react";

import BandsVisualizer from "mc-react-bands";

import { fetchAiidaAttributes } from "../../common/utils.jsx";
import { ExploreButton } from "mc-react-library";

import { EXPLORE_URL } from "../../common/config";
import { REST_API_AIIDA } from "../../common/config.js";

/**
Expand Down Expand Up @@ -53,7 +55,8 @@ function BandsSection(props) {

return (
<div>
<b>Bands</b>
<b>Electronic band structure</b>{" "}
<ExploreButton explore_url={EXPLORE_URL} uuid={bands_uuid} />
{loading ? (
<span>loading</span>
) : (
Expand Down
16 changes: 13 additions & 3 deletions src/DetailPage/OverviewSection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ import {

import { EXPLORE_URL } from "../../common/config";

function floatFormatter(val, prec = 1) {
if (val >= 1e5 || (val < 0.01 && val !== 0)) {
return val.toExponential(prec);
}
return val.toFixed(prec);
}

function InfoBox(props) {
let info = props.compoundInfo;

Expand All @@ -38,7 +45,7 @@ function InfoBox(props) {
<li>Space group: {formatSpaceGroupSymbol(info["space_group"])}</li>
<li>Point group: {formatSpaceGroupSymbol(info["point_group"])}</li>
<li>Prototype: {formatChemicalFormula(info["prototype"])}</li>
<li>Abundance: {info["abundance"]}</li>
<li>Abundance: {floatFormatter(info["abundance"])}</li>
<li>Band gap: {format_aiida_prop("band_gap", "eV")}</li>
</ul>
</div>
Expand Down Expand Up @@ -102,11 +109,14 @@ function OverviewSection(props) {
<div className="subsection-title-container">
<b>Structure</b>{" "}
<ExploreButton
explore_url="https://www.materialscloud.org/explore/mc2d"
explore_url={EXPLORE_URL}
uuid={props.compoundInfo.structure_2D}
/>
</div>
<StructureVisualizer cifText={props.cifText} initSupercell={[3, 3, 1]} />
<StructureVisualizer
cifText={props.cifText}
initSupercell={[3, 3, 1]}
/>
<div className="download-button-container">
<StructDownloadButton
aiida_rest_url="https://aiida.materialscloud.org/mc2d/api/v4"
Expand Down

0 comments on commit 1f41aa6

Please sign in to comment.