26 const std::array<std::string, 4>
names {
"config",
"revcon",
"cfgmin",
"history"};
27 std::string
ext = path.extension().string();
28 std::string
stem = path.stem().string();
30 for (std::string *
s : {&
ext, &
stem})
37 [](
unsigned char c){ return std::tolower(c); }
41 for (
auto name :
names)
43 if (
ext.rfind(
"."+name, 0) == 0)
47 if (
stem.rfind(name, 0) == 0)
101 std::stringstream data(
line);
103 data >> levcfg >> imcon >>
natoms;
108 <<
" does not have an atom count.\n"
109 <<
"Please add the atom count after imcon.\n";
110 throw std::runtime_error
118 data = std::stringstream(
line);
120 if (extractHistoryStepMetaData())
126 if (HISTORY){ getCell(); }
135 if (!HISTORY) { metaDataLines = 2+(imcon != 0 ? 3 : 0); }
136 else { metaDataLines = 2; }
137 linesPerAtom = 2+(levcfg > 0 ? 1 : 0)+(levcfg > 1 ? 1 : 0);
157 std::stringstream
ss;
170 ss = std::stringstream(
line);
171 ss >> symbol >> index;
175 ss = std::stringstream(
line);
184 ss = std::stringstream(
line);
193 ss = std::stringstream(
line);
212 std::thread
io = std::thread
223 std::stringstream data;
225 data = std::stringstream(
line);
230 data = std::stringstream(
line);
235 data = std::stringstream(
line);
240 bool extractHistoryStepMetaData()
243 std::stringstream data;
245 if (
line.rfind(
"timestep", 0) == 0)
247 data = std::stringstream(
line.substr(9));
An atom structure.
Definition atom.h:20
Read CONFIG files.
Definition config.h:70
CONFIG(std::filesystem::path path, bool blocking=false)
Construct a new CONFIG object to read from path.
Definition config.h:79
Specification for the structure file interface.
Definition structure.h:26
uint64_t atomsRead
Definition structure.h:187
glm::vec3 cellA
Definition structure.h:189
glm::vec3 cellB
Definition structure.h:190
bool blockingReads
Definition structure.h:179
uint64_t frames
Definition structure.h:182
std::vector< Atom > atoms
The Atoms read in the current frame.
Definition structure.h:147
uint64_t timeStep
Definition structure.h:184
std::map< Element, glm::vec4 > colourMap
Colour map from Element to colour.
Definition structure.h:174
void scanPositions()
Definition structure.h:237
std::ifstream filestream
Definition structure.h:180
uint64_t linesPerFrame
Definition structure.h:183
std::filesystem::path path
Definition structure.h:178
uint64_t natoms
Definition structure.h:181
void skipLine(std::ifstream &in)
Definition structure.h:226
glm::vec3 cellC
Definition structure.h:191
void checkRead(std::stringstream &ss, std::string lastInput, std::string context)
Definition structure.h:287
std::map< uint64_t, uint64_t > framePositions
Definition structure.h:195
glm::vec< L, float, glm::qualifier::highp > vec
Definition commandLine.h:196
bool ostensiblyCONFIGLike(std::filesystem::path path)
Check if a path is CONFIG'y.
Definition config.h:24
Element stringSymbolToElement(const std::string &s)
Map a string symbol to an Element.
Definition element.h:681
const std::map< Element, float > ELEMENT_RADIUS
Map Element to a Van der Waals radius in Angstroms.
Definition element.h:461