Skip to content

Commit 6f60477

Browse files
authored
label absorbing atom in 3d structure (#36)
1 parent 5ef84ce commit 6f60477

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

web-conexs-client/src/components/React3dMol.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface Molecule3DProps {
88
moleculedata: MoleculeInput | CrystalInput | null;
99
style: string;
1010
orbital: Orbital | null;
11+
labelledAtom: number | undefined;
1112
}
1213

1314
interface Orbital {
@@ -92,6 +93,16 @@ export default function React3dMol(props: Molecule3DProps) {
9293
blabel: "Y",
9394
clabel: "Z",
9495
});
96+
97+
if (props.labelledAtom != undefined) {
98+
viewer.addLabel(
99+
"*",
100+
{ backgroundOpacity: 0, fontSize: 28 },
101+
{ index: props.labelledAtom }
102+
);
103+
104+
105+
}
95106
} else if (props.moleculedata) {
96107
const xyz = moleculeInputToXYZ(props.moleculedata);
97108

@@ -110,8 +121,6 @@ export default function React3dMol(props: Molecule3DProps) {
110121
}
111122
}
112123

113-
// viewer.addLabel("*", {}, { index: 3 });
114-
115124
viewer.zoomTo();
116125
viewer.render();
117126
return () => {

web-conexs-client/src/components/StructureTable.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ function StructureMetadata(props: {
5959
return (
6060
<StyledTableRow
6161
onClick={() => {
62-
console.log("click");
6362
props.setSelectedRow(props.key);
6463
props.clickStructure(props.structure);
6564
}}

web-conexs-client/src/components/StructureViewer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { skipToken, useQuery } from "@tanstack/react-query";
33
import { getStructure } from "../queryfunctions";
44
import React3dMol from "./React3dMol";
55

6-
export default function StructureViewer(props: { id: number | undefined }) {
6+
export default function StructureViewer(props: {
7+
id: number | undefined;
8+
labelledAtomIndex?: number | undefined;
9+
}) {
710
const id = props.id;
811
const query = useQuery({
912
queryKey: ["structure", id],
@@ -17,6 +20,7 @@ export default function StructureViewer(props: { id: number | undefined }) {
1720
color="#3465A4"
1821
style="Stick"
1922
orbital={null}
23+
labelledAtom={props.labelledAtomIndex}
2024
></React3dMol>
2125
</Box>
2226
);

web-conexs-client/src/components/crystals/CrystalPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default function CrystalPage() {
3030
}
3131
}
3232

33-
console.log(finalCrystal);
3433
return (
3534
<MainPanel>
3635
<Stack spacing={"10px"}>

web-conexs-client/src/components/qe/QEForm.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ export default function QEForm(props: {
9090
</Button>
9191
</Stack>
9292
<Stack flex={1}>
93-
<StructureViewer id={props.data.chemical_structure_id} />
93+
<StructureViewer
94+
id={props.data.chemical_structure_id}
95+
labelledAtomIndex={
96+
props.data.absorbing_atom
97+
? props.data.absorbing_atom - 1
98+
: undefined
99+
}
100+
/>
94101
</Stack>
95102
<Paper
96103
flex={1}

0 commit comments

Comments
 (0)