atoms.hpp 2.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
//Data from https://gitlab.rzg.mpg.de/nomad-lab/encyclopedia-gui/blob/lauri_viz/viztools/structure/build/js/structureviewer.js
//rgb radius for easy transference to a texture
//jmol colours from https://gitlab.com/ase/ase/blob/master/ase/data/colors.py
//RGH FIXME, add the other colour scheme when requested.

#ifndef __ATOMS_H
#define __ATOMS_H

#include <stdio.h>
#include <vector>

extern float atomColours[][4];

14 15
const int atomsInPeriodicTable=118;

16 17 18 19
extern const char * TMPDIR;

int readAtomsXYZ(const char *const file, int **numatoms, int *timesteps, float ***pos);
int readAtomsCube(const char *const file, int **numatoms, int *timesteps, float ***pos);
20
int readAtomsJson (const char *const file, int **numatoms, int *timesteps, float ***pos, float abc[3][3],  std::vector<float>** clonedAtoms, const char *const token=0);
21 22
int readAtomsAnalyticsJson(const char *const f, int **numatoms, int *timesteps, float ***pos, float abc[3][3],
	std::vector<float>** clonedAtoms);
23
int readAtomsJsonURL (const char *const f, int **numatoms, int *timesteps, float ***pos, float abc[3][3],  std::vector<float>** clonedAtoms, const char *const token=0);
24
#if defined(WIN32) || defined(CAVE)
25
int readAtomsJsonURLwget (const char *const f, int **numatoms, int *timesteps, float ***pos, float abc[3][3],  std::vector<float>** clonedAtoms, const char *const token=0);
26
#endif
27 28 29 30
const float MISSINGRADIUS=0.2f;
const float MISSINGR=1.f;
const float MISSINGG=1.f;
const float MISSINGB=1.f;
31 32 33 34

extern const char * readAtomsXYZErrors[];
extern const char * readAtomsCubeErrors[];
extern const char * readAtomsJsonErrors[];
35
extern const char * readAtomsAnalyticsJsonErrors[];
36

37
float atomRadius (int i);
38
int findAtom(const char *const s);
39

40 41 42
//internal functions
void discardline (FILE *F);
void Clone (float tmppos[3], float k, std::vector<float>* clonedAtoms);
43
bool CloneSpatialAtoms (float tmppos[3], float k, std::vector<float>* clonedAtoms);
44 45
void TransformAtoms(std::vector<float>* clonedAtoms, const float abc[3][3]);

46 47 48
extern bool inv_abc_init;
extern float inv_abc[3][3];

49 50 51
extern std::vector<const char*> extraAtomNames;
extern std::vector<float*> extraAtomData;

52
#endif //__ATOMS_H