From c1bc5a86f4877f486b84d53da079dc2b4e8a455b Mon Sep 17 00:00:00 2001
From: Lauri Himanen <lauri.himanen@gmail.com>
Date: Tue, 3 Nov 2020 00:13:17 +0100
Subject: [PATCH] Added support for visualizing structures without a unit cell,
 fixed issue in the viewer not clearing out data from a previous
 visualization.

---
 gui/package.json                              | 2 +-
 gui/src/components/archive/ArchiveBrowser.js  | 6 +++---
 gui/src/components/visualization/Structure.js | 4 ++--
 gui/yarn.lock                                 | 8 ++++----
 setup.sh                                      | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gui/package.json b/gui/package.json
index e2d8a885c6..3ef9d6619f 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -4,7 +4,7 @@
   "commit": "e98694e",
   "private": true,
   "dependencies": {
-    "@lauri-codes/materia": "0.0.7",
+    "@lauri-codes/materia": "0.0.9",
     "@material-ui/core": "^4.0.0",
     "@material-ui/icons": "^4.0.0",
     "@material-ui/lab": "^4.0.0-alpha.49",
diff --git a/gui/src/components/archive/ArchiveBrowser.js b/gui/src/components/archive/ArchiveBrowser.js
index a52be99d0a..d28fd4a7a8 100644
--- a/gui/src/components/archive/ArchiveBrowser.js
+++ b/gui/src/components/archive/ArchiveBrowser.js
@@ -46,8 +46,8 @@ export const unitsState = atom({
 })
 
 // Shared instance of the StructureViewer
-const viewer = new StructureViewer()
-const bzViewer = new BrillouinZoneViewer()
+const viewer = new StructureViewer(undefined, {view: {autoResize: false}})
+const bzViewer = new BrillouinZoneViewer(undefined, {view: {autoResize: false}})
 
 // Contains details about the currently visualized system. Used to detect if a
 // reload is needed for the StructureViewer.
@@ -430,7 +430,7 @@ function Overview({section, def}) {
       }
       system = {
         'species': section.atom_species,
-        'cell': convertSI(section.lattice_vectors, 'meter', {length: 'angstrom'}, false),
+        'cell': section.lattice_vectors ? convertSI(section.lattice_vectors, 'meter', {length: 'angstrom'}, false) : undefined,
         'positions': convertSI(section.atom_positions, 'meter', {length: 'angstrom'}, false),
         'pbc': section.configuration_periodic_dimensions
       }
diff --git a/gui/src/components/visualization/Structure.js b/gui/src/components/visualization/Structure.js
index 5a1203eff9..205e1cdc5e 100644
--- a/gui/src/components/visualization/Structure.js
+++ b/gui/src/components/visualization/Structure.js
@@ -157,7 +157,7 @@ export default function Structure({className, classes, system, options, viewer,
             [1, 0, 0, 30]
           ]
         }
-      }})
+      }}, false, false)
     // Systems without cell are centered on the center of positions
     } else {
       refViewer.current.setOptions({layout: {
@@ -168,7 +168,7 @@ export default function Structure({className, classes, system, options, viewer,
             [1, 0, 0, 30]
           ]
         }
-      }})
+      }}, false, false)
     }
     refViewer.current.load(system)
     refViewer.current.fitToCanvas()
diff --git a/gui/yarn.lock b/gui/yarn.lock
index de54787e72..a1c252a2ad 100644
--- a/gui/yarn.lock
+++ b/gui/yarn.lock
@@ -1287,10 +1287,10 @@
   resolved "https://registry.yarnpkg.com/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz#84900f0eefc372798f4751b5262830b8208922ec"
   integrity sha1-hJAPDu/DcnmPR1G1JigwuCCJIuw=
 
-"@lauri-codes/materia@0.0.7":
-  version "0.0.7"
-  resolved "https://registry.yarnpkg.com/@lauri-codes/materia/-/materia-0.0.7.tgz#7580526874420641e26ab00bf0412d2a803d2cda"
-  integrity sha512-G3d4kRBNG4rYsLKceiW7Uhqy/uX0PFo70tsOIDZnOiNAICSIFF62LbYLDVHKgJf35xtyQM0kvM1WQGKgL9tmIw==
+"@lauri-codes/materia@0.0.9":
+  version "0.0.9"
+  resolved "https://registry.yarnpkg.com/@lauri-codes/materia/-/materia-0.0.9.tgz#3ac8cac1b9ce8201a9e881afc0c5c6652c5a692a"
+  integrity sha512-qtY3pOWCKVG6z6iEs88vl/hqQNgK3tSCVNcAkSKFnuhk/Qdk66xHl7ZGVDMAOyqdXukNR2+iuZC/6CdFKc6/ow==
   dependencies:
     three "^0.119.1"
     threejs-meshline "^2.0.11"
diff --git a/setup.sh b/setup.sh
index dd120f62ec..fb3fd9c0ce 100755
--- a/setup.sh
+++ b/setup.sh
@@ -10,5 +10,5 @@ git submodule update --init --jobs=4
 pip install -e .[all]
 
 nomad dev metainfo > gui/src/metainfo.json
-nomad dev search-quantities > gui/src/search-quantities.json
+nomad dev search-quantities > gui/src/searchQuantities.json
 nomad dev units > gui/src/units.js
-- 
GitLab