@ccp-nc/crystvis-js 0.5.0 → 0.6.1
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/.github/dependabot.yml +69 -0
- package/.github/workflows/dependency-review.yml +91 -0
- package/.github/workflows/security-scan.yml +113 -0
- package/.github/workflows/test.yml +191 -0
- package/.github/workflows/update-dependencies.yml +214 -0
- package/CHANGELOG.md +36 -0
- package/LICENSE +0 -0
- package/README.html +0 -0
- package/README.md +5 -1
- package/audit.txt +37 -0
- package/changes.txt +27 -0
- package/docs/.nojekyll +0 -0
- package/docs/data/search.json +1 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/index.html +10 -0
- package/docs/lib_model.module_js-AtomImage.html +3 -0
- package/docs/lib_model.module_js-BondImage.html +3 -0
- package/docs/lib_model.module_js-Model.html +3 -0
- package/docs/lib_model.module_js.html +3 -0
- package/docs/lib_modelview.module_js-ModelView.html +12 -0
- package/docs/lib_modelview.module_js.html +3 -0
- package/docs/lib_visualizer.module_js-CrystVis.html +3 -0
- package/docs/lib_visualizer.module_js.html +3 -0
- package/docs/model.js.html +2160 -0
- package/docs/modelview.js.html +449 -0
- package/docs/scripts/core.js +726 -0
- package/docs/scripts/core.min.js +23 -0
- package/docs/scripts/resize.js +90 -0
- package/docs/scripts/search.js +265 -0
- package/docs/scripts/search.min.js +6 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/scripts/third-party/fuse.js +9 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/scripts/third-party/hljs-original.js +5171 -0
- package/docs/scripts/third-party/hljs.js +1 -0
- package/docs/scripts/third-party/popper.js +5 -0
- package/docs/scripts/third-party/tippy.js +1 -0
- package/docs/scripts/third-party/tocbot.js +672 -0
- package/docs/scripts/third-party/tocbot.min.js +1 -0
- package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
- package/docs/styles/clean-jsdoc-theme-light.css +482 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/docs/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/tutorial-Events.html +13 -0
- package/docs/tutorial-Queries.html +16 -0
- package/docs/tutorial-ThreejsMigration.html +25 -0
- package/docs/visualizer.js.html +574 -0
- package/docs-tutorials/Events.md +0 -0
- package/docs-tutorials/Queries.md +0 -0
- package/docs-tutorials/ThreejsMigration.md +96 -0
- package/eslint.config.js +41 -0
- package/fonts/OpenSans/OFL.txt +0 -0
- package/fonts/OpenSans/OpenSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/fonts/OpenSans/OpenSans-VariableFont_wdth,wght.ttf +0 -0
- package/fonts/OpenSans/README.txt +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-Bold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-BoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-ExtraBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-Italic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-Light.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-LightItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-Medium.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-MediumItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-Regular.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-SemiBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans/OpenSans-SemiBoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Bold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-BoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-ExtraBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-ExtraBoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Italic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Light.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-LightItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Medium.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-MediumItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Regular.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-SemiBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-SemiBoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Bold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-BoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-ExtraBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-ExtraBoldItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Italic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Light.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-LightItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Medium.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-MediumItalic.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Regular.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-SemiBold.ttf +0 -0
- package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-SemiBoldItalic.ttf +0 -0
- package/fonts/Rubik/OFL.txt +0 -0
- package/fonts/Rubik/README.txt +0 -0
- package/fonts/Rubik/Rubik-Italic-VariableFont_wght.ttf +0 -0
- package/fonts/Rubik/Rubik-VariableFont_wght.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Black.ttf +0 -0
- package/fonts/Rubik/static/Rubik-BlackItalic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Bold.ttf +0 -0
- package/fonts/Rubik/static/Rubik-BoldItalic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-ExtraBold.ttf +0 -0
- package/fonts/Rubik/static/Rubik-ExtraBoldItalic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Italic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Light.ttf +0 -0
- package/fonts/Rubik/static/Rubik-LightItalic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Medium.ttf +0 -0
- package/fonts/Rubik/static/Rubik-MediumItalic.ttf +0 -0
- package/fonts/Rubik/static/Rubik-Regular.ttf +0 -0
- package/fonts/Rubik/static/Rubik-SemiBold.ttf +0 -0
- package/fonts/Rubik/static/Rubik-SemiBoldItalic.ttf +0 -0
- package/index.html +0 -0
- package/index.js +0 -0
- package/jsconf.json +0 -0
- package/lib/assets/fonts/bmpfonts.in.js +0 -0
- package/lib/assets/fonts/bmpfonts.js +0 -0
- package/lib/assets/fonts/font.js +33 -3
- package/lib/assets/fonts/index.js +0 -0
- package/lib/assets/fonts/threebmfont.js +2 -12
- package/lib/data.js +0 -0
- package/lib/formats/cell.js +0 -0
- package/lib/formats/cif.js +0 -0
- package/lib/formats/magres.js +0 -0
- package/lib/formats/xyz.js +149 -52
- package/lib/loader.js +28 -7
- package/lib/model.js +10 -3
- package/lib/modelview.js +30 -0
- package/lib/nmrdata.js +0 -0
- package/lib/orbit.js +77 -1
- package/lib/primitives/atoms.js +12 -7
- package/lib/primitives/cell.js +1 -1
- package/lib/primitives/dither.js +1 -1
- package/lib/primitives/ellipsoid.js +22 -8
- package/lib/primitives/geometries.js +3 -3
- package/lib/primitives/isosurface.js +2 -6
- package/lib/primitives/shapes.js +1 -1
- package/lib/primitives/sprites.js +9 -2
- package/lib/query.js +3 -28
- package/lib/render.js +40 -9
- package/lib/selbox.js +0 -0
- package/lib/shaders/aura.frag +0 -1
- package/lib/shaders/aura.vert +0 -1
- package/lib/shaders/dither.frag +0 -0
- package/lib/shaders/dither.vert +0 -0
- package/lib/shaders/index.in.js +0 -0
- package/lib/shaders/index.js +4 -4
- package/lib/shaders/msdf300.frag +0 -2
- package/lib/shaders/msdf300.vert +0 -2
- package/lib/tensor.js +0 -1
- package/lib/visualizer.js +5 -4
- package/outdated.txt +12 -0
- package/package.json +21 -22
- package/scripts/build-bundle.js +6 -2
- package/scripts/build-resources.js +0 -0
- package/scripts/plugins-shim.js +0 -0
- package/test/data/CHA.cif +0 -0
- package/test/data/H2O.xyz +0 -0
- package/test/data/H2_bound.xyz +0 -0
- package/test/data/bohr.cell +0 -0
- package/test/data/ethanol.cell +0 -0
- package/test/data/ethanol_with_tensors.xyz +33 -0
- package/test/data/example_single.cif +0 -0
- package/test/data/frac.cell +0 -0
- package/test/data/org.cif +0 -0
- package/test/data/pyridine.xyz +0 -0
- package/test/data/si8.xyz +0 -0
- package/test/loader.js +168 -8
- package/test/model.js +2 -4
- package/test/test-html/examples.js +0 -0
- package/test/test-html/index.html +0 -0
- package/tools/compile_colors.py +0 -0
- package/tools/compile_periodic.py +0 -0
- package/tools/ptable.json +0 -0
- package/tools/test +0 -0
- package/.eslintrc.json +0 -16
- package/.github/workflows/test-mocha.yml +0 -30
package/test/loader.js
CHANGED
|
@@ -26,7 +26,22 @@ describe('#loading', function() {
|
|
|
26
26
|
expect(a.get_chemical_symbols()).to.deep.equal(['C', 'C', 'C', 'N', 'C', 'C',
|
|
27
27
|
'H', 'H', 'H', 'H', 'H'
|
|
28
28
|
]);
|
|
29
|
+
|
|
30
|
+
// Check that positions were loaded correctly
|
|
31
|
+
expect(a.length()).to.equal(11);
|
|
32
|
+
expect(a.get_positions()[0]).to.deep.almost.equal([-0.180226841, 0.360945118, -1.120304970]);
|
|
33
|
+
|
|
34
|
+
// Check cell
|
|
35
|
+
expect(a.get_cell()).to.deep.almost.equal([
|
|
36
|
+
[10, 0, 0],
|
|
37
|
+
[0, 10, 0],
|
|
38
|
+
[0, 0, 10]
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
// Check that info contains the label
|
|
42
|
+
expect(a.info.Label).to.equal('Pyridine molecule (source: Wikipedia)');
|
|
29
43
|
});
|
|
44
|
+
|
|
30
45
|
it('should load properly an extended XYZ file', function() {
|
|
31
46
|
|
|
32
47
|
var loader = new Loader();
|
|
@@ -40,22 +55,119 @@ describe('#loading', function() {
|
|
|
40
55
|
[0, 0, 5.44]
|
|
41
56
|
]);
|
|
42
57
|
expect(a.get_array('spin')).to.deep.equal([1, 0, 0, 0, 0, 0, 0, 0]);
|
|
58
|
+
expect(a.length()).to.equal(8);
|
|
59
|
+
expect(a.get_chemical_symbols()[0]).to.equal('Si');
|
|
43
60
|
});
|
|
44
|
-
it('should load properly a CIF file', function() {
|
|
45
61
|
|
|
62
|
+
it('should load all frames from a multi-frame extended XYZ file and be robust to blank lines', function() {
|
|
46
63
|
var loader = new Loader();
|
|
64
|
+
var xyz = fs.readFileSync(path.join(__dirname, 'data', 'ethanol_with_tensors.xyz'), "utf8");
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
var
|
|
66
|
+
// Frame 0 (first)
|
|
67
|
+
var a0 = loader.load(xyz, 'xyz', null, { index: 0 })['xyz'];
|
|
68
|
+
expect(a0.length()).to.equal(9);
|
|
69
|
+
expect(a0.get_chemical_symbols()[0]).to.equal('C');
|
|
70
|
+
expect(a0.get_positions()[0]).to.deep.almost.equal([0.05539939, -0.60057807, 0.62649405]);
|
|
71
|
+
|
|
72
|
+
// Check that ms tensors were loaded as TensorData objects
|
|
73
|
+
expect(a0.get_array('ms')).to.have.lengthOf(9);
|
|
74
|
+
expect(a0.get_array('ms')[0]).to.have.property('data');
|
|
75
|
+
expect(a0.get_array('ms')[0].data).to.deep.almost.equal([
|
|
76
|
+
[125.81813960, -9.69204056, 1.47151834],
|
|
77
|
+
[-9.69204056, 152.57296730, -15.37444798],
|
|
78
|
+
[1.47151834, -15.37444798, 153.40518054]
|
|
79
|
+
]);
|
|
50
80
|
|
|
81
|
+
// Frame 1 (second)
|
|
82
|
+
var a1 = loader.load(xyz, 'xyz', null, { index: 1 })['xyz'];
|
|
83
|
+
expect(a1.length()).to.equal(9);
|
|
84
|
+
expect(a1.get_positions()[0]).to.deep.almost.equal([-0.40320021, -0.45122528, 0.73024166]);
|
|
85
|
+
expect(a1.get_array('ms')[0].data).to.deep.almost.equal([
|
|
86
|
+
[132.90497460, 3.59552794, -12.43391876],
|
|
87
|
+
[3.59552794, 127.77706275, -12.28247854],
|
|
88
|
+
[-12.43391876, -12.28247854, 148.26339821]
|
|
89
|
+
]);
|
|
51
90
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
91
|
+
// Frame 2 (third)
|
|
92
|
+
var a2 = loader.load(xyz, 'xyz', null, { index: 2 })['xyz'];
|
|
93
|
+
expect(a2.length()).to.equal(9);
|
|
94
|
+
expect(a2.get_positions()[0]).to.deep.almost.equal([-0.69807410, -0.44723904, 0.24317208]);
|
|
95
|
+
expect(a2.get_array('ms')[0].data).to.deep.almost.equal([
|
|
96
|
+
[152.92455307, 16.26391385, -4.26821306],
|
|
97
|
+
[16.26391385, 125.77540629, -16.76320152],
|
|
98
|
+
[-4.26821306, -16.76320152, 130.73689699]
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
// Check a different atom in frame 2
|
|
102
|
+
expect(a2.get_array('ms')[8].data).to.deep.almost.equal([
|
|
103
|
+
[15.18096611, -3.57189977, -7.34818913],
|
|
104
|
+
[-3.57189977, 25.05233266, -0.90280873],
|
|
105
|
+
[-7.34818913, -0.90280873, 24.27668518]
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
// Default (should be last frame)
|
|
109
|
+
var a_last = loader.load(xyz, 'xyz')['xyz'];
|
|
110
|
+
expect(a_last.get_array('ms')[0].data).to.deep.almost.equal([
|
|
111
|
+
[152.92455307, 16.26391385, -4.26821306],
|
|
112
|
+
[16.26391385, 125.77540629, -16.76320152],
|
|
113
|
+
[-4.26821306, -16.76320152, 130.73689699]
|
|
114
|
+
]);
|
|
115
|
+
|
|
116
|
+
// Robustness: insert blank lines between frames and test again
|
|
117
|
+
// add blank line before each frame (match only counts at start of line)
|
|
118
|
+
var xyz_blank = xyz.replace(/^9\n/gm, '\n9\n');
|
|
119
|
+
var a_blank = loader.load(xyz_blank, 'xyz', null, { index: 1 })['xyz'];
|
|
120
|
+
expect(a_blank.get_array('ms')[0].data).to.deep.almost.equal([
|
|
121
|
+
[132.90497460, 3.59552794, -12.43391876],
|
|
122
|
+
[3.59552794, 127.77706275, -12.28247854],
|
|
123
|
+
[-12.43391876, -12.28247854, 148.26339821]
|
|
124
|
+
]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should handle negative frame indices correctly', function() {
|
|
128
|
+
var loader = new Loader();
|
|
129
|
+
var xyz = fs.readFileSync(path.join(__dirname, 'data', 'ethanol_with_tensors.xyz'), "utf8");
|
|
130
|
+
|
|
131
|
+
// -1 should be last frame (frame 2)
|
|
132
|
+
var a_neg1 = loader.load(xyz, 'xyz', null, { index: -1 })['xyz'];
|
|
133
|
+
expect(a_neg1.get_array('ms')[0].data[0][0]).to.almost.equal(152.92455307);
|
|
134
|
+
|
|
135
|
+
// -2 should be second-to-last frame (frame 1)
|
|
136
|
+
var a_neg2 = loader.load(xyz, 'xyz', null, { index: -2 })['xyz'];
|
|
137
|
+
expect(a_neg2.get_array('ms')[0].data[0][0]).to.almost.equal(132.90497460);
|
|
138
|
+
|
|
139
|
+
// -3 should be first frame (frame 0)
|
|
140
|
+
var a_neg3 = loader.load(xyz, 'xyz', null, { index: -3 })['xyz'];
|
|
141
|
+
expect(a_neg3.get_array('ms')[0].data[0][0]).to.almost.equal(125.81813960);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should load properly a simple XYZ file with multiple atoms', function() {
|
|
145
|
+
var loader = new Loader();
|
|
146
|
+
var xyz = fs.readFileSync(path.join(__dirname, 'data', 'H2O.xyz'), "utf8");
|
|
147
|
+
var a = loader.load(xyz, 'xyz')['xyz'];
|
|
148
|
+
|
|
149
|
+
expect(a.length()).to.equal(6);
|
|
150
|
+
expect(a.get_chemical_symbols()).to.deep.equal(['O', 'H', 'H', 'O', 'H', 'H']);
|
|
151
|
+
expect(a.get_positions()[0]).to.deep.almost.equal([0.0, 0.0, 0.11926200]);
|
|
152
|
+
expect(a.get_cell()).to.deep.almost.equal([
|
|
153
|
+
[10, 0, 0],
|
|
154
|
+
[0, 10, 0],
|
|
155
|
+
[0, 0, 10]
|
|
56
156
|
]);
|
|
57
157
|
});
|
|
58
|
-
|
|
158
|
+
|
|
159
|
+
it('should load properly a file with periodic boundary conditions across cell', function() {
|
|
160
|
+
var loader = new Loader();
|
|
161
|
+
var xyz = fs.readFileSync(path.join(__dirname, 'data', 'H2_bound.xyz'), "utf8");
|
|
162
|
+
var a = loader.load(xyz, 'xyz')['xyz'];
|
|
163
|
+
|
|
164
|
+
expect(a.length()).to.equal(2);
|
|
165
|
+
expect(a.get_chemical_symbols()).to.deep.equal(['H', 'H']);
|
|
166
|
+
expect(a.get_positions()[0]).to.deep.almost.equal([0.2, 0.2, 0.2]);
|
|
167
|
+
expect(a.get_positions()[1]).to.deep.almost.equal([9.8, 9.8, 9.8]);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('should load a noisy .xyz file', function() {
|
|
59
171
|
|
|
60
172
|
var loader = new Loader();
|
|
61
173
|
|
|
@@ -67,6 +179,54 @@ describe('#loading', function() {
|
|
|
67
179
|
[0, 5.475, 0],
|
|
68
180
|
[0, 0, 5.475]
|
|
69
181
|
]);
|
|
182
|
+
|
|
183
|
+
// Check that it loaded the right number of atoms
|
|
184
|
+
expect(a.length()).to.equal(8);
|
|
185
|
+
|
|
186
|
+
// Check that initial_magmoms were loaded (all zeros)
|
|
187
|
+
expect(a.get_array('initial_magmoms')).to.deep.almost.equal([0, 0, 0, 0, 0, 0, 0, 0]);
|
|
188
|
+
|
|
189
|
+
// Check that castep_labels were loaded (all "NULL")
|
|
190
|
+
expect(a.get_array('castep_labels')).to.deep.equal(['NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL']);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should throw an error for files without a lattice', function() {
|
|
194
|
+
var loader = new Loader();
|
|
195
|
+
|
|
196
|
+
// Create a plain XYZ file without Extended XYZ format
|
|
197
|
+
var plain_xyz = `3
|
|
198
|
+
water molecule
|
|
199
|
+
O 0.0 0.0 0.0
|
|
200
|
+
H 1.0 0.0 0.0
|
|
201
|
+
H 0.0 1.0 0.0`;
|
|
202
|
+
|
|
203
|
+
expect(() => loader.load(plain_xyz, 'xyz')).to.throw('No unit cell');
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('should throw an error for invalid frame indices', function() {
|
|
207
|
+
var loader = new Loader();
|
|
208
|
+
var xyz = fs.readFileSync(path.join(__dirname, 'data', 'ethanol_with_tensors.xyz'), "utf8");
|
|
209
|
+
|
|
210
|
+
// Frame index too high
|
|
211
|
+
expect(() => loader.load(xyz, 'xyz', null, { index: 10 })).to.throw('Frame index out of range');
|
|
212
|
+
|
|
213
|
+
// Frame index too low (negative)
|
|
214
|
+
expect(() => loader.load(xyz, 'xyz', null, { index: -10 })).to.throw('Frame index out of range');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should load properly a CIF file', function() {
|
|
218
|
+
|
|
219
|
+
var loader = new Loader();
|
|
220
|
+
|
|
221
|
+
var cif = fs.readFileSync(path.join(__dirname, 'data', 'org.cif'), "utf8");
|
|
222
|
+
var a = loader.load(cif)['1501936'];
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
chai.expect(a.get_cell()).to.deep.almost.equal([
|
|
226
|
+
[8.2302, 0.0, 0.0],
|
|
227
|
+
[1.7507207912272031, 8.096583378263006, 0.0],
|
|
228
|
+
[1.7848106706548383, 1.959874486240255, 12.914460443940394]
|
|
229
|
+
]);
|
|
70
230
|
});
|
|
71
231
|
|
|
72
232
|
it('should load properly a Magres file', function() {
|
package/test/model.js
CHANGED
|
@@ -19,9 +19,6 @@ import {
|
|
|
19
19
|
AtomImage,
|
|
20
20
|
BondImage
|
|
21
21
|
} from '../lib/model.js';
|
|
22
|
-
import {
|
|
23
|
-
ModelView as ModelView
|
|
24
|
-
} from '../lib/modelview.js';
|
|
25
22
|
import {
|
|
26
23
|
Loader as Loader
|
|
27
24
|
} from '../lib/loader.js';
|
|
@@ -50,7 +47,8 @@ var loader = new Loader();
|
|
|
50
47
|
try {
|
|
51
48
|
loader.load(xyz, 'xyz');
|
|
52
49
|
} catch (e) {
|
|
53
|
-
|
|
50
|
+
// Accept either the short legacy message or the more descriptive one
|
|
51
|
+
expect(e.message).to.match(/No unit cell/);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
// manually added in dummy cell:
|
|
File without changes
|
|
File without changes
|
package/tools/compile_colors.py
CHANGED
|
File without changes
|
|
File without changes
|
package/tools/ptable.json
CHANGED
|
File without changes
|
package/tools/test
CHANGED
|
File without changes
|
package/.eslintrc.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: Node.js CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ master ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ master ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
node-version: [12.x, 14.x, 16.x, 18.x]
|
|
20
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v2
|
|
24
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
-
uses: actions/setup-node@v2
|
|
26
|
-
with:
|
|
27
|
-
node-version: ${{ matrix.node-version }}
|
|
28
|
-
- run: npm ci
|
|
29
|
-
- run: npm run build --if-present
|
|
30
|
-
- run: npm test
|