Add platform check in atoms.cpp

Add archive-NomadVR link and readme in web backend.
parent 003a9fd9
Pipeline #38782 failed with stages
in 48 seconds
......@@ -279,6 +279,7 @@ int readAtomsXYZ(const char *const file, int **numatoms, int *timesteps, float *
{
const char *myfile=nullptr;
const char *webdownload="material.xyz";
#if !defined(OCULUSMOBILE) && !defined(__ANDROID__)
//add http support
if (!strncmp(file, "http:", 5) || !strncmp(file, "https:", 6)) {
char cmd[2048];
......@@ -294,6 +295,9 @@ int readAtomsXYZ(const char *const file, int **numatoms, int *timesteps, float *
} else {
myfile = file;
}
#else
myfile=file;
#endif
int mynumatoms;
std::vector<float*> mypos;
std::vector<int> mynum;
......
This directory contains the support files for the CGI backend to obtain
NOMAD VR files from the Encyclopedia and Archive.
Directories:
htdocs: Example files related to NOMAD VR
cgi-bin: CGI-backend
Files:
Readme.md: This document
pass: Information on the NOMAD user under which the data is accessed.
cgi-bin/NOMAD/material:
Entry point for NOMAD Encyclopedia.
See also the VR tutorial at
https://www.nomad-coe.eu/the-project/graphics/vrtutorial6
In the Encyclopedia webpage for a given material:
https://encyclopedia.nomad-coe.eu/gui/#/material/<mat id>
the link "Virtual Reality files" -> "Get VR file" points to
http://nomad.srv.lrz.de/cgi-bin/NOMAD/material?<mat_id>
This entry point creates a zip file with a the crystal structure of mat_id.
cgi-bin/NOMAD/materialAnalytics:
Entry point for NOMAD Archive / Analytics.
See also the VR tutorial at
https://www.nomad-coe.eu/the-project/graphics/vrtutorial5
In the analytics toolkit tutorial webpage, the tutorial
"Querying and visualizing the content of the NOMAD Archive" at
https://analytics-toolkit.nomad-coe.eu/notebook-edit/data/shared/tutorialsNew/nomad-query/nomad-query.bkr
The results of the queries have the form:
nmd://<string>
with the link "Virtual Reality" pointing to
http://nomad.srv.lrz.de/cgi-bin/NOMAD/materialAnalytics?<string>
This entry point creates a zip file with the structure or molecular dynamics
for <string>.
\ No newline at end of file
#!/bin/bash
export DATASOURCE=https://analytics-toolkit.nomad-coe.eu/api/resolve
if [[ "$QUERY_STRING" = "" ]]
then
#echo Location: /NOMAD/
echo Location:https://www.nomad-coe.eu/the-project/graphics/VR-prototype
echo ''
else
#rgh: text/plain works in pc but android chrome saves it as .txt, removing the extension
# export TOKEN=`cat t.b64`
export RAND=$RANDOM
#rgh: before end of september 2017, use /var/tmp, after, use /tmp (apache update)
cd /tmp
/usr/bin/mkdir $RAND
cd $RAND
export MAT=`echo $QUERY_STRING|cut -f 2 -d/`
mkdir $MAT
cd $MAT
#Some systems have atomic positions in section_system:0
#Others don't; they start at section_system:1
#Better to download all and test this in NOMADVR.
# wget --no-check-certificate https://analytics-toolkit.nomad-coe.eu/api/resolve/$QUERY_STRING/section_run/0c/section_system/0c?format=recursiveJson -O material.json
if [[ $QUERY_STRING = *"section_run"* ]]
then
QS=$QUERY_STRING
else
QS=$QUERY_STRING/section_run/0c
fi
wget --no-check-certificate $DATASOURCE/$QS?format=recursiveJson -O \
materialtmp.json
if [[ $QUERY_STRING = *"section_run"* ]]
then
echo "{ "section_system" : [" >>material.json
cat materialtmp.json >> material.json
echo "] }" >> material.json
rm materialtmp.json
else
mv materialtmp.json material.json
fi
export FORMULA=`grep system_composition material.json|head -n 1 |cut -f 4 -d\"`
if [[ "$FORMULA" = "" ]]
then
echo "Content-type: text/html"
echo ''
echo "<html><body>"
echo "No system_composition found in json: no information to display in VR"
echo "</body></html>"
else
echo \# Material $QUERY_STRING >> $FORMULA.ncfg
echo background 0 0 0 >> $FORMULA.ncfg
echo atomscaling 0.5 >> $FORMULA.ncfg
echo analyticsjson material.json >> $FORMULA.ncfg
echo displaybonds >> $FORMULA.ncfg
echo displayunitcell >> $FORMULA.ncfg
echo showcontrollers >> $FORMULA.ncfg
cd ..
zip -r $MAT $MAT >/dev/null 2>&1
echo "Content-type: application/octet-stream"
echo "Content-disposition: attachment; filename=${QUERY_STRING}.zip"
echo ''
cat $MAT.zip
fi
cd ..
# \rm -r $RAND
fi
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