seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
seams_input.hpp
Go to the documentation of this file.
1//-----------------------------------------------------------------------------------
2// d-SEAMS - Deferred Structural Elucidation Analysis for Molecular Simulations
3//
4// Copyright (c) d-SEAMS developers
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the MIT License as published by
8// the Open Source Initiative.
9//
10// A copy of the MIT License is included in the LICENSE file of this repository.
11// You should have received a copy of the MIT License along with this program.
12// If not, see <https://opensource.org/licenses/MIT>.
13//-----------------------------------------------------------------------------------
14
15#ifndef SEAMS_SEAMS_INPUT_H_
16#define SEAMS_SEAMS_INPUT_H_
17
18#include <cstdint>
19#include <functional>
20#include <iostream>
21#include <memory>
22#include <mol_sys.hpp>
23#include <ring.hpp>
24#include <string>
25
26#include <sys/stat.h>
27#include <sys/types.h>
28
29#include <filesystem>
30
34
39
52
53namespace sinp {
54
56std::vector<std::string> getInpFileList(std::string inputFolder);
57
63int nLammpsFrames(const std::string &filename);
64
66void dropLammpsDumpIndex(const std::string &filename);
67
71
84 const std::string &filename, int first, int last, int typeFilter,
85 const std::function<void(
86 int, molSys::PointCloud<molSys::Point<double>, double> &)> &fn,
87 int nThreads = 0, int part = 0, int parts = 1);
88
94bool readDefaultOxygen(const std::string &filename, int frame,
96
98readLammpsTrj(std::string filename, int targetFrame,
100 bool isSlice = false,
101 std::array<double, 3> coordLow = std::array<double, 3>{0, 0, 0},
102 std::array<double, 3> coordHigh = std::array<double, 3>{0, 0, 0});
103
109 std::string filename, int targetFrame,
110 molSys::PointCloud<molSys::Point<double>, double> &yCloud, int typeO,
111 bool isSlice = false,
112 std::array<double, 3> coordLow = std::array<double, 3>{0, 0, 0},
113 std::array<double, 3> coordHigh = std::array<double, 3>{0, 0, 0});
114
119 std::string filename, int targetFrame,
120 molSys::PointCloud<molSys::Point<double>, double> &yCloud, int typeI,
121 bool isSlice = false,
122 std::array<double, 3> coordLow = std::array<double, 3>{0, 0, 0},
123 std::array<double, 3> coordHigh = std::array<double, 3>{0, 0, 0});
124
127
129std::vector<std::vector<int>> readBonds(std::string filename);
130
134int chemfilesSteps(const std::string &filename);
135
136#ifdef SEAMS_HAS_CHEMFILES
142struct ChemfilesRead {
143 int frame = 1;
144 int typeFilter = -1;
145 bool guessOxygen = false;
146 std::string selection;
147};
148
150readChemfiles(std::string filename,
152 const ChemfilesRead &request);
153
156readChemfiles(std::string filename, int targetFrame,
158 int typeFilter = -1);
159
164void forEachChemfilesStep(
165 const std::string &filename, int first, int last, int typeFilter,
166 const std::function<void(
167 int, molSys::PointCloud<molSys::Point<double>, double> &)> &fn);
168
172bool forEachChemfilesFrame(
173 const std::string &filename, int first, int last, int typeI,
174 const std::string &selection, int part, int parts,
175 const std::function<void(
176 int, molSys::PointCloud<molSys::Point<double>, double> &)> &fn);
177#endif
178
184openFrame(const std::string &filename, int frame, int typeI,
185 const std::string &selection = {});
186
187#ifdef SEAMS_HAS_READCON
192readCon(std::string filename, int targetFrame,
194
198void forEachConFrame(
199 const std::string &filename, int first, int last,
200 const std::function<void(
201 int, molSys::PointCloud<molSys::Point<double>, double> &)> &fn);
202
203#ifdef SEAMS_HAS_READCON_DB
208int ingestConCorpus(const std::string &corpus, std::uint64_t trajId,
209 const std::string &conPath);
210
216readConCorpus(const std::string &corpus, const std::string &symbol,
217 const std::string &formula, int targetFrame,
219#endif
220#endif
221
224inline bool atomInSlice(double x, double y, double z,
225 std::array<double, 3> coordLow,
226 std::array<double, 3> coordHigh) {
227 int flag = 0;
228
229 if (((x >= coordLow[0]) && (x <= coordHigh[0])) ||
230 coordLow[0] == coordHigh[0]) {
231 flag++;
232 }
233 if (((y >= coordLow[1]) && (y <= coordHigh[1])) ||
234 coordLow[1] == coordHigh[1]) {
235 flag++;
236 }
237 if (((z >= coordLow[2]) && (z <= coordHigh[2])) ||
238 coordLow[2] == coordHigh[2]) {
239 flag++;
240 }
241
242 if (flag == 3) {
243 return true;
244 } else {
245 return false;
246 }
247}
248
249} // namespace sinp
250
252#endif
The main molecular system handler.
Functions for the d-SEAMS readers.
std::string currentExceptionText()
molSys::PointCloud< molSys::Point< double >, double > readLammpsTrj(std::string filename, int targetFrame, molSys::PointCloud< molSys::Point< double >, double > &yCloud, bool isSlice=false, std::array< double, 3 > coordLow=std::array< double, 3 >{0, 0, 0}, std::array< double, 3 > coordHigh=std::array< double, 3 >{0, 0, 0})
int nLammpsFrames(const std::string &filename)
bool readDefaultOxygen(const std::string &filename, int frame, molSys::PointCloud< molSys::Point< double >, double > &yCloud)
molSys::PointCloud< molSys::Point< double >, double > openFrame(const std::string &filename, int frame, int typeI, const std::string &selection={})
void forEachLammpsFrame(const std::string &filename, int first, int last, int typeFilter, const std::function< void(int, molSys::PointCloud< molSys::Point< double >, double > &)> &fn, int nThreads=0, int part=0, int parts=1)
molSys::PointCloud< molSys::Point< double >, double > readXYZ(std::string filename)
Function for reading in atom coordinates from an XYZ file.
int chemfilesSteps(const std::string &filename)
molSys::PointCloud< molSys::Point< double >, double > readLammpsTrjreduced(std::string filename, int targetFrame, molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, bool isSlice=false, std::array< double, 3 > coordLow=std::array< double, 3 >{0, 0, 0}, std::array< double, 3 > coordHigh=std::array< double, 3 >{0, 0, 0})
std::vector< std::string > getInpFileList(std::string inputFolder)
Get file list inside the input folder.
molSys::PointCloud< molSys::Point< double >, double > readLammpsTrjO(std::string filename, int targetFrame, molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeO, bool isSlice=false, std::array< double, 3 > coordLow=std::array< double, 3 >{0, 0, 0}, std::array< double, 3 > coordHigh=std::array< double, 3 >{0, 0, 0})
bool atomInSlice(double x, double y, double z, std::array< double, 3 > coordLow, std::array< double, 3 > coordHigh)
std::vector< std::vector< int > > readBonds(std::string filename)
Reads bonds into a vector of vectors from a file with a specific format.
void dropLammpsDumpIndex(const std::string &filename)
Drop a cached dump session (tests that rewrite a path in place).
File containing common functions used by bulk and confined topological network critera.
This contains a collection of points; contains information for a particular frame.
Definition mol_sys.hpp:173
This contains per-particle information.
Definition mol_sys.hpp:152