Scheduled maintenance on Monday 2019-06-24 between 10:00-11:00 CEST

Commit dc3ecc75 authored by Huhs, Georg (ghuhs)'s avatar Huhs, Georg (ghuhs)

added encyclopedia tutorial - BKR MISSINGgit statusgit status!

parent 16d70ec2
function apiReq(materialId, dataType, authToken, callback){
let oReq = new XMLHttpRequest();
oReq.addEventListener("load", callback);"GET", ""+materialId+"/"+dataType);
oReq.setRequestHeader('Authorization', 'Basic '+btoa(authToken));
return oReq;
function getMaterialStructureDataFromAPI(materialId, authToken, callback){
apiReq(materialId, 'elements', authToken, e => {
let elements = JSON.parse(;
apiReq(materialId, 'cells', authToken, e1 => {
let cells = JSON.parse(;
let cell;
if (!cells[0].is_primitive) cell= cells[0];
else cell= cells[1];
callback(getCellDataForViewer(elements, cell));
function getNumberArray(string){
let sArray= string.substring(1,string.length-1).split(',');
let fArray= [];
for (let i = 0; i < sArray.length; i++) {
return fArray;
function getCellDataForViewer(elements, cell){
let cellData= {};
cellData.normalizedCell= [
cellData.labels= [];
cellData.positions= [];
for (let i = 0; i < elements.length; i++) {
//cellData.periodicity = JSON.parse(matData.periodicity);
return cellData;
"id": "5a1bf3b780996e0031366357",
"type": "demos",
"attributes": {
"title": "Encyclopedia API and code usage",
"logicalPath": "/data/shared/ghuhs/encyclopedia.bkr",
"authors": ["Himanen, Lauri", "Huhs, Georg", "Hurtado, Iker", "Kuban, Martin", "Vancea, Ioan", "Draxl, Claudia"],
"editLink": "/notebook-edit/data/shared/tutorialsNew/encyclopedia/encyclopedia.bkr",
"isPublic": true,
"username": "tutorialsNew",
"description": "This tutorial deals mainly with accessing the NOMAD Encyclopedia API (searching for materials, extracting data for specific materials and calculations). It also shows how code developed for the Encyclopedia GUI can be embedded into client applications. ",
"created_at": "2018-09-22T11:15:03.028Z",
"updated_at": "2018-09-22T11:15:03.028Z",
"user_update": "2018-09-22",
"top_of_list": true,
"featured": true,
"labels" : {
"category" : ["Demo"],
"platform" : ["beaker"],
"language" : ["python", "javascript"],
"application_section" : ["Encyclopedia"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment