@jjlmoya/utils-science 1.40.0 → 1.42.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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/scripts/crystal-lattice-catalog-translations.mjs +459 -0
  3. package/scripts/sync-crystal-lattice-i18n.mjs +50 -0
  4. package/src/tool/crystal-lattice-structure-finder/component.astro +120 -39
  5. package/src/tool/crystal-lattice-structure-finder/crystal-lattice-structure-finder.css +204 -56
  6. package/src/tool/crystal-lattice-structure-finder/data.ts +107 -133
  7. package/src/tool/crystal-lattice-structure-finder/i18n/de.ts +39 -0
  8. package/src/tool/crystal-lattice-structure-finder/i18n/en.ts +45 -6
  9. package/src/tool/crystal-lattice-structure-finder/i18n/es.ts +39 -0
  10. package/src/tool/crystal-lattice-structure-finder/i18n/fr.ts +39 -0
  11. package/src/tool/crystal-lattice-structure-finder/i18n/id.ts +39 -0
  12. package/src/tool/crystal-lattice-structure-finder/i18n/it.ts +39 -0
  13. package/src/tool/crystal-lattice-structure-finder/i18n/ja.ts +39 -0
  14. package/src/tool/crystal-lattice-structure-finder/i18n/ko.ts +39 -0
  15. package/src/tool/crystal-lattice-structure-finder/i18n/nl.ts +39 -0
  16. package/src/tool/crystal-lattice-structure-finder/i18n/pl.ts +39 -0
  17. package/src/tool/crystal-lattice-structure-finder/i18n/pt.ts +39 -0
  18. package/src/tool/crystal-lattice-structure-finder/i18n/ru.ts +39 -0
  19. package/src/tool/crystal-lattice-structure-finder/i18n/sv.ts +39 -0
  20. package/src/tool/crystal-lattice-structure-finder/i18n/tr.ts +39 -0
  21. package/src/tool/crystal-lattice-structure-finder/i18n/zh.ts +39 -0
  22. package/src/tool/crystal-lattice-structure-finder/logic.ts +7 -3
  23. package/src/tool/crystal-lattice-structure-finder/structures/README.md +26 -0
  24. package/src/tool/crystal-lattice-structure-finder/structures/body-centered-cubic.ts +19 -0
  25. package/src/tool/crystal-lattice-structure-finder/structures/cesium-chloride.ts +19 -0
  26. package/src/tool/crystal-lattice-structure-finder/structures/diamond-cubic.ts +23 -0
  27. package/src/tool/crystal-lattice-structure-finder/structures/face-centered-cubic.ts +16 -0
  28. package/src/tool/crystal-lattice-structure-finder/structures/hexagonal-close-packed.ts +30 -0
  29. package/src/tool/crystal-lattice-structure-finder/structures/index.ts +25 -0
  30. package/src/tool/crystal-lattice-structure-finder/structures/perovskite.ts +20 -0
  31. package/src/tool/crystal-lattice-structure-finder/structures/rock-salt.ts +23 -0
  32. package/src/tool/crystal-lattice-structure-finder/structures/rutile.ts +25 -0
  33. package/src/tool/crystal-lattice-structure-finder/structures/shared.ts +86 -0
  34. package/src/tool/crystal-lattice-structure-finder/structures/simple-cubic.ts +16 -0
  35. package/src/tool/crystal-lattice-structure-finder/structures/wurtzite.ts +22 -0
  36. package/src/tool/crystal-lattice-structure-finder/structures/zinc-blende.ts +23 -0
@@ -0,0 +1,86 @@
1
+ import type { AtomSite } from '../data';
2
+
3
+ export const cubeVertices: [number, number, number][] = [
4
+ [0, 0, 0],
5
+ [1, 0, 0],
6
+ [1, 1, 0],
7
+ [0, 1, 0],
8
+ [0, 0, 1],
9
+ [1, 0, 1],
10
+ [1, 1, 1],
11
+ [0, 1, 1],
12
+ ];
13
+
14
+ export const cubeEdges: [number, number][] = [
15
+ [0, 1],
16
+ [1, 2],
17
+ [2, 3],
18
+ [3, 0],
19
+ [4, 5],
20
+ [5, 6],
21
+ [6, 7],
22
+ [7, 4],
23
+ [0, 4],
24
+ [1, 5],
25
+ [2, 6],
26
+ [3, 7],
27
+ ];
28
+
29
+ export const hexVertices: [number, number, number][] = [
30
+ [1, 0, 0],
31
+ [0.5, 0.866, 0],
32
+ [-0.5, 0.866, 0],
33
+ [-1, 0, 0],
34
+ [-0.5, -0.866, 0],
35
+ [0.5, -0.866, 0],
36
+ [1, 0, 1],
37
+ [0.5, 0.866, 1],
38
+ [-0.5, 0.866, 1],
39
+ [-1, 0, 1],
40
+ [-0.5, -0.866, 1],
41
+ [0.5, -0.866, 1],
42
+ ];
43
+
44
+ export const hexEdges: [number, number][] = [
45
+ [0, 1],
46
+ [1, 2],
47
+ [2, 3],
48
+ [3, 4],
49
+ [4, 5],
50
+ [5, 0],
51
+ [6, 7],
52
+ [7, 8],
53
+ [8, 9],
54
+ [9, 10],
55
+ [10, 11],
56
+ [11, 6],
57
+ [0, 6],
58
+ [1, 7],
59
+ [2, 8],
60
+ [3, 9],
61
+ [4, 10],
62
+ [5, 11],
63
+ ];
64
+
65
+ export function cubeCorners(prefix: string): AtomSite[] {
66
+ return cubeVertices.map(([x, y, z], index) => ({
67
+ id: `${prefix}-corner-${index}`,
68
+ x,
69
+ y,
70
+ z,
71
+ role: 'corner' as const,
72
+ }));
73
+ }
74
+
75
+ export const cubeFaceCenters: AtomSite[] = [
76
+ { id: 'face-bottom', x: 0.5, y: 0.5, z: 0, role: 'face' },
77
+ { id: 'face-top', x: 0.5, y: 0.5, z: 1, role: 'face' },
78
+ { id: 'face-front', x: 0.5, y: 0, z: 0.5, role: 'face' },
79
+ { id: 'face-back', x: 0.5, y: 1, z: 0.5, role: 'face' },
80
+ { id: 'face-left', x: 0, y: 0.5, z: 0.5, role: 'face' },
81
+ { id: 'face-right', x: 1, y: 0.5, z: 0.5, role: 'face' },
82
+ ];
83
+
84
+ export function renamedSites(prefix: string, sites: AtomSite[]): AtomSite[] {
85
+ return sites.map((site) => ({ ...site, id: `${prefix}-${site.id}` }));
86
+ }
@@ -0,0 +1,16 @@
1
+ import type { LatticeStructure } from '../data';
2
+ import { cubeCorners, cubeEdges, cubeVertices } from './shared';
3
+
4
+ export const simpleCubic: LatticeStructure = {
5
+ id: 'simple-cubic',
6
+ name: 'Simple cubic',
7
+ shortName: 'SC',
8
+ cellGeometry: 'cubic',
9
+ coordinationNumber: 6,
10
+ atomsPerCell: 1,
11
+ packingFactor: Math.PI / 6,
12
+ radiusToA: 0.5,
13
+ vertices: cubeVertices,
14
+ edges: cubeEdges,
15
+ sites: cubeCorners('sc'),
16
+ };
@@ -0,0 +1,22 @@
1
+ import type { LatticeStructure } from '../data';
2
+ import { hexEdges, hexVertices } from './shared';
3
+
4
+ export const wurtzite: LatticeStructure = {
5
+ id: 'wurtzite',
6
+ name: 'Wurtzite',
7
+ shortName: 'WZ',
8
+ cellGeometry: 'hexagonal',
9
+ coordinationNumber: 4,
10
+ atomsPerCell: 2,
11
+ packingFactor: 0.34,
12
+ radiusToA: 0.375,
13
+ cToA: 1.633,
14
+ vertices: hexVertices,
15
+ edges: hexEdges,
16
+ sites: [
17
+ { id: 'wurtzite-a-bottom', x: 0.5, y: 0.5, z: 0, role: 'face' },
18
+ { id: 'wurtzite-a-top', x: 0.5, y: 0.5, z: 1, role: 'face' },
19
+ { id: 'wurtzite-b-a', x: 0.33, y: 0.42, z: 0.375, role: 'interior' },
20
+ { id: 'wurtzite-b-b', x: 0.67, y: 0.58, z: 0.875, role: 'interior' },
21
+ ],
22
+ };
@@ -0,0 +1,23 @@
1
+ import type { LatticeStructure } from '../data';
2
+ import { cubeCorners, cubeEdges, cubeFaceCenters, cubeVertices, renamedSites } from './shared';
3
+
4
+ export const zincBlende: LatticeStructure = {
5
+ id: 'zinc-blende',
6
+ name: 'Zinc blende',
7
+ shortName: 'ZnS',
8
+ cellGeometry: 'cubic',
9
+ coordinationNumber: 4,
10
+ atomsPerCell: 4,
11
+ packingFactor: 0.34,
12
+ radiusToA: Math.sqrt(3) / 8,
13
+ vertices: cubeVertices,
14
+ edges: cubeEdges,
15
+ sites: [
16
+ ...cubeCorners('zinc-blende'),
17
+ ...renamedSites('zinc-blende', cubeFaceCenters),
18
+ { id: 'zinc-blende-tetra-a', x: 0.25, y: 0.25, z: 0.25, role: 'interior' },
19
+ { id: 'zinc-blende-tetra-b', x: 0.75, y: 0.75, z: 0.25, role: 'interior' },
20
+ { id: 'zinc-blende-tetra-c', x: 0.75, y: 0.25, z: 0.75, role: 'interior' },
21
+ { id: 'zinc-blende-tetra-d', x: 0.25, y: 0.75, z: 0.75, role: 'interior' },
22
+ ],
23
+ };