@@ -2,8 +2,6 @@ import React from "react";
22
33import * as $3Dmol from "3dmol" ;
44
5- import * as math from "mathjs" ;
6-
75import { covalentRadii } from "./bondLengths" ;
86
97import "./Visualizer3dmol.css" ;
@@ -12,32 +10,17 @@ function mod(n, m) {
1210 return ( ( n % m ) + m ) % m ;
1311}
1412
15- // override the covalent bond detection based on examples in MC3D
16- const overrideBondLengths = {
17- // uuid = "aaea1e0f-337c-453f-a23a-acc06ddc93c9"; // BaTiO3 mc3d-46554/pbe
18- Ba : 0.92 * covalentRadii [ "Ba" ] ,
19- Ti : 0.94 * covalentRadii [ "Ti" ] ,
20- // uuid = "a490b0ff-012a-44c8-a48a-f734dc634b3c"; // EuI4La mc3d-34858/pbe
21- I : 1.05 * covalentRadii [ "I" ] ,
22- Eu : 1.05 * covalentRadii [ "Eu" ] ,
23- } ;
24-
2513function setCustomBondLengths ( ) {
2614 function setCustomBondLength ( elem , len ) {
2715 // 3dmol adds 0.25 to the total bond length as a "fudge_factor"
28- let fudgeCorrection = 0.125 ;
29- $3Dmol . setBondLength ( elem , len - fudgeCorrection ) ;
16+ // to correct for this, one could here subtract 0.125 from each atom's
17+ // bond length but it seems it's better to keep the "fudge factor".
18+ $3Dmol . setBondLength ( elem , len ) ;
3019 }
31-
3220 // override the default bond lengths with covalentRadii
3321 Object . keys ( covalentRadii ) . forEach ( ( elem ) => {
3422 setCustomBondLength ( elem , covalentRadii [ elem ] ) ;
3523 } ) ;
36-
37- // override further based on custom-defined lengths
38- Object . keys ( overrideBondLengths ) . forEach ( ( elem ) => {
39- setCustomBondLength ( elem , overrideBondLengths [ elem ] ) ;
40- } ) ;
4124}
4225
4326class Visualizer3dmol extends React . Component {
@@ -93,16 +76,6 @@ class Visualizer3dmol extends React.Component {
9376
9477 let final_atoms = [ ] ;
9578
96- // console.log("loadedAtoms", loadedAtoms);
97- // loadedAtoms = [
98- // {
99- // elem: "C",
100- // x: 0.1,
101- // y: 0.1,
102- // z: 50.0,
103- // },
104- // ];
105-
10679 // in case of packed cell, make sure all the initially specified atoms
10780 // are folded back to the unit cell
10881 let atoms = [ ] ;
@@ -198,7 +171,7 @@ class Visualizer3dmol extends React.Component {
198171 style . sphere . scale = 1.0 ;
199172 }
200173 if ( this . props . viewerParams . bonds ) {
201- style . stick = { radius : 0.2 , colorscheme : "Jmol" } ;
174+ style . stick = { radius : 0.15 , colorscheme : "Jmol" } ;
202175 }
203176
204177 this . viewer . setStyle ( style ) ;
0 commit comments