Skip to content

Commit 9cb7bc3

Browse files
committed
update 3dmol; packed cell bit looser; bond radii +5%
1 parent 0c4a7bd commit 9cb7bc3

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"preview": "vite preview"
1515
},
1616
"dependencies": {
17-
"3dmol": "^2.1.0",
17+
"3dmol": "^2.3.0",
1818
"mathjs": "^12.4.1"
1919
},
2020
"peerDependencies": {

src/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ async function fetchCif3D() {
1515
// uuid = "a490b0ff-012a-44c8-a48a-f734dc634b3c"; // EuI4La mc3d-34858/pbe
1616
// uuid = "74046bff-82f1-4ced-b33e-54c09db90b78"; // "bizarre" graphite mc3d-19759/pbe
1717
// uuid = "f5e7395f-ecad-4227-9789-21e7e4d21124"; // Al2H4Li2O14Si4 (water molecule) mc3d-12502/pbe
18+
// uuid = "ccf74efe-af52-475a-abd7-d363aa2ce63e"; // mc3d-10008/pbe
1819

1920
const responseAiiDACif = await fetch(
2021
`${aiidaRestEndpoint}/nodes/${uuid}/download?download_format=cif&download=false`,

src/StructureVisualizer/StructureWindow/3dmol/Visualizer3dmol.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function setCustomBondLengths() {
1919
}
2020
// override the default bond lengths with covalentRadii
2121
Object.keys(covalentRadii).forEach((elem) => {
22-
setCustomBondLength(elem, covalentRadii[elem]);
22+
setCustomBondLength(elem, 1.05 * covalentRadii[elem]);
2323
});
2424
}
2525

@@ -101,6 +101,10 @@ class Visualizer3dmol extends React.Component {
101101

102102
// Build the supercell
103103

104+
// distance in fractional coordinates to the edge to be
105+
// considered "on edge" for packed cell option
106+
let edgeDelta = 0.05;
107+
104108
let sc = this.props.viewerParams.supercell;
105109
for (let i = -1; i < sc[0] + 1; i++) {
106110
for (let j = -1; j < sc[1] + 1; j++) {
@@ -125,9 +129,9 @@ class Visualizer3dmol extends React.Component {
125129

126130
// prettier-ignore
127131
if (
128-
frac.x > -0.0001 && frac.x < sc[0] + 0.0001 &&
129-
frac.y > -0.0001 && frac.y < sc[1] + 0.0001 &&
130-
frac.z > -0.0001 && frac.z < sc[2] + 0.0001
132+
frac.x > -edgeDelta && frac.x < sc[0] + edgeDelta &&
133+
frac.y > -edgeDelta && frac.y < sc[1] + edgeDelta &&
134+
frac.z > -edgeDelta && frac.z < sc[2] + edgeDelta
131135
) {
132136
final_atoms.push({
133137
elem: atom.elem,

0 commit comments

Comments
 (0)