Skip to content

Commit 5d2a257

Browse files
committed
update: fix bonds
1 parent 3064e48 commit 5d2a257

File tree

10 files changed

+24
-11
lines changed

10 files changed

+24
-11
lines changed

dist/components/ThreeDEditor.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export namespace ThreeDEditor {
233233
namespace propTypes {
234234
let material: PropTypes.Validator<NonNullable<{
235235
_json: import("@mat3ra/made/dist/js/material").MaterialSchemaJSON;
236-
toJSON(): import("@mat3ra/made/dist/js/types/material").MaterialJSON;
236+
toJSON(): import("@mat3ra/made/dist/js/types").MaterialJSON;
237237
src: import("@mat3ra/esse/dist/js/types").FileSourceSchema | undefined;
238238
updateFormula(): void;
239239
isNonPeriodic: boolean;

dist/mixins/bonds.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const BondsMixin = (superclass) => class extends superclass {
3636
* @param bondsData {Array} an array of bond data entries for unique element pairs inside structure.
3737
* @returns {Boolean}
3838
*/
39+
// TODO: move to made basis bonded
3940
areElementsBonded(element1, coordinate1, element2, coordinate2, bondsData) {
4041
const distance = Made.math.vDist(coordinate1, coordinate2);
4142
const connectivityFactor = this.settings.chemicalConnectivityFactor;
@@ -50,6 +51,7 @@ export const BondsMixin = (superclass) => class extends superclass {
5051
* combinations as it is required to repeat the cell in all directions to determine the bonds.
5152
* @returns {Array} an array of bond data entries for unique element pairs inside structure.
5253
*/
54+
// TODO: move to made basis bonded
5355
getBondsDataForUniqueElementPairs() {
5456
const bonds = [];
5557
const { uniqueElements } = this.basis;
@@ -67,6 +69,7 @@ export const BondsMixin = (superclass) => class extends superclass {
6769
* @param bondsData {Array} an array of bond data entries for unique element pairs inside structure.
6870
* @returns {Number}
6971
*/
72+
// TODO: move to made basis bonded
7073
getMaxBondLength(bondsData) {
7174
const connectivityFactor = this.settings.chemicalConnectivityFactor;
7275
return (connectivityFactor *
@@ -80,14 +83,15 @@ export const BondsMixin = (superclass) => class extends superclass {
8083
* @param maxBondLength {Number}
8184
* @return {Array}
8285
*/
86+
// TODO: move to made basis bonded
8387
getElementsAndCoordinatesArrayWithEdgeNeighbors(maxBondLength) {
8488
const newBasis = this.basis.clone();
8589
const basisCloneInCrystalCoordinates = this.basis.clone();
8690
newBasis.toCrystal();
8791
basisCloneInCrystalCoordinates.toCrystal();
8892
const planes = this.getCellPlanes(this.cell);
8993
basisCloneInCrystalCoordinates.elements.forEach((element, index) => {
90-
const coord = basisCloneInCrystalCoordinates.getCoordinateByIndex(index).value;
94+
const coord = basisCloneInCrystalCoordinates.getCoordinateValueByIndex(index);
9195
if (planes.find((plane) => plane.distanceToPoint(new THREE.Vector3(...coord)) <= maxBondLength)) {
9296
[-1, 0, 1].forEach((shiftI) => {
9397
[-1, 0, 1].forEach((shiftJ) => {
@@ -115,6 +119,7 @@ export const BondsMixin = (superclass) => class extends superclass {
115119
* k-d tree algorithm is used to optimize the time to find the element's neighbors.
116120
* See https://en.wikipedia.org/wiki/K-d_tree for more information.
117121
*/
122+
// TODO: move to made basis bonded - refactor to return bonds array and use the array in createBondsGroup
118123
createBondsGroup() {
119124
const bondsGroup = new THREE.Group();
120125
const bondsData = this.getBondsDataForUniqueElementPairs();

dist/mixins/boundary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const BoundaryMixin = (superclass) => class extends superclass {
8282
newBasis.toCrystal();
8383
basisCloneInCrystalCoordinates.toCrystal();
8484
basisCloneInCrystalCoordinates.elements.forEach((element, index) => {
85-
const coord = basisCloneInCrystalCoordinates.getCoordinateByIndex(index);
85+
const coord = basisCloneInCrystalCoordinates.getCoordinateValueByIndex(index);
8686
newBasis.addAtom({
8787
element,
8888
coordinate: [

dist/mixins/cell.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const CellMixin = (superclass) => class extends superclass {
2525
* @param cell {Object} unitCell class instance.
2626
* @param zMultiplier {Number} specifies a multiplier to adjust the z coordinates of the cell vertices with.
2727
*/
28+
// TODO: move to made.unit_cell
2829
// eslint-disable-next-line class-methods-use-this
2930
getCellVertices(cell, zMultiplier = 1) {
3031
return [

dist/utils.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
export function ThreeDSceneDataToMaterial(scene: any): {
77
_json: import("@mat3ra/made/dist/js/material").MaterialSchemaJSON;
8-
toJSON(): import("@mat3ra/made/dist/js/types/material").MaterialJSON;
8+
toJSON(): import("@mat3ra/made/dist/js/types").MaterialJSON;
99
src: import("@mat3ra/esse/dist/js/types").FileSourceSchema | undefined;
1010
updateFormula(): void;
1111
isNonPeriodic: boolean;

package-lock.json

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@exabyte-io/eslint-config": "^2025.1.15-0",
6565
"@mat3ra/code": "2025.4.27-0",
6666
"@mat3ra/esse": "2025.4.22-0",
67-
"@mat3ra/made": "2025.4.25-0",
67+
"@mat3ra/made": "git+https://github.com/Exabyte-io/made.git#cf284620644e9c1840ee381ae73c4a19e5a3fc15",
6868
"@mat3ra/tsconfig": "^2024.6.3-0",
6969
"@types/react": "^18.2.8",
7070
"@types/react-dom": "^18.2.4",

src/mixins/bonds.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const BondsMixin = (superclass: any) =>
4949
* @param bondsData {Array} an array of bond data entries for unique element pairs inside structure.
5050
* @returns {Boolean}
5151
*/
52+
// TODO: move to made basis bonded
5253
areElementsBonded(
5354
element1: string,
5455
coordinate1: number[],
@@ -76,6 +77,7 @@ export const BondsMixin = (superclass: any) =>
7677
* combinations as it is required to repeat the cell in all directions to determine the bonds.
7778
* @returns {Array} an array of bond data entries for unique element pairs inside structure.
7879
*/
80+
// TODO: move to made basis bonded
7981
getBondsDataForUniqueElementPairs(): BondDataInterface[] {
8082
const bonds: BondDataInterface[] = [];
8183
const { uniqueElements } = this.basis;
@@ -94,6 +96,7 @@ export const BondsMixin = (superclass: any) =>
9496
* @param bondsData {Array} an array of bond data entries for unique element pairs inside structure.
9597
* @returns {Number}
9698
*/
99+
// TODO: move to made basis bonded
97100
getMaxBondLength(bondsData: BondDataInterface[]): number {
98101
const connectivityFactor = this.settings.chemicalConnectivityFactor;
99102
return (
@@ -110,6 +113,7 @@ export const BondsMixin = (superclass: any) =>
110113
* @param maxBondLength {Number}
111114
* @return {Array}
112115
*/
116+
// TODO: move to made basis bonded
113117
getElementsAndCoordinatesArrayWithEdgeNeighbors(
114118
maxBondLength: number,
115119
): ElementAndCoordinateAsArray[] {
@@ -123,7 +127,7 @@ export const BondsMixin = (superclass: any) =>
123127

124128
basisCloneInCrystalCoordinates.elements.forEach(
125129
(element: AtomicElementSchema, index: number) => {
126-
const coord = basisCloneInCrystalCoordinates.getCoordinateByIndex(index).value;
130+
const coord = basisCloneInCrystalCoordinates.getCoordinateValueByIndex(index);
127131
if (
128132
planes.find(
129133
(plane: THREE.Plane) =>
@@ -158,6 +162,7 @@ export const BondsMixin = (superclass: any) =>
158162
* k-d tree algorithm is used to optimize the time to find the element's neighbors.
159163
* See https://en.wikipedia.org/wiki/K-d_tree for more information.
160164
*/
165+
// TODO: move to made basis bonded - refactor to return bonds array and use the array in createBondsGroup
161166
createBondsGroup(): THREE.Group {
162167
const bondsGroup = new THREE.Group();
163168
const bondsData = this.getBondsDataForUniqueElementPairs();

src/mixins/boundary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const BoundaryMixin = (superclass) =>
113113
basisCloneInCrystalCoordinates.toCrystal();
114114

115115
basisCloneInCrystalCoordinates.elements.forEach((element, index) => {
116-
const coord = basisCloneInCrystalCoordinates.getCoordinateByIndex(index);
116+
const coord = basisCloneInCrystalCoordinates.getCoordinateValueByIndex(index);
117117
newBasis.addAtom({
118118
element,
119119
coordinate: [

src/mixins/cell.ts

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const CellMixin = (superclass: any) =>
5656
* @param cell {Object} unitCell class instance.
5757
* @param zMultiplier {Number} specifies a multiplier to adjust the z coordinates of the cell vertices with.
5858
*/
59+
// TODO: move to made.unit_cell
5960
// eslint-disable-next-line class-methods-use-this
6061
getCellVertices(cell: UnitCell, zMultiplier = 1) {
6162
return [

0 commit comments

Comments
 (0)