seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
sinp Namespace Reference

Functions for the d-SEAMS readers. More...

Functions

std::vector< std::string > getInpFileList (std::string inputFolder)
 Get file list inside the input folder.
int nLammpsFrames (const std::string &filename)
void dropLammpsDumpIndex (const std::string &filename)
 Drop a cached dump session (tests that rewrite a path in place).
std::string currentExceptionText ()
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)
bool readDefaultOxygen (const std::string &filename, int frame, molSys::PointCloud< molSys::Point< double >, double > &yCloud)
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})
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})
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})
molSys::PointCloud< molSys::Point< double >, double > readXYZ (std::string filename)
 Function for reading in atom coordinates from an XYZ file.
std::vector< std::vector< int > > readBonds (std::string filename)
 Reads bonds into a vector of vectors from a file with a specific format.
int chemfilesSteps (const std::string &filename)
molSys::PointCloud< molSys::Point< double >, double > openFrame (const std::string &filename, int frame, int typeI, const std::string &selection={})
bool atomInSlice (double x, double y, double z, std::array< double, 3 > coordLow, std::array< double, 3 > coordHigh)

Detailed Description

Functions for the d-SEAMS readers.

This namespace contains functions that are used for reading in the formats supported by d-SEAMS. LAMMPS trajectory files and XYZ files are currently supported, though it is recommended to use LAMMPS trajectory files, since the simulation box size etc. are not normally present in XYZ files, and many analyses may fail without the correct box dimensions.

Changelog

Function Documentation

◆ atomInSlice()

bool sinp::atomInSlice ( double x,
double y,
double z,
std::array< double, 3 > coordLow,
std::array< double, 3 > coordHigh )
inline

True when each component lies in [lo, hi], or that axis has lo == hi (unconstrained). ([0,0,0], [50,0,0]) is x in [0, 50], y and z open.

If this is 3 then the particle is inside the volume slice

Definition at line 224 of file seams_input.hpp.

226 {
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}

◆ chemfilesSteps()

int sinp::chemfilesSteps ( const std::string & filename)

Number of steps chemfiles can read, or -1 when chemfiles is off or the file is not a trajectory it knows. seams_lang calls this with or without chemfiles.

◆ currentExceptionText()

std::string sinp::currentExceptionText ( )

Text of the exception currently being handled. Call from a catch clause. A std::exception yields what(); anything else is unnamed.

◆ dropLammpsDumpIndex()

void sinp::dropLammpsDumpIndex ( const std::string & filename)

Drop a cached dump session (tests that rewrite a path in place).

◆ forEachLammpsFrame()

void sinp::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 )

Call fn(frame, cloud) for each frame from max(first, 1) to last (1-based, inclusive) that falls to part of parts. last <= 0 means every ITEM: TIMESTEP. Frames are dealt in rounds of parts, in serpentine order (part p takes slot p of even rounds and slot parts - 1 - p of odd ones), so a cost that drifts or alternates along the run reaches every part. typeFilter <= 0 keeps every atom. nThreads <= 0 uses the OpenMP default; 1 is serial. Each worker opens its own handle and seeks the shared offset table. Incremental RingUpdater / AffiliationUpdater state cannot be shared across workers: with nThreads 1 the frames arrive in order on one thread and may carry it, otherwise use the batch classifiers.

◆ getInpFileList()

std::vector< std::string > sinp::getInpFileList ( std::string inputFolder)

Get file list inside the input folder.

◆ nLammpsFrames()

int sinp::nLammpsFrames ( const std::string & filename)

Number of ITEM: TIMESTEP frames in a LAMMPS dump, or 0 if the file cannot be read. The first full count per path walks the file once and later reads seek, matching chemfiles Trajectory::nsteps and readcon's frame-offset table. Sequential load_frame walks reuse a live read position the way LAMMPS ReaderNative does on rerun.

◆ openFrame()

molSys::PointCloud< molSys::Point< double >, double > sinp::openFrame ( const std::string & filename,
int frame,
int typeI,
const std::string & selection = {} )

Postprocessing entry. CON stays on readcon. Every other file goes through chemfiles when that library is linked. typeI follows the CLI: negative keeps every atom, positive keeps one species, zero guesses oxygen.

◆ readBonds()

std::vector< std::vector< int > > sinp::readBonds ( std::string filename)

Reads bonds into a vector of vectors from a file with a specific format.

◆ readDefaultOxygen()

bool sinp::readDefaultOxygen ( const std::string & filename,
int frame,
molSys::PointCloud< molSys::Point< double >, double > & yCloud )

Function for reading in a specified frame (frame number and not timestep value) One id/type/x/y/z frame of the default oxygen selection: type 2 when any atom has that type, otherwise type 1. Returns false for any other column layout, leaving the cloud untouched by a successful read.

◆ readLammpsTrj()

molSys::PointCloud< molSys::Point< double >, double > sinp::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} )

◆ readLammpsTrjO()

molSys::PointCloud< molSys::Point< double >, double > sinp::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} )

One LAMMPS dump frame, one atom type. The type argument is any LAMMPS type (the O in the name is historical). If isSlice is true, each kept point gets inSlice set; atoms outside the box stay in the cloud. nop is the type-filtered count.

◆ readLammpsTrjreduced()

molSys::PointCloud< molSys::Point< double >, double > sinp::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} )

One LAMMPS dump frame, one atom type, dropping atoms outside the slice when isSlice is true. nop is the kept count. An axis with lo == hi is unconstrained.

◆ readXYZ()

molSys::PointCloud< molSys::Point< double >, double > sinp::readXYZ ( std::string filename)

Function for reading in atom coordinates from an XYZ file.