From 2214c145f3c0a45edfa3a63f319a0594e6f2a348 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 24 Jun 2015 14:28:33 -0700
Subject: [PATCH] pass gik length through

---
 js/cells/supercells/DMASuperCell.js | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js
index 6fe753f4..c44d1293 100644
--- a/js/cells/supercells/DMASuperCell.js
+++ b/js/cells/supercells/DMASuperCell.js
@@ -40,17 +40,19 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
 
                     cells[x][y].push(null);
 
+                    var json = {index: new THREE.Vector3(x,y,z)};
+                    var callback = function(cell){
+                        var cellIndex = cell.getIndex();//x,y,z have changed by now
+                        cells[cellIndex.x][cellIndex.y][cellIndex.z] = cell;
+                    };
+
                     if (material.sparseCells){
                         if (material.sparseCells[x][y][z]){
-                            this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), materialName:material.sparseCells[x][y][z].materialName}, function(cell){
-                                var cellIndex = cell.getIndex();//x,y,z have changed by now
-                                cells[cellIndex.x][cellIndex.y][cellIndex.z] = cell;
-                            });
+                            json = _.extend(json, material.sparseCells[x][y][z]);
+                            this._makeSubCellForIndex(json, callback);
                         }//else no cell in this spot
                     } else {//if not from composite definition, add subcell at all possible indices in supercell range
-                        this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), materialName:this.materialName}, function(cell){
-                            cells[x][y][z] = cell;
-                        });
+                        this._makeSubCellForIndex(json, callback);
                     }
                 }
             }
-- 
GitLab