mc-react-structure-visualizer 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -74
- package/dist/index.css +1 -3
- package/dist/main.js +24586 -0
- package/package.json +38 -58
- package/dist/ControlBox/index.css +0 -67
- package/dist/ControlBox/index.js +0 -116
- package/dist/StructureWindow/3dmol/Visualizer3dmol.css +0 -5
- package/dist/StructureWindow/3dmol/Visualizer3dmol.js +0 -164
- package/dist/StructureWindow/3dmol/bondLengths.js +0 -107
- package/dist/StructureWindow/index.css +0 -43
- package/dist/StructureWindow/index.js +0 -66
- package/dist/index.js +0 -117
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/src/App.css +0 -38
- package/src/App.js +0 -44
- package/src/StructureVisualizer/ControlBox/index.css +0 -67
- package/src/StructureVisualizer/ControlBox/index.js +0 -94
- package/src/StructureVisualizer/StructureWindow/3dmol/Visualizer3dmol.css +0 -5
- package/src/StructureVisualizer/StructureWindow/3dmol/Visualizer3dmol.js +0 -140
- package/src/StructureVisualizer/StructureWindow/3dmol/bondLengths.js +0 -100
- package/src/StructureVisualizer/StructureWindow/index.css +0 -43
- package/src/StructureVisualizer/StructureWindow/index.js +0 -46
- package/src/StructureVisualizer/index.css +0 -3
- package/src/StructureVisualizer/index.js +0 -87
- package/src/index.css +0 -13
- package/src/index.js +0 -17
- package/src/reportWebVitals.js +0 -13
package/package.json
CHANGED
|
@@ -1,58 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mc-react-structure-visualizer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
|
|
5
|
-
"
|
|
6
|
-
"module": "dist/
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"3dmol": "^2.0
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"react
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
"production": [
|
|
40
|
-
">0.2%",
|
|
41
|
-
"not dead",
|
|
42
|
-
"not op_mini all"
|
|
43
|
-
],
|
|
44
|
-
"development": [
|
|
45
|
-
"last 1 chrome version",
|
|
46
|
-
"last 1 firefox version",
|
|
47
|
-
"last 1 safari version"
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@babel/cli": "^7.20.7",
|
|
52
|
-
"@babel/core": "^7.20.12",
|
|
53
|
-
"@babel/preset-env": "^7.20.2",
|
|
54
|
-
"@babel/preset-react": "^7.18.6",
|
|
55
|
-
"babel-loader": "^9.1.2",
|
|
56
|
-
"rimraf": "^4.1.2"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mc-react-structure-visualizer",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "dist/main.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
|
14
|
+
"preview": "vite preview"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"3dmol": "^2.1.0",
|
|
18
|
+
"mathjs": "^12.4.1"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"bootstrap": "^5.2.3",
|
|
22
|
+
"react": "^18.2.0",
|
|
23
|
+
"react-bootstrap": "^2.7.1",
|
|
24
|
+
"react-dom": "^18.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/react": "^18.2.55",
|
|
28
|
+
"@types/react-dom": "^18.2.19",
|
|
29
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
30
|
+
"eslint": "^8.56.0",
|
|
31
|
+
"eslint-plugin-react": "^7.33.2",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
33
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
34
|
+
"prettier": "^3.2.5",
|
|
35
|
+
"vite": "^5.1.0",
|
|
36
|
+
"vite-plugin-lib-inject-css": "^1.3.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
.control-box {
|
|
2
|
-
position: relative;
|
|
3
|
-
z-index: 1;
|
|
4
|
-
height: 100px;
|
|
5
|
-
width: 450px;
|
|
6
|
-
background: rgb(250, 250, 250);
|
|
7
|
-
text-align: center;
|
|
8
|
-
border: 1px solid #999;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: start;
|
|
13
|
-
margin-top: -20px;
|
|
14
|
-
padding: 30px 10px 10px 10px;
|
|
15
|
-
border-radius: 5px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.supercell-input {
|
|
19
|
-
width: 45px;
|
|
20
|
-
height: 25px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/* Always show the small arrows (needed for Chrome) */
|
|
24
|
-
.supercell-input::-webkit-inner-spin-button,
|
|
25
|
-
.supercell-input::-webkit-outer-spin-button {
|
|
26
|
-
opacity: 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.control-box-row {
|
|
30
|
-
margin: 5px 0px;
|
|
31
|
-
padding: 0px 10px;
|
|
32
|
-
width: 100%;
|
|
33
|
-
line-height: inherit;
|
|
34
|
-
/* background-color: pink; */
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: space-between;
|
|
37
|
-
align-items: stretch;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.control-box-row label {
|
|
41
|
-
margin: 0px 5px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.control-box-row button {
|
|
45
|
-
border-width: 1px;
|
|
46
|
-
border-style: outset;
|
|
47
|
-
border-color: rgb(0, 0, 0);
|
|
48
|
-
border-radius: 4px;
|
|
49
|
-
display: inline-flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
/* margin-top: -10px; */
|
|
52
|
-
margin: 0px 1px;
|
|
53
|
-
height: 25px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.control-box-row button:hover {
|
|
57
|
-
background-color: rgb(222, 222, 222);
|
|
58
|
-
}
|
|
59
|
-
.control-box-row .option-checkbox {
|
|
60
|
-
margin: 0px 2px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.control-box-row .camera-controls {
|
|
64
|
-
margin-left: auto;
|
|
65
|
-
margin-right: auto;
|
|
66
|
-
display: inline;
|
|
67
|
-
}
|
package/dist/ControlBox/index.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
require("./index.css");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
-
var ControlBox = /*#__PURE__*/function (_React$Component) {
|
|
25
|
-
_inherits(ControlBox, _React$Component);
|
|
26
|
-
var _super = _createSuper(ControlBox);
|
|
27
|
-
function ControlBox(props) {
|
|
28
|
-
var _this;
|
|
29
|
-
_classCallCheck(this, ControlBox);
|
|
30
|
-
_this = _super.call(this, props);
|
|
31
|
-
_defineProperty(_assertThisInitialized(_this), "handleSupercellChange", function (index, value) {
|
|
32
|
-
var newSupercell = _this.props.viewerParams.supercell;
|
|
33
|
-
newSupercell[index] = parseInt(value);
|
|
34
|
-
_this.props.onViewerParamChange("supercell", newSupercell);
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "handleOptionChange", function (option) {
|
|
37
|
-
_this.props.onViewerParamChange(option, !_this.props.viewerParams[option]);
|
|
38
|
-
});
|
|
39
|
-
_defineProperty(_assertThisInitialized(_this), "handleCameraEvent", function (orientation) {
|
|
40
|
-
_this.props.onViewerEvent("camera", orientation);
|
|
41
|
-
});
|
|
42
|
-
return _this;
|
|
43
|
-
}
|
|
44
|
-
_createClass(ControlBox, [{
|
|
45
|
-
key: "render",
|
|
46
|
-
value: function render() {
|
|
47
|
-
var _this2 = this;
|
|
48
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
49
|
-
className: "control-box"
|
|
50
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
51
|
-
className: "control-box-row"
|
|
52
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
53
|
-
className: "supercell-container"
|
|
54
|
-
}, /*#__PURE__*/_react["default"].createElement("label", null, "Supercell: "), [0, 1, 2].map(function (index) {
|
|
55
|
-
return /*#__PURE__*/_react["default"].createElement("input", {
|
|
56
|
-
key: index,
|
|
57
|
-
className: "supercell-input",
|
|
58
|
-
type: "number",
|
|
59
|
-
min: "1",
|
|
60
|
-
value: _this2.props.viewerParams.supercell[index],
|
|
61
|
-
onChange: function onChange(e) {
|
|
62
|
-
return _this2.handleSupercellChange(index, e.target.value);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
66
|
-
className: "camera-controls"
|
|
67
|
-
}, /*#__PURE__*/_react["default"].createElement("label", null, "Camera: "), /*#__PURE__*/_react["default"].createElement("button", {
|
|
68
|
-
onClick: function onClick() {
|
|
69
|
-
return _this2.handleCameraEvent("x");
|
|
70
|
-
}
|
|
71
|
-
}, "x"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
72
|
-
onClick: function onClick() {
|
|
73
|
-
return _this2.handleCameraEvent("y");
|
|
74
|
-
}
|
|
75
|
-
}, "y"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
76
|
-
onClick: function onClick() {
|
|
77
|
-
return _this2.handleCameraEvent("z");
|
|
78
|
-
}
|
|
79
|
-
}, "z"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
80
|
-
className: "control-box-row"
|
|
81
|
-
}, /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
82
|
-
className: "option-checkbox",
|
|
83
|
-
type: "checkbox",
|
|
84
|
-
checked: this.props.viewerParams.bonds,
|
|
85
|
-
onChange: function onChange() {
|
|
86
|
-
return _this2.handleOptionChange("bonds");
|
|
87
|
-
}
|
|
88
|
-
}), "Bonds"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
89
|
-
className: "option-checkbox",
|
|
90
|
-
type: "checkbox",
|
|
91
|
-
checked: this.props.viewerParams.atomLabels,
|
|
92
|
-
onChange: function onChange() {
|
|
93
|
-
return _this2.handleOptionChange("atomLabels");
|
|
94
|
-
}
|
|
95
|
-
}), "Atom labels"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
96
|
-
className: "option-checkbox",
|
|
97
|
-
type: "checkbox",
|
|
98
|
-
checked: this.props.viewerParams.packedCell,
|
|
99
|
-
onChange: function onChange() {
|
|
100
|
-
return _this2.handleOptionChange("packedCell");
|
|
101
|
-
},
|
|
102
|
-
disabled: true
|
|
103
|
-
}), "Packed cell"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
104
|
-
className: "option-checkbox",
|
|
105
|
-
type: "checkbox",
|
|
106
|
-
checked: this.props.viewerParams.spaceFilling,
|
|
107
|
-
onChange: function onChange() {
|
|
108
|
-
return _this2.handleOptionChange("vdwRadius");
|
|
109
|
-
}
|
|
110
|
-
}), "vdW radius")));
|
|
111
|
-
}
|
|
112
|
-
}]);
|
|
113
|
-
return ControlBox;
|
|
114
|
-
}(_react["default"].Component);
|
|
115
|
-
var _default = ControlBox;
|
|
116
|
-
exports["default"] = _default;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var $3Dmol = _interopRequireWildcard(require("3dmol"));
|
|
10
|
-
var _bondLengths = require("./bondLengths");
|
|
11
|
-
require("./Visualizer3dmol.css");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
24
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
27
|
-
// override the covalent bond detection based on examples in MC3D
|
|
28
|
-
var overrideBondLengths = {
|
|
29
|
-
// uuid = "aaea1e0f-337c-453f-a23a-acc06ddc93c9"; // BaTiO3 mc3d-46554/pbe
|
|
30
|
-
Ba: 0.92 * _bondLengths.covalentRadii["Ba"],
|
|
31
|
-
Ti: 0.94 * _bondLengths.covalentRadii["Ti"],
|
|
32
|
-
// uuid = "a490b0ff-012a-44c8-a48a-f734dc634b3c"; // EuI4La mc3d-34858/pbe
|
|
33
|
-
I: 1.05 * _bondLengths.covalentRadii["I"],
|
|
34
|
-
Eu: 1.05 * _bondLengths.covalentRadii["Eu"]
|
|
35
|
-
};
|
|
36
|
-
function setCustomBondLengths() {
|
|
37
|
-
function setCustomBondLength(elem, len) {
|
|
38
|
-
// 3dmol adds 0.25 to the total bond length as a "fudge_factor"
|
|
39
|
-
var fudgeCorrection = 0.125;
|
|
40
|
-
$3Dmol.setBondLength(elem, len - fudgeCorrection);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// override the default bond lengths with covalentRadii
|
|
44
|
-
Object.keys(_bondLengths.covalentRadii).forEach(function (elem) {
|
|
45
|
-
setCustomBondLength(elem, _bondLengths.covalentRadii[elem]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// override further based on custom-defined lengths
|
|
49
|
-
Object.keys(overrideBondLengths).forEach(function (elem) {
|
|
50
|
-
setCustomBondLength(elem, overrideBondLengths[elem]);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
var Visualizer3dmol = /*#__PURE__*/function (_React$Component) {
|
|
54
|
-
_inherits(Visualizer3dmol, _React$Component);
|
|
55
|
-
var _super = _createSuper(Visualizer3dmol);
|
|
56
|
-
function Visualizer3dmol(props) {
|
|
57
|
-
var _this;
|
|
58
|
-
_classCallCheck(this, Visualizer3dmol);
|
|
59
|
-
_this = _super.call(this, props);
|
|
60
|
-
setCustomBondLengths();
|
|
61
|
-
_this.viewer = null;
|
|
62
|
-
_this.model = null;
|
|
63
|
-
|
|
64
|
-
// Assign random id to prevent multiple 'gldiv' from clashing
|
|
65
|
-
_this.divId = "gldiv-" + (Math.random() + 1).toString(36).substring(7);
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
_createClass(Visualizer3dmol, [{
|
|
69
|
-
key: "componentDidMount",
|
|
70
|
-
value: function componentDidMount() {
|
|
71
|
-
// set up the viewer instance
|
|
72
|
-
var config = {
|
|
73
|
-
backgroundColor: "white",
|
|
74
|
-
orthographic: true
|
|
75
|
-
};
|
|
76
|
-
this.viewer = $3Dmol.createViewer(this.divId, config);
|
|
77
|
-
this.updateView();
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
key: "componentDidUpdate",
|
|
81
|
-
value: function componentDidUpdate(prevProps) {
|
|
82
|
-
if (prevProps.viewerParams != this.props.viewerParams || prevProps.cifText != this.props.cifText) {
|
|
83
|
-
this.updateView();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "updateView",
|
|
88
|
-
value: function updateView() {
|
|
89
|
-
var _this2 = this;
|
|
90
|
-
this.viewer.removeAllModels();
|
|
91
|
-
this.model = this.viewer.addModel(this.props.cifText, "cif");
|
|
92
|
-
var style = {
|
|
93
|
-
sphere: {
|
|
94
|
-
scale: 0.3,
|
|
95
|
-
colorscheme: "Jmol"
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
if (this.props.viewerParams.vdwRadius) {
|
|
99
|
-
style.sphere.scale = 1.0;
|
|
100
|
-
}
|
|
101
|
-
if (this.props.viewerParams.bonds) {
|
|
102
|
-
style.stick = {
|
|
103
|
-
radius: 0.2,
|
|
104
|
-
colorscheme: "Jmol"
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
this.viewer.setStyle(style);
|
|
108
|
-
this.viewer.addUnitCell(this.model);
|
|
109
|
-
var sc = this.props.viewerParams.supercell;
|
|
110
|
-
this.viewer.replicateUnitCell(sc[0], sc[1], sc[2], this.model);
|
|
111
|
-
this.model.assignBonds();
|
|
112
|
-
this.viewer.removeAllLabels();
|
|
113
|
-
if (this.props.viewerParams.atomLabels) {
|
|
114
|
-
this.model.atoms.forEach(function (atom) {
|
|
115
|
-
_this2.viewer.addLabel(atom.elem, {
|
|
116
|
-
position: {
|
|
117
|
-
x: atom.x,
|
|
118
|
-
y: atom.y,
|
|
119
|
-
z: atom.z
|
|
120
|
-
},
|
|
121
|
-
fontColor: "black",
|
|
122
|
-
bold: true,
|
|
123
|
-
fontSize: 18,
|
|
124
|
-
showBackground: false,
|
|
125
|
-
backgroundOpacity: 1.0,
|
|
126
|
-
inFront: true
|
|
127
|
-
}, null, true);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
this.viewer.zoomTo();
|
|
131
|
-
this.viewer.zoom(1.4);
|
|
132
|
-
this.viewer.render();
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "handleEvent",
|
|
136
|
-
value: function handleEvent(type, value) {
|
|
137
|
-
if (type == "camera") {
|
|
138
|
-
// console.log(this.viewer.getView());
|
|
139
|
-
if (value == "x") {
|
|
140
|
-
this.viewer.setView([0.0, 0.0, 0.0, 0.0, -0.5, -0.5, -0.5, 0.5]);
|
|
141
|
-
}
|
|
142
|
-
if (value == "y") {
|
|
143
|
-
this.viewer.setView([0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.5, 0.5]);
|
|
144
|
-
}
|
|
145
|
-
if (value == "z") {
|
|
146
|
-
this.viewer.setView([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
|
|
147
|
-
}
|
|
148
|
-
this.viewer.zoomTo();
|
|
149
|
-
this.viewer.zoom(1.4);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, {
|
|
153
|
-
key: "render",
|
|
154
|
-
value: function render() {
|
|
155
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
156
|
-
id: this.divId,
|
|
157
|
-
className: "gldiv"
|
|
158
|
-
}, "No data!");
|
|
159
|
-
}
|
|
160
|
-
}]);
|
|
161
|
-
return Visualizer3dmol;
|
|
162
|
-
}(_react["default"].Component);
|
|
163
|
-
var _default = Visualizer3dmol;
|
|
164
|
-
exports["default"] = _default;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.covalentRadii = void 0;
|
|
7
|
-
// from https://en.wikipedia.org/wiki/Covalent_radius
|
|
8
|
-
// unit: angstrom
|
|
9
|
-
var covalentRadii = {
|
|
10
|
-
H: 0.31,
|
|
11
|
-
He: 0.28,
|
|
12
|
-
Li: 1.28,
|
|
13
|
-
Be: 0.96,
|
|
14
|
-
B: 0.84,
|
|
15
|
-
C: 0.76,
|
|
16
|
-
N: 0.71,
|
|
17
|
-
O: 0.66,
|
|
18
|
-
F: 0.57,
|
|
19
|
-
Ne: 0.58,
|
|
20
|
-
Na: 1.66,
|
|
21
|
-
Mg: 1.41,
|
|
22
|
-
Al: 1.21,
|
|
23
|
-
Si: 1.11,
|
|
24
|
-
P: 1.07,
|
|
25
|
-
S: 1.05,
|
|
26
|
-
Cl: 1.02,
|
|
27
|
-
Ar: 1.06,
|
|
28
|
-
K: 2.03,
|
|
29
|
-
Ca: 1.76,
|
|
30
|
-
Sc: 1.7,
|
|
31
|
-
Ti: 1.6,
|
|
32
|
-
V: 1.53,
|
|
33
|
-
Cr: 1.39,
|
|
34
|
-
Mn: 1.61,
|
|
35
|
-
Fe: 1.52,
|
|
36
|
-
Co: 1.5,
|
|
37
|
-
Ni: 1.24,
|
|
38
|
-
Cu: 1.32,
|
|
39
|
-
Zn: 1.22,
|
|
40
|
-
Ga: 1.22,
|
|
41
|
-
Ge: 1.2,
|
|
42
|
-
As: 1.19,
|
|
43
|
-
Se: 1.2,
|
|
44
|
-
Br: 1.2,
|
|
45
|
-
Kr: 1.16,
|
|
46
|
-
Rb: 2.2,
|
|
47
|
-
Sr: 1.95,
|
|
48
|
-
Y: 1.9,
|
|
49
|
-
Zr: 1.75,
|
|
50
|
-
Nb: 1.64,
|
|
51
|
-
Mo: 1.54,
|
|
52
|
-
Tc: 1.47,
|
|
53
|
-
Ru: 1.46,
|
|
54
|
-
Rh: 1.42,
|
|
55
|
-
Pd: 1.39,
|
|
56
|
-
Ag: 1.45,
|
|
57
|
-
Cd: 1.44,
|
|
58
|
-
In: 1.42,
|
|
59
|
-
Sn: 1.39,
|
|
60
|
-
Sb: 1.39,
|
|
61
|
-
Te: 1.38,
|
|
62
|
-
I: 1.39,
|
|
63
|
-
Xe: 1.4,
|
|
64
|
-
Cs: 2.44,
|
|
65
|
-
Ba: 2.15,
|
|
66
|
-
La: 2.07,
|
|
67
|
-
Ce: 2.04,
|
|
68
|
-
Pr: 2.03,
|
|
69
|
-
Nd: 2.01,
|
|
70
|
-
Pm: 1.99,
|
|
71
|
-
Sm: 1.98,
|
|
72
|
-
Eu: 1.98,
|
|
73
|
-
Gd: 1.96,
|
|
74
|
-
Tb: 1.94,
|
|
75
|
-
Dy: 1.92,
|
|
76
|
-
Ho: 1.92,
|
|
77
|
-
Er: 1.89,
|
|
78
|
-
Tm: 1.9,
|
|
79
|
-
Yb: 1.87,
|
|
80
|
-
Lu: 1.75,
|
|
81
|
-
Hf: 1.87,
|
|
82
|
-
Ta: 1.7,
|
|
83
|
-
W: 1.62,
|
|
84
|
-
Re: 1.51,
|
|
85
|
-
Os: 1.44,
|
|
86
|
-
Ir: 1.41,
|
|
87
|
-
Pt: 1.36,
|
|
88
|
-
Au: 1.36,
|
|
89
|
-
Hg: 1.32,
|
|
90
|
-
Tl: 1.45,
|
|
91
|
-
Pb: 1.46,
|
|
92
|
-
Bi: 1.48,
|
|
93
|
-
Po: 1.4,
|
|
94
|
-
At: 1.5,
|
|
95
|
-
Rn: 1.5,
|
|
96
|
-
Fr: 2.6,
|
|
97
|
-
Ra: 2.21,
|
|
98
|
-
Ac: 2.15,
|
|
99
|
-
Th: 2.06,
|
|
100
|
-
Pa: 2.0,
|
|
101
|
-
U: 1.96,
|
|
102
|
-
Np: 1.9,
|
|
103
|
-
Pu: 1.87,
|
|
104
|
-
Am: 1.8,
|
|
105
|
-
Cm: 1.69
|
|
106
|
-
};
|
|
107
|
-
exports.covalentRadii = covalentRadii;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.structure-window-outer {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.structure-window {
|
|
6
|
-
position: relative;
|
|
7
|
-
z-index: 2;
|
|
8
|
-
height: 370px;
|
|
9
|
-
width: 450px;
|
|
10
|
-
background: white;
|
|
11
|
-
text-align: center;
|
|
12
|
-
border: 1px solid #999;
|
|
13
|
-
display: flex;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
align-items: center;
|
|
16
|
-
border-radius: 5px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.disable-mouse {
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.mouse-disabled-note {
|
|
24
|
-
background-color: #fff1f1;
|
|
25
|
-
border: 1px solid black;
|
|
26
|
-
color: #353434;
|
|
27
|
-
padding: 2px 6px;
|
|
28
|
-
border-radius: 5px;
|
|
29
|
-
position: absolute;
|
|
30
|
-
top: 10px;
|
|
31
|
-
left: 10px;
|
|
32
|
-
z-index: 3;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
user-select: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.on {
|
|
38
|
-
background-color: #e9ffe7;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.mouse-disabled-note:hover {
|
|
42
|
-
filter: brightness(90%);
|
|
43
|
-
}
|