Added NOMAD2XYZ app (used for preprocessing json into remote visualization

ready datasets).
parent bc195a51
......@@ -36,9 +36,6 @@ float scaling;
float markerscaling;
float BACKGROUND[3];
int* numAtoms; //[timesteps]
float **atoms; //[timesteps][numAtoms[i]*4] //xyzu, u=atom number
bool fixedAtoms;
float atomScaling;
std::vector<float> *clonedAtoms;
......@@ -55,11 +52,8 @@ bool showTrajectories;
std::vector<int> atomtrajectories;
std::vector<std::vector<int>> atomtrajectoryrestarts;
float abc[3][3]; //basis vectors
bool has_abc = false;
bool displayunitcell;
float supercell[3];
int voxelSize[3];
float unitcellcolour[4];
float supercellcolour[4];
......@@ -79,7 +73,6 @@ float nearclip, farclip;
//markers such as hole positions and electron positions
float ** markers;
float ** markercolours;
float cubetrans[3];
float animationspeed;
float movementspeed;
......
......@@ -19,6 +19,7 @@
#include <vector>
#include "MyGL.h"
#include "polyhedron.h"
#include "ConfigFileAtoms.h"
extern const char * PATH;
extern const char * SCREENSHOT;
......@@ -31,9 +32,7 @@ extern float userpos[3];
extern float scaling;
extern float BACKGROUND[3];
extern int* numAtoms; //[timesteps]
extern float **atoms; //[timesteps][numAtoms[i]*4] //xyzu, u=atom number
extern bool fixedAtoms; //all timesteps use the atoms for timestep 0. Used for excitons etc.
extern float atomScaling;
extern std::vector<float> *clonedAtoms;
extern std::vector<int> bonds;
......@@ -49,10 +48,8 @@ extern bool showTrajectories;
extern std::vector<int> atomtrajectories;
extern std::vector<std::vector<int>> atomtrajectoryrestarts;
extern float abc[3][3]; //basis vectors
extern bool has_abc;
extern bool displayunitcell;
extern float supercell[3];
extern float markerscaling;
extern float unitcellcolour[4];
extern float supercellcolour[4];
......@@ -79,8 +76,6 @@ extern float movementspeed; //how fast to move the user
//markers such as hole positions and electron positions
extern float ** markers;
extern float ** markercolours;
extern float cubetrans[3];
extern int voxelSize[3];
extern const char * loadConfigFileErrors[];
......
float abc[3][3]; //basis vectors
bool has_abc = false;
int* numAtoms; //[timesteps]
float **atoms; //[timesteps][numAtoms[i]*4] //xyzu, u=atom number
bool fixedAtoms;
float cubetrans[3];
float supercell[3];
int voxelSize[3];
\ No newline at end of file
#ifndef CONFIGFILEATOMS_H
#define CONFIGFILEATOMS_H
extern float abc[3][3]; //basis vectors
extern bool has_abc;
extern int* numAtoms; //[timesteps]
extern float **atoms; //[timesteps][numAtoms[i]*4] //xyzu, u=atom number
extern bool fixedAtoms; //all timesteps use the atoms for timestep 0. Used for excitons etc.
extern float cubetrans[3];
extern int voxelSize[3];
extern float supercell[3];
#endif //CONFIGFILEATOMS_H
......@@ -28,7 +28,7 @@
#include "eprintf.h"
#include "atoms.hpp"
#include "ConfigFile.h"
#include "ConfigFileAtoms.h"
#include "rapidjson/document.h"
#include "rapidjson/filereadstream.h"
#include "happyhttp/happyhttp.h"
......
......@@ -62,6 +62,7 @@ void TransformAtoms(std::vector<float>* clonedAtoms, const float abc[3][3]);
extern bool inv_abc_init;
extern float inv_abc[3][3];
extern const char * const atomNames[];
extern std::vector<const char*> extraAtomNames;
extern std::vector<float*> extraAtomData;
......
......@@ -3,6 +3,9 @@ Subdirectories:
OculusMobile: Demos for GearVR.
GoogleCardboardAndroid: Demos for Google Cardboard (android)
CAVE: Demos for LRZ CAVE-like environment (linux)
NOMADGearVRChooser: Android app to select the dataset for GearVR, which
calls the OculusMobile app as a subroutine.
NOMADVRLib: Shared code between HTC Vive, GearVR and Google Cardboard demos related to NOMAD.
libs: Other (external) supporting libs shared by HTC Vive, GearVR, Cardboard and CAVE demos
......@@ -11,6 +14,10 @@ Subdirectories:
htdocs: Web pages containing the VR software and documentation.
cgi-bin: cgi scripts to create suitable config files from a material number.
RemoteVisualization: NOMAD2xyz app
Transforms a json from encyclopedia or archive into an XYZ file
Useful for the remote visualization infrastructure
More platforms will be added in the future.
The code is distributed under the Apache 2.0 License (See LICENSE file).
......
all: NOMADVRLib/atoms.o eprintf.o happyhttp/happyhttp.o NOMADVRLib/ConfigFileAtoms.o main.o
g++ $^ -o nomad2xyz
.cpp.o:
g++ -I. -std=c++11 $< -c -o $*.o
clean:
rm -f *.o nomad2xyz
NOMAD2xyz app
Transforms a json from encyclopedia or archive into an XYZ file
Useful for the remote visualization infrastructure
Depends on the following libraries:
NOMADVRLib
happyhttp
rapidjson
\ No newline at end of file
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <stdarg.h>
#include <stdio.h>
#include "NOMADVRLib/eprintf.h"
void eprintf( const char *fmt, ... )
{
va_list args;
char buffer[ 2048 ];
va_start( args, fmt );
vsprintf( buffer, fmt, args );
va_end( args );
fprintf(stderr, "%s\n", buffer );
}
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "NOMADVRLib/eprintf.h"
#include "NOMADVRLib/ConfigFileAtoms.h"
#include "NOMADVRLib/atoms.hpp"
int timesteps;
void exportXYZ(const char * file, const char *mat)
{
FILE * f=fopen (file, "w");
for (int i=0;i<timesteps;i++) {
fprintf (f, "%d\n", numAtoms[i]);
fprintf (f, "Comment: Material=%s\n", mat);
for (int j=0;j<numAtoms[i];j++) {
fprintf (f, "%s\t%f\t%f\t%f\n", atomNames[(int)(atoms[i][j*4+3])],
atoms[i][j*4+0], atoms[i][j*4+1], atoms[i][j*4+2]);
}
}
}
void usage (const char * argv0)
{
eprintf ("Usage: \n%s e <basename for encyclopedia json> xyz", argv0);
eprintf ("%s a <archive json> xyz", argv0);
}
int main (int argc, char **argv) {
if (argc < 3) {
usage(argv[0]);
return 1;
}
std::vector<float> *clonedAtoms;
if (argv[1][0]=='e') {
readAtomsJson (argv[2], &numAtoms, &timesteps, &atoms, abc, &clonedAtoms);
//now export xyz
exportXYZ(argv[3], argv[2]);
} else if (argv[1][0]=='a') {
readAtomsAnalyticsJson (argv[2], &numAtoms, &timesteps, &atoms, abc, &clonedAtoms);
exportXYZ (argv[3], argv[2]);
} else {
usage(argv[0]);
return 2;
}
return 0;
}
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