Browse Source

Refactored project structure

David Sehnal 7 years ago
parent
commit
2a87a9d131
61 changed files with 282 additions and 281 deletions
  1. 0 147
      src/common/_spec/collections.spec.ts
  2. 0 0
      src/common/collections/chunked-array.ts
  3. 0 0
      src/common/collections/hash-functions.ts
  4. 0 0
      src/common/collections/hash-set.ts
  5. 0 0
      src/common/collections/int-tuple.ts
  6. 0 0
      src/common/collections/iterator.ts
  7. 0 0
      src/common/collections/linked-index.ts
  8. 0 0
      src/common/collections/ordered-set.ts
  9. 0 0
      src/common/collections/sort.ts
  10. 0 0
      src/common/computation.ts
  11. 0 0
      src/common/math/linear-algebra.ts
  12. 0 0
      src/common/scheduler.ts
  13. 0 7
      src/index.d.ts
  14. 154 0
      src/mol-data/_spec/atom-set.spec.ts
  15. 102 102
      src/mol-data/atom-set.ts
  16. 0 0
      src/mol-data/structure/data.ts
  17. 1 1
      src/mol-data/structure/model.ts
  18. 0 0
      src/mol-data/structure/selectors.ts
  19. 0 0
      src/mol-data/structure/selectors/common.ts
  20. 0 0
      src/mol-data/structure/selectors/mmcif.ts
  21. 1 2
      src/mol-data/structure/structure.ts
  22. 0 0
      src/mol-data/structure/symmetry.ts
  23. 0 0
      src/mol-data/structure/topology/connected-components.ts
  24. 0 0
      src/mol-data/structure/topology/secondary-structure.ts
  25. 0 0
      src/mol-io/reader/_spec/cif.spec.ts
  26. 0 0
      src/mol-io/reader/_spec/column.spec.ts
  27. 0 0
      src/mol-io/reader/_spec/gro.spec.ts
  28. 0 0
      src/mol-io/reader/cif/binary/decoder.ts
  29. 0 0
      src/mol-io/reader/cif/binary/encoding.ts
  30. 0 0
      src/mol-io/reader/cif/binary/field.ts
  31. 1 1
      src/mol-io/reader/cif/binary/parser.ts
  32. 0 0
      src/mol-io/reader/cif/data-model.ts
  33. 0 0
      src/mol-io/reader/cif/index.ts
  34. 0 0
      src/mol-io/reader/cif/schema.ts
  35. 0 0
      src/mol-io/reader/cif/schema/ccd.ts
  36. 0 0
      src/mol-io/reader/cif/schema/ddl.ts
  37. 0 0
      src/mol-io/reader/cif/schema/density.ts
  38. 0 0
      src/mol-io/reader/cif/schema/dic.ts
  39. 0 0
      src/mol-io/reader/cif/schema/mmcif.ts
  40. 0 0
      src/mol-io/reader/cif/schema/utils.ts
  41. 0 0
      src/mol-io/reader/cif/text/field.ts
  42. 1 1
      src/mol-io/reader/cif/text/parser.ts
  43. 0 0
      src/mol-io/reader/common/binary/column.ts
  44. 0 0
      src/mol-io/reader/common/column.ts
  45. 0 0
      src/mol-io/reader/common/text/column/fixed.ts
  46. 0 0
      src/mol-io/reader/common/text/column/token.ts
  47. 0 0
      src/mol-io/reader/common/text/number-parser.ts
  48. 1 1
      src/mol-io/reader/common/text/tokenizer.ts
  49. 1 1
      src/mol-io/reader/gro/parser.ts
  50. 0 0
      src/mol-io/reader/gro/schema.d.ts
  51. 0 0
      src/mol-io/reader/mol2/schema.d.ts
  52. 0 0
      src/mol-io/reader/result.ts
  53. 0 0
      src/mol-io/utils/msgpack/decode.ts
  54. 0 0
      src/mol-io/utils/msgpack/encode.ts
  55. 0 0
      src/mol-io/utils/short-string-pool.ts
  56. 0 0
      src/mol-io/utils/utf8.ts
  57. 1 1
      src/perf-tests/chunked-array-vs-native.ts
  58. 10 10
      src/perf-tests/sets.ts
  59. 1 1
      src/perf-tests/sort.ts
  60. 5 4
      src/script.ts
  61. 3 2
      tsconfig.json

+ 0 - 147
src/structure/spec/collections.spec.ts → src/common/_spec/collections.spec.ts

@@ -9,8 +9,6 @@ import IntTuple from '../collections/int-tuple'
 import * as Sort from '../collections/sort'
 import OrderedSet from '../collections/ordered-set'
 import LinkedIndex from '../collections/linked-index'
-import MultiSet from '../collections/multi-set'
-
 
 function iteratorToArray<T>(it: Iterator<T>): T[] {
     const ret = [];
@@ -314,149 +312,4 @@ describe('linked-index', () => {
         expect(index.has(0)).toBe(false);
         expect(index.has(1)).toBe(false);
     });
-});
-
-describe('multiset', () => {
-    const p = (i: number, j: number) => IntTuple.create(i, j);
-    const r = (i: number, j: number) => IntTuple.pack(i, j);
-
-    function setToPairs(set: MultiSet): ArrayLike<IntTuple.Unpacked> {
-        const ret = [];
-        const it = MultiSet.values(set);
-        for (let v = it.move(); !it.done; v = it.move()) ret[ret.length] = IntTuple.create(v.fst, v.snd);
-        return ret;
-    }
-
-    it('singleton pair', () => {
-        const set = MultiSet.create(p(10, 11));
-        expect(setToPairs(set)).toEqual([p(10, 11)]);
-        expect(MultiSet.has(set, r(10, 11))).toBe(true);
-        expect(MultiSet.has(set, r(11, 11))).toBe(false);
-        expect(MultiSet.getAt(set, 0)).toBe(r(10, 11));
-        expect(MultiSet.size(set)).toBe(1);
-    });
-
-    it('singleton number', () => {
-        const set = MultiSet.create(r(10, 11));
-        expect(setToPairs(set)).toEqual([p(10, 11)]);
-    });
-
-    it('multi', () => {
-        const set = MultiSet.create({
-            1: OrderedSet.ofSortedArray([4, 6, 7]),
-            3: OrderedSet.ofRange(0, 1),
-        });
-        const ret = [p(1, 4), p(1, 6), p(1, 7), p(3, 0), p(3, 1)];
-        expect(MultiSet.size(set)).toBe(ret.length);
-        expect(setToPairs(set)).toEqual([p(1, 4), p(1, 6), p(1, 7), p(3, 0), p(3, 1)]);
-        expect(MultiSet.has(set, r(10, 11))).toBe(false);
-        expect(MultiSet.has(set, r(3, 0))).toBe(true);
-        expect(MultiSet.has(set, r(1, 7))).toBe(true);
-        for (let i = 0; i < MultiSet.size(set); i++) {
-            expect(MultiSet.getAt(set, i)).toBe(IntTuple.pack1(ret[i]));
-        }
-    });
-
-    it('element at / index of', () => {
-        const control: IntTuple[] = [];
-        const sets = Object.create(null);
-        for (let i = 1; i < 10; i++) {
-            const set = [];
-            for (let j = 1; j < 7; j++) {
-                control[control.length] = r(i * i, j * j + 1);
-                set[set.length] = j * j + 1;
-            }
-            sets[i * i] = OrderedSet.ofSortedArray(set);
-        }
-        const ms = MultiSet.create(sets);
-        for (let i = 0; i < control.length; i++) {
-            expect(IntTuple.areEqual(MultiSet.getAt(ms, i), control[i])).toBe(true);
-        }
-
-        for (let i = 0; i < control.length; i++) {
-            expect(MultiSet.indexOf(ms, control[i])).toBe(i);
-        }
-    });
-
-    it('packed pairs', () => {
-        const set = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        expect(setToPairs(set)).toEqual([p(0, 1), p(0, 2), p(0, 6), p(1, 3)]);
-    });
-
-    it('equality', () => {
-        const a = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const b = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const c = MultiSet.create([r(1, 3), r(0, 4), r(0, 6), r(0, 2)]);
-        const d = MultiSet.create([r(1, 3)]);
-        const e = MultiSet.create([r(1, 3)]);
-        const f = MultiSet.create([r(3, 3)]);
-
-        expect(MultiSet.areEqual(a, a)).toBe(true);
-        expect(MultiSet.areEqual(a, b)).toBe(true);
-        expect(MultiSet.areEqual(a, c)).toBe(false);
-        expect(MultiSet.areEqual(a, d)).toBe(false);
-        expect(MultiSet.areEqual(d, d)).toBe(true);
-        expect(MultiSet.areEqual(d, e)).toBe(true);
-        expect(MultiSet.areEqual(d, f)).toBe(false);
-    });
-
-    it('are intersecting', () => {
-        const a = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const b = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const c = MultiSet.create([r(1, 3), r(0, 4), r(0, 6), r(0, 2)]);
-        const d = MultiSet.create([r(1, 3)]);
-        const e = MultiSet.create([r(1, 3)]);
-        const f = MultiSet.create([r(3, 3)]);
-        const g = MultiSet.create([r(10, 3), r(8, 1), r(7, 6), r(3, 2)]);
-
-        expect(MultiSet.areIntersecting(a, a)).toBe(true);
-        expect(MultiSet.areIntersecting(a, b)).toBe(true);
-        expect(MultiSet.areIntersecting(a, c)).toBe(true);
-        expect(MultiSet.areIntersecting(a, d)).toBe(true);
-        expect(MultiSet.areIntersecting(a, g)).toBe(false);
-        expect(MultiSet.areIntersecting(d, d)).toBe(true);
-        expect(MultiSet.areIntersecting(d, e)).toBe(true);
-        expect(MultiSet.areIntersecting(d, f)).toBe(false);
-    });
-
-    it('intersection', () => {
-        const a = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const b = MultiSet.create([r(10, 3), r(0, 1), r(0, 6), r(4, 2)]);
-        const c = MultiSet.create([r(1, 3)]);
-        const d = MultiSet.create([r(2, 3)]);
-        expect(MultiSet.intersect(a, a)).toBe(a);
-        expect(setToPairs(MultiSet.intersect(a, b))).toEqual([p(0, 1), p(0, 6)]);
-        expect(setToPairs(MultiSet.intersect(a, c))).toEqual([p(1, 3)]);
-        expect(setToPairs(MultiSet.intersect(c, d))).toEqual([]);
-    });
-
-    it('subtract', () => {
-        const a = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const a1 = MultiSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
-        const b = MultiSet.create([r(10, 3), r(0, 1), r(0, 6), r(4, 2)]);
-        const c = MultiSet.create([r(1, 3)]);
-        const d = MultiSet.create([r(2, 3)]);
-        expect(setToPairs(MultiSet.subtract(a, a))).toEqual([]);
-        expect(setToPairs(MultiSet.subtract(a, a1))).toEqual([]);
-        expect(setToPairs(MultiSet.subtract(a, b))).toEqual([p(0, 2), p(1, 3)]);
-        expect(setToPairs(MultiSet.subtract(c, d))).toEqual([p(1, 3)]);
-        expect(setToPairs(MultiSet.subtract(a, c))).toEqual([p(0, 1), p(0, 2), p(0, 6)]);
-        expect(setToPairs(MultiSet.subtract(c, a))).toEqual([]);
-        expect(setToPairs(MultiSet.subtract(d, a))).toEqual([p(2, 3)]);
-    });
-
-    it('union', () => {
-        const a = MultiSet.create([r(1, 3), r(0, 1)]);
-        const a1 = MultiSet.create([r(1, 3), r(0, 1)]);
-        const b = MultiSet.create([r(10, 3), r(0, 1)]);
-        const c = MultiSet.create([r(1, 3)]);
-        const d = MultiSet.create([r(2, 3)]);
-        expect(MultiSet.unionMany([a])).toBe(a);
-        expect(MultiSet.union(a, a)).toBe(a);
-        expect(setToPairs(MultiSet.union(a, a))).toEqual([p(0, 1), p(1, 3)]);
-        expect(setToPairs(MultiSet.union(a, a1))).toEqual([p(0, 1), p(1, 3)]);
-        expect(setToPairs(MultiSet.union(a, b))).toEqual([p(0, 1), p(1, 3), p(10, 3)]);
-        expect(setToPairs(MultiSet.union(c, d))).toEqual([p(1, 3), p(2, 3)]);
-        expect(setToPairs(MultiSet.unionMany([a, b, c, d]))).toEqual([p(0, 1), p(1, 3), p(2, 3), p(10, 3)]);
-    });
 });

+ 0 - 0
src/utils/chunked-array.ts → src/common/collections/chunked-array.ts


+ 0 - 0
src/structure/collections/hash-functions.ts → src/common/collections/hash-functions.ts


+ 0 - 0
src/structure/collections/hash-set.ts → src/common/collections/hash-set.ts


+ 0 - 0
src/structure/collections/int-tuple.ts → src/common/collections/int-tuple.ts


+ 0 - 0
src/structure/collections/iterator.ts → src/common/collections/iterator.ts


+ 0 - 0
src/structure/collections/linked-index.ts → src/common/collections/linked-index.ts


+ 0 - 0
src/structure/collections/ordered-set.ts → src/common/collections/ordered-set.ts


+ 0 - 0
src/structure/collections/sort.ts → src/common/collections/sort.ts


+ 0 - 0
src/utils/computation.ts → src/common/computation.ts


+ 0 - 0
src/utils/linear-algebra.ts → src/common/math/linear-algebra.ts


+ 0 - 0
src/utils/scheduler.ts → src/common/scheduler.ts


+ 0 - 7
src/index.d.ts

@@ -1,7 +0,0 @@
-/*
- * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-// TODO: fix me

+ 154 - 0
src/mol-data/_spec/atom-set.spec.ts

@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import IntTuple from '../../common/collections/int-tuple'
+import OrderedSet from '../../common/collections/ordered-set'
+import AtomSet from '../atom-set'
+
+describe('atom set', () => {
+    const p = (i: number, j: number) => IntTuple.create(i, j);
+    const r = (i: number, j: number) => IntTuple.pack(i, j);
+
+    function setToPairs(set: AtomSet): ArrayLike<IntTuple.Unpacked> {
+        const ret = [];
+        const it = AtomSet.values(set);
+        for (let v = it.move(); !it.done; v = it.move()) ret[ret.length] = IntTuple.create(v.fst, v.snd);
+        return ret;
+    }
+
+    it('singleton pair', () => {
+        const set = AtomSet.create(p(10, 11));
+        expect(setToPairs(set)).toEqual([p(10, 11)]);
+        expect(AtomSet.has(set, r(10, 11))).toBe(true);
+        expect(AtomSet.has(set, r(11, 11))).toBe(false);
+        expect(AtomSet.getAt(set, 0)).toBe(r(10, 11));
+        expect(AtomSet.size(set)).toBe(1);
+    });
+
+    it('singleton number', () => {
+        const set = AtomSet.create(r(10, 11));
+        expect(setToPairs(set)).toEqual([p(10, 11)]);
+    });
+
+    it('multi', () => {
+        const set = AtomSet.create({
+            1: OrderedSet.ofSortedArray([4, 6, 7]),
+            3: OrderedSet.ofRange(0, 1),
+        });
+        const ret = [p(1, 4), p(1, 6), p(1, 7), p(3, 0), p(3, 1)];
+        expect(AtomSet.size(set)).toBe(ret.length);
+        expect(setToPairs(set)).toEqual([p(1, 4), p(1, 6), p(1, 7), p(3, 0), p(3, 1)]);
+        expect(AtomSet.has(set, r(10, 11))).toBe(false);
+        expect(AtomSet.has(set, r(3, 0))).toBe(true);
+        expect(AtomSet.has(set, r(1, 7))).toBe(true);
+        for (let i = 0; i < AtomSet.size(set); i++) {
+            expect(AtomSet.getAt(set, i)).toBe(IntTuple.pack1(ret[i]));
+        }
+    });
+
+    it('element at / index of', () => {
+        const control: IntTuple[] = [];
+        const sets = Object.create(null);
+        for (let i = 1; i < 10; i++) {
+            const set = [];
+            for (let j = 1; j < 7; j++) {
+                control[control.length] = r(i * i, j * j + 1);
+                set[set.length] = j * j + 1;
+            }
+            sets[i * i] = OrderedSet.ofSortedArray(set);
+        }
+        const ms = AtomSet.create(sets);
+        for (let i = 0; i < control.length; i++) {
+            expect(IntTuple.areEqual(AtomSet.getAt(ms, i), control[i])).toBe(true);
+        }
+
+        for (let i = 0; i < control.length; i++) {
+            expect(AtomSet.indexOf(ms, control[i])).toBe(i);
+        }
+    });
+
+    it('packed pairs', () => {
+        const set = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        expect(setToPairs(set)).toEqual([p(0, 1), p(0, 2), p(0, 6), p(1, 3)]);
+    });
+
+    it('equality', () => {
+        const a = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const b = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const c = AtomSet.create([r(1, 3), r(0, 4), r(0, 6), r(0, 2)]);
+        const d = AtomSet.create([r(1, 3)]);
+        const e = AtomSet.create([r(1, 3)]);
+        const f = AtomSet.create([r(3, 3)]);
+
+        expect(AtomSet.areEqual(a, a)).toBe(true);
+        expect(AtomSet.areEqual(a, b)).toBe(true);
+        expect(AtomSet.areEqual(a, c)).toBe(false);
+        expect(AtomSet.areEqual(a, d)).toBe(false);
+        expect(AtomSet.areEqual(d, d)).toBe(true);
+        expect(AtomSet.areEqual(d, e)).toBe(true);
+        expect(AtomSet.areEqual(d, f)).toBe(false);
+    });
+
+    it('are intersecting', () => {
+        const a = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const b = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const c = AtomSet.create([r(1, 3), r(0, 4), r(0, 6), r(0, 2)]);
+        const d = AtomSet.create([r(1, 3)]);
+        const e = AtomSet.create([r(1, 3)]);
+        const f = AtomSet.create([r(3, 3)]);
+        const g = AtomSet.create([r(10, 3), r(8, 1), r(7, 6), r(3, 2)]);
+
+        expect(AtomSet.areIntersecting(a, a)).toBe(true);
+        expect(AtomSet.areIntersecting(a, b)).toBe(true);
+        expect(AtomSet.areIntersecting(a, c)).toBe(true);
+        expect(AtomSet.areIntersecting(a, d)).toBe(true);
+        expect(AtomSet.areIntersecting(a, g)).toBe(false);
+        expect(AtomSet.areIntersecting(d, d)).toBe(true);
+        expect(AtomSet.areIntersecting(d, e)).toBe(true);
+        expect(AtomSet.areIntersecting(d, f)).toBe(false);
+    });
+
+    it('intersection', () => {
+        const a = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const b = AtomSet.create([r(10, 3), r(0, 1), r(0, 6), r(4, 2)]);
+        const c = AtomSet.create([r(1, 3)]);
+        const d = AtomSet.create([r(2, 3)]);
+        expect(AtomSet.intersect(a, a)).toBe(a);
+        expect(setToPairs(AtomSet.intersect(a, b))).toEqual([p(0, 1), p(0, 6)]);
+        expect(setToPairs(AtomSet.intersect(a, c))).toEqual([p(1, 3)]);
+        expect(setToPairs(AtomSet.intersect(c, d))).toEqual([]);
+    });
+
+    it('subtract', () => {
+        const a = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const a1 = AtomSet.create([r(1, 3), r(0, 1), r(0, 6), r(0, 2)]);
+        const b = AtomSet.create([r(10, 3), r(0, 1), r(0, 6), r(4, 2)]);
+        const c = AtomSet.create([r(1, 3)]);
+        const d = AtomSet.create([r(2, 3)]);
+        expect(setToPairs(AtomSet.subtract(a, a))).toEqual([]);
+        expect(setToPairs(AtomSet.subtract(a, a1))).toEqual([]);
+        expect(setToPairs(AtomSet.subtract(a, b))).toEqual([p(0, 2), p(1, 3)]);
+        expect(setToPairs(AtomSet.subtract(c, d))).toEqual([p(1, 3)]);
+        expect(setToPairs(AtomSet.subtract(a, c))).toEqual([p(0, 1), p(0, 2), p(0, 6)]);
+        expect(setToPairs(AtomSet.subtract(c, a))).toEqual([]);
+        expect(setToPairs(AtomSet.subtract(d, a))).toEqual([p(2, 3)]);
+    });
+
+    it('union', () => {
+        const a = AtomSet.create([r(1, 3), r(0, 1)]);
+        const a1 = AtomSet.create([r(1, 3), r(0, 1)]);
+        const b = AtomSet.create([r(10, 3), r(0, 1)]);
+        const c = AtomSet.create([r(1, 3)]);
+        const d = AtomSet.create([r(2, 3)]);
+        expect(AtomSet.unionMany([a])).toBe(a);
+        expect(AtomSet.union(a, a)).toBe(a);
+        expect(setToPairs(AtomSet.union(a, a))).toEqual([p(0, 1), p(1, 3)]);
+        expect(setToPairs(AtomSet.union(a, a1))).toEqual([p(0, 1), p(1, 3)]);
+        expect(setToPairs(AtomSet.union(a, b))).toEqual([p(0, 1), p(1, 3), p(10, 3)]);
+        expect(setToPairs(AtomSet.union(c, d))).toEqual([p(1, 3), p(2, 3)]);
+        expect(setToPairs(AtomSet.unionMany([a, b, c, d]))).toEqual([p(0, 1), p(1, 3), p(2, 3), p(10, 3)]);
+    });
+});

+ 102 - 102
src/structure/collections/multi-set.ts → src/mol-data/atom-set.ts

@@ -4,160 +4,160 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import OrderedSet from './ordered-set'
-import Iterator from './iterator'
-import IntTuple from './int-tuple'
-import { sortArray } from './sort'
-import { hash1 } from './hash-functions'
+import OrderedSet from '../common/collections/ordered-set'
+import Iterator from '../common/collections/iterator'
+import IntTuple from '../common/collections/int-tuple'
+import { sortArray } from '../common/collections/sort'
+import { hash1 } from '../common/collections/hash-functions'
 
 /** A map-like representation of integer set */
-interface MultiSet { '@type': 'int-multi-set' }
+interface AtomSet { '@type': 'atom-set' }
 
-namespace MultiSet {
-    export const Empty: MultiSet = { offsets: [0], hashCode: 0, keys: OrderedSet.Empty } as MultiSetElements as any;
+namespace AtomSet {
+    export const Empty: AtomSet = { offsets: [0], hashCode: 0, keys: OrderedSet.Empty } as AtomSetElements as any;
 
-    export function create(data: IntTuple | ArrayLike<IntTuple> | IntTuple | { [id: number]: OrderedSet }): MultiSet {
+    export function create(data: IntTuple | ArrayLike<IntTuple> | IntTuple | { [id: number]: OrderedSet }): AtomSet {
         if (typeof data === 'number') return data;
         if (IntTuple.is(data)) return IntTuple.pack1(data) as any;
         if (isArrayLike(data)) return ofTuples(data) as any;
         return ofObject(data as { [id: number]: OrderedSet }) as any;
     }
 
-    export const keys: (set: MultiSet) => OrderedSet = keysI as any;
-    export const keyCount: (set: MultiSet) => number = keyCountI as any;
-    export const hasKey: (set: MultiSet, key: number) => boolean = hasKeyI as any;
-    export const geyKey: (set: MultiSet, i: number) => number = getKeyI as any;
-    export const getByKey: (set: MultiSet, key: number) => OrderedSet = getByKeyI as any;
-    export const getByIndex: (set: MultiSet, i: number) => OrderedSet = getByIndexI as any;
-    export const has: (set: MultiSet, x: IntTuple) => boolean = hasI as any;
-    export const indexOf: (set: MultiSet, x: IntTuple) => number = indexOfI as any;
-    export const getAt: (set: MultiSet, i: number) => IntTuple = getAtI as any;
-    export const values: (set: MultiSet) => Iterator<IntTuple.Unpacked> = valuesI as any;
+    export const keys: (set: AtomSet) => OrderedSet = keysI as any;
+    export const keyCount: (set: AtomSet) => number = keyCountI as any;
+    export const hasKey: (set: AtomSet, key: number) => boolean = hasKeyI as any;
+    export const geyKey: (set: AtomSet, i: number) => number = getKeyI as any;
+    export const getByKey: (set: AtomSet, key: number) => OrderedSet = getByKeyI as any;
+    export const getByIndex: (set: AtomSet, i: number) => OrderedSet = getByIndexI as any;
+    export const has: (set: AtomSet, x: IntTuple) => boolean = hasI as any;
+    export const indexOf: (set: AtomSet, x: IntTuple) => number = indexOfI as any;
+    export const getAt: (set: AtomSet, i: number) => IntTuple = getAtI as any;
+    export const values: (set: AtomSet) => Iterator<IntTuple.Unpacked> = valuesI as any;
 
-    export const size: (set: MultiSet) => number = sizeI as any;
-    export const hashCode: (set: MultiSet) => number = hashCodeI as any;
+    export const size: (set: AtomSet) => number = sizeI as any;
+    export const hashCode: (set: AtomSet) => number = hashCodeI as any;
 
-    export const areEqual: (a: MultiSet, b: MultiSet) => boolean = areEqualI as any;
-    export const areIntersecting: (a: MultiSet, b: MultiSet) => boolean = areIntersectingI as any;
+    export const areEqual: (a: AtomSet, b: AtomSet) => boolean = areEqualI as any;
+    export const areIntersecting: (a: AtomSet, b: AtomSet) => boolean = areIntersectingI as any;
 
-    export const union: (a: MultiSet, b: MultiSet) => MultiSet = unionI as any;
-    export const unionMany: (sets: MultiSet[]) => MultiSet = unionManyI as any;
-    export const intersect: (a: MultiSet, b: MultiSet) => MultiSet = intersectI as any;
-    export const subtract: (a: MultiSet, b: MultiSet) => MultiSet = subtractI as any;
+    export const union: (a: AtomSet, b: AtomSet) => AtomSet = unionI as any;
+    export const unionMany: (sets: AtomSet[]) => AtomSet = unionManyI as any;
+    export const intersect: (a: AtomSet, b: AtomSet) => AtomSet = intersectI as any;
+    export const subtract: (a: AtomSet, b: AtomSet) => AtomSet = subtractI as any;
 }
 
-export default MultiSet
+export default AtomSet
 
 /** Long and painful implementation starts here */
 
-interface MultiSetElements { [id: number]: OrderedSet, offsets: number[], hashCode: number, keys: OrderedSet }
-type MultiSetImpl = IntTuple | MultiSetElements
+interface AtomSetElements { [id: number]: OrderedSet, offsets: number[], hashCode: number, keys: OrderedSet }
+type AtomSetImpl = IntTuple | AtomSetElements
 
-function keysI(set: MultiSetImpl): OrderedSet {
+function keysI(set: AtomSetImpl): OrderedSet {
     if (typeof set === 'number') return OrderedSet.ofSingleton(set);
-    return (set as MultiSetElements).keys;
+    return (set as AtomSetElements).keys;
 }
 
-function keyCountI(set: MultiSetImpl): number {
+function keyCountI(set: AtomSetImpl): number {
     if (typeof set === 'number') return 1;
-    return OrderedSet.size((set as MultiSetElements).keys);
+    return OrderedSet.size((set as AtomSetElements).keys);
 }
 
-function hasKeyI(set: MultiSetImpl, key: number): boolean {
+function hasKeyI(set: AtomSetImpl, key: number): boolean {
     if (typeof set === 'number') return IntTuple.fst(set) === key;
-    return OrderedSet.has((set as MultiSetElements).keys, key);
+    return OrderedSet.has((set as AtomSetElements).keys, key);
 }
 
-function getKeyI(set: MultiSetImpl, index: number): number {
+function getKeyI(set: AtomSetImpl, index: number): number {
     if (typeof set === 'number') return IntTuple.fst(set);
-    return OrderedSet.getAt((set as MultiSetElements).keys, index);
+    return OrderedSet.getAt((set as AtomSetElements).keys, index);
 }
 
-function hasI(set: MultiSetImpl, t: IntTuple): boolean {
+function hasI(set: AtomSetImpl, t: IntTuple): boolean {
     if (typeof set === 'number') return IntTuple.areEqual(t, set);
     IntTuple.unpack(t, _hasP);
-    return OrderedSet.has((set as MultiSetElements).keys, _hasP.fst) ? OrderedSet.has((set as MultiSetElements)[_hasP.fst], _hasP.snd) : false;
+    return OrderedSet.has((set as AtomSetElements).keys, _hasP.fst) ? OrderedSet.has((set as AtomSetElements)[_hasP.fst], _hasP.snd) : false;
 }
 const _hasP = IntTuple.zero();
 
-function getByKeyI(set: MultiSetImpl, key: number): OrderedSet {
+function getByKeyI(set: AtomSetImpl, key: number): OrderedSet {
     if (typeof set === 'number') {
         IntTuple.unpack(set, _gS);
         return _gS.fst === key ? OrderedSet.ofSingleton(_gS.snd) : OrderedSet.Empty;
     }
-    return OrderedSet.has((set as MultiSetElements).keys, key) ? (set as MultiSetElements)[key] : OrderedSet.Empty;
+    return OrderedSet.has((set as AtomSetElements).keys, key) ? (set as AtomSetElements)[key] : OrderedSet.Empty;
 }
 const _gS = IntTuple.zero();
 
-function getByIndexI(set: MultiSetImpl, index: number): OrderedSet {
+function getByIndexI(set: AtomSetImpl, index: number): OrderedSet {
     if (typeof set === 'number') return index === 0 ? OrderedSet.ofSingleton(IntTuple.snd(set)) : OrderedSet.Empty;
-    const key = OrderedSet.getAt((set as MultiSetElements).keys, index);
-    return (set as MultiSetElements)[key] || OrderedSet.Empty;
+    const key = OrderedSet.getAt((set as AtomSetElements).keys, index);
+    return (set as AtomSetElements)[key] || OrderedSet.Empty;
 }
 
-function getAtI(set: MultiSetImpl, i: number): IntTuple {
+function getAtI(set: AtomSetImpl, i: number): IntTuple {
     if (typeof set === 'number') return set;
-    return getAtE(set as MultiSetElements, i);
+    return getAtE(set as AtomSetElements, i);
 }
 
-function indexOfI(set: MultiSetImpl, t: IntTuple) {
+function indexOfI(set: AtomSetImpl, t: IntTuple) {
     if (typeof set === 'number') return IntTuple.areEqual(set, t) ? 0 : -1;
-    return indexOfE(set as MultiSetElements, t);
+    return indexOfE(set as AtomSetElements, t);
 }
 
 /** Number elements in the "child" sets */
-function sizeI(set: MultiSetImpl) {
+function sizeI(set: AtomSetImpl) {
     if (typeof set === 'number') return 1;
-    return (set as MultiSetElements).offsets[(set as MultiSetElements).offsets.length - 1];
+    return (set as AtomSetElements).offsets[(set as AtomSetElements).offsets.length - 1];
 }
 
-function hashCodeI(set: MultiSetImpl) {
+function hashCodeI(set: AtomSetImpl) {
     if (typeof set === 'number') return IntTuple.hashCode(set);
-    if ((set as MultiSetElements).hashCode !== -1) return (set as MultiSetElements).hashCode;
-    return computeHash((set as MultiSetElements));
+    if ((set as AtomSetElements).hashCode !== -1) return (set as AtomSetElements).hashCode;
+    return computeHash((set as AtomSetElements));
 }
 
-function areEqualI(a: MultiSetImpl, b: MultiSetImpl) {
+function areEqualI(a: AtomSetImpl, b: AtomSetImpl) {
     if (typeof a === 'number') {
         if (typeof b === 'number') return IntTuple.areEqual(a, b);
         return false;
     }
     if (typeof b === 'number') return false;
-    return areEqualEE(a as MultiSetElements, b as MultiSetElements);
+    return areEqualEE(a as AtomSetElements, b as AtomSetElements);
 }
 
-function areIntersectingI(a: MultiSetImpl, b: MultiSetImpl) {
+function areIntersectingI(a: AtomSetImpl, b: AtomSetImpl) {
     if (typeof a === 'number') {
         if (typeof b === 'number') return IntTuple.areEqual(a, b);
-        return areIntersectingNE(a, b as MultiSetElements);
+        return areIntersectingNE(a, b as AtomSetElements);
     }
-    if (typeof b === 'number') return areIntersectingNE(b, a as MultiSetElements);
-    return areIntersectingEE(a as MultiSetElements, b as MultiSetElements);
+    if (typeof b === 'number') return areIntersectingNE(b, a as AtomSetElements);
+    return areIntersectingEE(a as AtomSetElements, b as AtomSetElements);
 }
 
-function intersectI(a: MultiSetImpl, b: MultiSetImpl) {
+function intersectI(a: AtomSetImpl, b: AtomSetImpl) {
     if (typeof a === 'number') {
-        if (typeof b === 'number') return IntTuple.areEqual(a, b) ? a : MultiSet.Empty;
-        return intersectNE(a, b as MultiSetElements);
+        if (typeof b === 'number') return IntTuple.areEqual(a, b) ? a : AtomSet.Empty;
+        return intersectNE(a, b as AtomSetElements);
     }
-    if (typeof b === 'number') return intersectNE(b, a as MultiSetElements);
-    return intersectEE(a as MultiSetElements, b as MultiSetElements);
+    if (typeof b === 'number') return intersectNE(b, a as AtomSetElements);
+    return intersectEE(a as AtomSetElements, b as AtomSetElements);
 }
 
-function subtractI(a: MultiSetImpl, b: MultiSetImpl) {
+function subtractI(a: AtomSetImpl, b: AtomSetImpl) {
     if (typeof a === 'number') {
-        if (typeof b === 'number') return IntTuple.areEqual(a, b) ? MultiSet.Empty : a;
-        return subtractNE(a, b as MultiSetElements);
+        if (typeof b === 'number') return IntTuple.areEqual(a, b) ? AtomSet.Empty : a;
+        return subtractNE(a, b as AtomSetElements);
     }
-    if (typeof b === 'number') return subtractEN(a as MultiSetElements, b);
-    return subtractEE(a as MultiSetElements, b as MultiSetElements);
+    if (typeof b === 'number') return subtractEN(a as AtomSetElements, b);
+    return subtractEE(a as AtomSetElements, b as AtomSetElements);
 }
 
-function unionI(a: MultiSetImpl, b: MultiSetImpl) {
+function unionI(a: AtomSetImpl, b: AtomSetImpl) {
     return findUnion([a, b]);
 }
 
-function unionManyI(sets: ArrayLike<MultiSetImpl>) {
+function unionManyI(sets: ArrayLike<AtomSetImpl>) {
     return findUnion(sets);
 }
 
@@ -198,16 +198,16 @@ class ElementsIterator implements Iterator<IntTuple.Unpacked> {
         return true;
     }
 
-    constructor(private elements: MultiSetElements) {
+    constructor(private elements: AtomSetElements) {
         this.keyCount = OrderedSet.size(elements.keys);
         this.done = this.keyCount === 0;
         this.advance();
     }
 }
 
-function valuesI(set: MultiSetImpl): Iterator<IntTuple.Unpacked> {
+function valuesI(set: AtomSetImpl): Iterator<IntTuple.Unpacked> {
     if (typeof set === 'number') return Iterator.Value(IntTuple.unpack1(set));
-    return new ElementsIterator(set as MultiSetElements);
+    return new ElementsIterator(set as AtomSetElements);
 }
 
 function isArrayLike(x: any): x is ArrayLike<IntTuple> {
@@ -220,7 +220,7 @@ function ofObject(data: { [id: number]: OrderedSet }) {
         const k = +_k;
         if (OrderedSet.size(data[k]) > 0) keys[keys.length] = k;
     }
-    if (!keys.length) return MultiSet.Empty;
+    if (!keys.length) return AtomSet.Empty;
     if (keys.length === 1) {
         const set = data[keys[0]];
         if (OrderedSet.size(set) === 1) return IntTuple.pack(keys[0], OrderedSet.getAt(set, 0));
@@ -248,7 +248,7 @@ function ofObjectOrdered(keys: OrderedSet, data: { [id: number]: OrderedSet }) {
 }
 
 function _createObjectOrdered(keys: OrderedSet, data: { [id: number]: OrderedSet }) {
-    const ret: MultiSetElements = Object.create(null);
+    const ret: AtomSetElements = Object.create(null);
     ret.keys = keys;
     const offsets = [0];
     let size = 0;
@@ -287,7 +287,7 @@ function normalizeArray(xs: number[]) {
 }
 
 function ofTuples(xs: ArrayLike<IntTuple>) {
-    if (xs.length === 0) return MultiSet.Empty;
+    if (xs.length === 0) return AtomSet.Empty;
     const sets: { [key: number]: number[] } = Object.create(null);
     const p = IntTuple.zero();
     for (let i = 0, _i = xs.length; i < _i; i++) {
@@ -321,7 +321,7 @@ function getOffsetIndex(xs: ArrayLike<number>, value: number) {
     return value < xs[min] ? min - 1 : min;
 }
 
-function getAtE(set: MultiSetElements, i: number): IntTuple {
+function getAtE(set: AtomSetElements, i: number): IntTuple {
     const { offsets, keys } = set;
     const o = getOffsetIndex(offsets, i);
     if (o >= offsets.length - 1) return 0 as any;
@@ -331,7 +331,7 @@ function getAtE(set: MultiSetElements, i: number): IntTuple {
 }
 
 const _iOE = IntTuple.zero();
-function indexOfE(set: MultiSetElements, t: IntTuple) {
+function indexOfE(set: AtomSetElements, t: IntTuple) {
     IntTuple.unpack(t, _iOE);
     const { keys } = set;
     const setIdx = OrderedSet.indexOf(keys, _iOE.fst);
@@ -341,7 +341,7 @@ function indexOfE(set: MultiSetElements, t: IntTuple) {
     return set.offsets[setIdx] + o;
 }
 
-function computeHash(set: MultiSetElements) {
+function computeHash(set: AtomSetElements) {
     const { keys } = set;
     let hash = 23;
     for (let i = 0, _i = OrderedSet.size(keys); i < _i; i++) {
@@ -355,7 +355,7 @@ function computeHash(set: MultiSetElements) {
     return hash;
 }
 
-function areEqualEE(a: MultiSetElements, b: MultiSetElements) {
+function areEqualEE(a: AtomSetElements, b: AtomSetElements) {
     if (a === b) return true;
     if (sizeI(a) !== sizeI(a)) return false;
 
@@ -369,12 +369,12 @@ function areEqualEE(a: MultiSetElements, b: MultiSetElements) {
 }
 
 const _aeP = IntTuple.zero();
-function areIntersectingNE(a: IntTuple, b: MultiSetElements) {
+function areIntersectingNE(a: IntTuple, b: AtomSetElements) {
     IntTuple.unpack(a, _aeP);
     return OrderedSet.has(b.keys, _aeP.fst) && OrderedSet.has(b[_aeP.fst], _aeP.snd);
 }
 
-function areIntersectingEE(a: MultiSetElements, b: MultiSetElements) {
+function areIntersectingEE(a: AtomSetElements, b: AtomSetElements) {
     if (a === b) return true;
     const keysA = a.keys, keysB = b.keys;
     if (!OrderedSet.areIntersecting(a.keys, b.keys)) return false;
@@ -387,16 +387,16 @@ function areIntersectingEE(a: MultiSetElements, b: MultiSetElements) {
 }
 
 const _nP = IntTuple.zero();
-function intersectNE(a: IntTuple, b: MultiSetElements) {
+function intersectNE(a: IntTuple, b: AtomSetElements) {
     IntTuple.unpack(a, _nP);
-    return OrderedSet.has(b.keys, _nP.fst) && OrderedSet.has(b[_nP.fst], _nP.snd) ? a : MultiSet.Empty;
+    return OrderedSet.has(b.keys, _nP.fst) && OrderedSet.has(b[_nP.fst], _nP.snd) ? a : AtomSet.Empty;
 }
 
-function intersectEE(a: MultiSetElements, b: MultiSetElements) {
+function intersectEE(a: AtomSetElements, b: AtomSetElements) {
     if (a === b) return a;
 
     const keysA = a.keys, keysB = b.keys;
-    if (!OrderedSet.areIntersecting(a.keys, b.keys)) return MultiSet.Empty;
+    if (!OrderedSet.areIntersecting(a.keys, b.keys)) return AtomSet.Empty;
     const { start, end } = OrderedSet.getIntervalRange(keysA, OrderedSet.min(keysB), OrderedSet.max(keysB));
 
     const keys = [], ret = Object.create(null);
@@ -414,13 +414,13 @@ function intersectEE(a: MultiSetElements, b: MultiSetElements) {
 }
 
 const _sNE = IntTuple.zero();
-function subtractNE(a: IntTuple, b: MultiSetElements) {
+function subtractNE(a: IntTuple, b: AtomSetElements) {
     IntTuple.unpack(a, _sNE);
-    return OrderedSet.has(b.keys, _sNE.fst) && OrderedSet.has(b[_sNE.fst], _sNE.snd) ? MultiSet.Empty : a;
+    return OrderedSet.has(b.keys, _sNE.fst) && OrderedSet.has(b[_sNE.fst], _sNE.snd) ? AtomSet.Empty : a;
 }
 
 const _sEN = IntTuple.zero();
-function subtractEN(a: MultiSetElements, b: IntTuple): MultiSetImpl {
+function subtractEN(a: AtomSetElements, b: IntTuple): AtomSetImpl {
     const aKeys =  a.keys;
     IntTuple.unpack(b, _sEN);
     if (!OrderedSet.has(aKeys, _sEN.fst) || !OrderedSet.has(a[_sEN.fst], _sEN.snd)) return a;
@@ -432,11 +432,11 @@ function subtractEN(a: MultiSetElements, b: IntTuple): MultiSetImpl {
     }
 }
 
-function subtractEE(a: MultiSetElements, b: MultiSetElements) {
-    if (a === b) return MultiSet.Empty;
+function subtractEE(a: AtomSetElements, b: AtomSetElements) {
+    if (a === b) return AtomSet.Empty;
 
     const keysA = a.keys, keysB = b.keys;
-    if (!OrderedSet.areIntersecting(a.keys, b.keys)) return MultiSet.Empty;
+    if (!OrderedSet.areIntersecting(a.keys, b.keys)) return AtomSet.Empty;
     const { start, end } = OrderedSet.getIntervalRange(keysA, OrderedSet.min(keysB), OrderedSet.max(keysB));
 
     const keys = [], ret = Object.create(null);
@@ -466,8 +466,8 @@ function subtractEE(a: MultiSetElements, b: MultiSetElements) {
     return ofObjectOrdered(OrderedSet.ofSortedArray(keys), ret);
 }
 
-function findUnion(sets: ArrayLike<MultiSetImpl>) {
-    if (!sets.length) return MultiSet.Empty;
+function findUnion(sets: ArrayLike<AtomSetImpl>) {
+    if (!sets.length) return AtomSet.Empty;
     if (sets.length === 1) return sets[0];
     if (sets.length === 2 && areEqualI(sets[0], sets[1])) return sets[0];
 
@@ -477,23 +477,23 @@ function findUnion(sets: ArrayLike<MultiSetImpl>) {
     const ret = Object.create(null);
     for (let i = 0, _i = sets.length; i < _i; i++) {
         const s = sets[i];
-        if (typeof s !== 'number') unionInto(ret, s as MultiSetElements);
+        if (typeof s !== 'number') unionInto(ret, s as AtomSetElements);
     }
-    if (sizeI(ns as MultiSetImpl) > 0) {
+    if (sizeI(ns as AtomSetImpl) > 0) {
         if (typeof ns === 'number') unionIntoN(ret, ns as any);
-        else unionInto(ret, ns as MultiSetElements);
+        else unionInto(ret, ns as AtomSetElements);
     }
     return ofObject(ret);
 }
 
-function unionN(sets: ArrayLike<MultiSetImpl>, eCount: { count: number }) {
+function unionN(sets: ArrayLike<AtomSetImpl>, eCount: { count: number }) {
     let countN = 0, countE = 0;
     for (let i = 0, _i = sets.length; i < _i; i++) {
         if (typeof sets[i] === 'number') countN++;
         else countE++;
     }
     eCount.count = countE;
-    if (!countN) return MultiSet.Empty;
+    if (!countN) return AtomSet.Empty;
     if (countN === sets.length) return ofTuples(sets as ArrayLike<IntTuple>);
     const packed = new Float64Array(countN);
     let offset = 0;
@@ -504,7 +504,7 @@ function unionN(sets: ArrayLike<MultiSetImpl>, eCount: { count: number }) {
     return ofTuples(packed as any);
 }
 
-function unionInto(data: { [key: number]: OrderedSet }, a: MultiSetElements) {
+function unionInto(data: { [key: number]: OrderedSet }, a: AtomSetElements) {
     const keys = a.keys;
     for (let i = 0, _i = OrderedSet.size(keys); i < _i; i++) {
         const k = OrderedSet.getAt(keys, i);

+ 0 - 0
src/structure/data.ts → src/mol-data/structure/data.ts


+ 1 - 1
src/structure/model.ts → src/mol-data/structure/model.ts

@@ -6,7 +6,7 @@
 
 import * as Data from './data'
 import { Selectors } from './selectors'
-import { Vec3, Mat4 } from '../utils/linear-algebra'
+import { Vec3, Mat4 } from '../../common/math/linear-algebra'
 
 let _uid = 0;
 /** Model-related unique identifiers */

+ 0 - 0
src/structure/selectors.ts → src/mol-data/structure/selectors.ts


+ 0 - 0
src/structure/selectors/common.ts → src/mol-data/structure/selectors/common.ts


+ 0 - 0
src/structure/selectors/mmcif.ts → src/mol-data/structure/selectors/mmcif.ts


+ 1 - 2
src/index.ts → src/mol-data/structure/structure.ts

@@ -1,7 +1,6 @@
 /**
  * Copyright (c) 2017 molio contributors, licensed under MIT, See LICENSE file for more info.
  *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
+ * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-// TODO: fix me

+ 0 - 0
src/structure/symmetry.ts → src/mol-data/structure/symmetry.ts


+ 0 - 0
src/structure/topology/connected-components.ts → src/mol-data/structure/topology/connected-components.ts


+ 0 - 0
src/structure/topology/secondary-structure.ts → src/mol-data/structure/topology/secondary-structure.ts


+ 0 - 0
src/reader/spec/cif.spec.ts → src/mol-io/reader/_spec/cif.spec.ts


+ 0 - 0
src/reader/spec/column.spec.ts → src/mol-io/reader/_spec/column.spec.ts


+ 0 - 0
src/reader/spec/gro.spec.ts → src/mol-io/reader/_spec/gro.spec.ts


+ 0 - 0
src/reader/cif/binary/decoder.ts → src/mol-io/reader/cif/binary/decoder.ts


+ 0 - 0
src/reader/cif/binary/encoding.ts → src/mol-io/reader/cif/binary/encoding.ts


+ 0 - 0
src/reader/cif/binary/field.ts → src/mol-io/reader/cif/binary/field.ts


+ 1 - 1
src/reader/cif/binary/parser.ts → src/mol-io/reader/cif/binary/parser.ts

@@ -9,7 +9,7 @@ import * as Encoding from './encoding'
 import Field from './field'
 import Result from '../../result'
 import decodeMsgPack from '../../../utils/msgpack/decode'
-import Computation from '../../../utils/computation'
+import Computation from '../../../../common/computation'
 
 function checkVersions(min: number[], current: number[]) {
     for (let i = 0; i < 2; i++) {

+ 0 - 0
src/reader/cif/data-model.ts → src/mol-io/reader/cif/data-model.ts


+ 0 - 0
src/reader/cif/index.ts → src/mol-io/reader/cif/index.ts


+ 0 - 0
src/reader/cif/schema.ts → src/mol-io/reader/cif/schema.ts


+ 0 - 0
src/reader/cif/schema/ccd.ts → src/mol-io/reader/cif/schema/ccd.ts


+ 0 - 0
src/reader/cif/schema/ddl.ts → src/mol-io/reader/cif/schema/ddl.ts


+ 0 - 0
src/reader/cif/schema/density.ts → src/mol-io/reader/cif/schema/density.ts


+ 0 - 0
src/reader/cif/schema/dic.ts → src/mol-io/reader/cif/schema/dic.ts


+ 0 - 0
src/reader/cif/schema/mmcif.ts → src/mol-io/reader/cif/schema/mmcif.ts


+ 0 - 0
src/reader/cif/schema/utils.ts → src/mol-io/reader/cif/schema/utils.ts


+ 0 - 0
src/reader/cif/text/field.ts → src/mol-io/reader/cif/text/field.ts


+ 1 - 1
src/reader/cif/text/parser.ts → src/mol-io/reader/cif/text/parser.ts

@@ -26,7 +26,7 @@ import * as Data from '../data-model'
 import Field from './field'
 import { Tokens, TokenBuilder } from '../../common/text/tokenizer'
 import Result from '../../result'
-import Computation from '../../../utils/computation'
+import Computation from '../../../../common/computation'
 
 /**
  * Types of supported mmCIF tokens.

+ 0 - 0
src/reader/common/binary/column.ts → src/mol-io/reader/common/binary/column.ts


+ 0 - 0
src/reader/common/column.ts → src/mol-io/reader/common/column.ts


+ 0 - 0
src/reader/common/text/column/fixed.ts → src/mol-io/reader/common/text/column/fixed.ts


+ 0 - 0
src/reader/common/text/column/token.ts → src/mol-io/reader/common/text/column/token.ts


+ 0 - 0
src/reader/common/text/number-parser.ts → src/mol-io/reader/common/text/number-parser.ts


+ 1 - 1
src/reader/common/text/tokenizer.ts → src/mol-io/reader/common/text/tokenizer.ts

@@ -6,7 +6,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import Computation from '../../../utils/computation'
+import Computation from '../../../../common/computation'
 
 export interface Tokenizer {
     data: string,

+ 1 - 1
src/reader/gro/parser.ts → src/mol-io/reader/gro/parser.ts

@@ -10,7 +10,7 @@ import FixedColumn from '../common/text/column/fixed'
 import { ColumnType, UndefinedColumn } from '../common/column'
 import * as Schema from './schema'
 import Result from '../result'
-import Computation from '../../utils/computation'
+import Computation from '../../../common/computation'
 
 interface State {
     tokenizer: Tokenizer,

+ 0 - 0
src/reader/gro/schema.d.ts → src/mol-io/reader/gro/schema.d.ts


+ 0 - 0
src/reader/mol2/schema.d.ts → src/mol-io/reader/mol2/schema.d.ts


+ 0 - 0
src/reader/result.ts → src/mol-io/reader/result.ts


+ 0 - 0
src/utils/msgpack/decode.ts → src/mol-io/utils/msgpack/decode.ts


+ 0 - 0
src/utils/msgpack/encode.ts → src/mol-io/utils/msgpack/encode.ts


+ 0 - 0
src/utils/short-string-pool.ts → src/mol-io/utils/short-string-pool.ts


+ 0 - 0
src/utils/utf8.ts → src/mol-io/utils/utf8.ts


+ 1 - 1
src/perf-tests/chunked-array-vs-native.ts

@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import ChunkedArray from '../utils/chunked-array'
+import ChunkedArray from '../common/collections/chunked-array'
 
 function testNative(size: number) {
     const xs = new Array(size);

+ 10 - 10
src/perf-tests/sets.ts

@@ -1,7 +1,7 @@
 import * as B from 'benchmark'
-import IntTuple from '../structure/collections/int-tuple'
-import OrdSet from '../structure/collections/ordered-set'
-import MSet from '../structure/collections/multi-set'
+import IntTuple from '../common/collections/int-tuple'
+import OrdSet from '../common/collections/ordered-set'
+import AtomSet from '../mol-data/atom-set'
 
 namespace Iteration {
     const U = 1000, V = 2500;
@@ -16,7 +16,7 @@ namespace Iteration {
         }
         sets[i * i] = OrdSet.ofSortedArray(set);
     }
-    const ms = MSet.create(sets);
+    const ms = AtomSet.create(sets);
 
     export function native() {
         let s = 0;
@@ -26,22 +26,22 @@ namespace Iteration {
 
     export function iterators() {
         let s = 0;
-        const it = MSet.values(ms);
+        const it = AtomSet.values(ms);
         for (let v = it.move(); !it.done; v = it.move()) s += v.snd;
         return s;
     }
 
     export function elementAt() {
         let s = 0;
-        for (let i = 0, _i = MSet.size(ms); i < _i; i++) s += IntTuple.snd(MSet.getAt(ms, i));
+        for (let i = 0, _i = AtomSet.size(ms); i < _i; i++) s += IntTuple.snd(AtomSet.getAt(ms, i));
         return s;
     }
 
     export function manual() {
         let s = 0;
-        const keys = MSet.keys(ms);
+        const keys = AtomSet.keys(ms);
         for (let i = 0, _i = OrdSet.size(keys); i < _i; i++) {
-            const set = MSet.getByKey(ms, OrdSet.getAt(keys, i));
+            const set = AtomSet.getByKey(ms, OrdSet.getAt(keys, i));
             for (let j = 0, _j = OrdSet.size(set); j < _j; j++) {
                 s += OrdSet.getAt(set, j);
             }
@@ -51,8 +51,8 @@ namespace Iteration {
 
     export function manual1() {
         let s = 0;
-        for (let i = 0, _i = MSet.keyCount(ms); i < _i; i++) {
-            const set = MSet.getByIndex(ms, i);
+        for (let i = 0, _i = AtomSet.keyCount(ms); i < _i; i++) {
+            const set = AtomSet.getByIndex(ms, i);
             for (let j = 0, _j = OrdSet.size(set); j < _j; j++) {
                 s += OrdSet.getAt(set, j);
             }

+ 1 - 1
src/perf-tests/sort.ts

@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import * as Sort from '../structure/collections/sort'
+import * as Sort from '../common/collections/sort'
 
 function shuffle(a: number[]) {
     for (let i = a.length - 1; i > 0; i--) {

+ 5 - 4
src/script.ts

@@ -12,11 +12,13 @@ require('util.promisify').shim();
 const readFileAsync = util.promisify(fs.readFile);
 const writeFileAsync = util.promisify(fs.writeFile);
 
-import Gro from './reader/gro/parser'
-import CIF from './reader/cif/index'
+import Gro from './mol-io/reader/gro/parser'
+import CIF from './mol-io/reader/cif/index'
+
+import Computation from './common/computation'
 
 // import { toTypedFrame as applySchema } from './reader/cif/schema'
-import { generateSchema } from './reader/cif/schema/utils'
+import { generateSchema } from './mol-io/reader/cif/schema/utils'
 
 const file = '1crn.gro'
 // const file = 'water.gro'
@@ -173,7 +175,6 @@ export async function _dic() {
 
 _dic();
 
-import Computation from './utils/computation'
 const comp = Computation.create(async ctx => {
     for (let i = 0; i < 0; i++) {
         await new Promise(res => setTimeout(res, 500));

+ 3 - 2
tsconfig.json

@@ -9,7 +9,8 @@
         "strictNullChecks": true,
         //"downlevelIteration": true,
         "lib": [ "es6", "dom" ],
-        "outDir": "build/js/src"
+        "outDir": "build/js/src",
+        "baseUrl": "src"
     },
-    "include": [ "src/**/*" ]
+    "include": [ "**/*" ]
 }