2#ifndef STORMM_COORDINATE_FRAME_H
3#define STORMM_COORDINATE_FRAME_H
9#include "Accelerator/hybrid.h"
10#include "Accelerator/hybrid_util.h"
11#include "Constants/behavior.h"
12#include "Parsing/textfile.h"
13#include "Topology/atomgraph.h"
14#include "phasespace.h"
15#include "trajectory_enumerators.h"
20using card::default_hpc_format;
22using card::HybridFormat;
23using card::HybridKind;
24using card::HybridTargetLevel;
25using constants::ExceptionResponse;
27using topology::AtomGraph;
39 double* zcrd_in,
double* umat_in,
double* invu_in,
double* boxdim_in);
42 HybridTargetLevel tier = HybridTargetLevel::HOST);
44 HybridTargetLevel tier = HybridTargetLevel::HOST);
75 const double* ycrd_in,
const double* zcrd_in,
const double* umat_in,
76 const double* invu_in,
const double* boxdim_in);
81 HybridTargetLevel tier = HybridTargetLevel::HOST);
83 HybridTargetLevel tier = HybridTargetLevel::HOST);
85 HybridTargetLevel tier = HybridTargetLevel::HOST);
87 HybridTargetLevel tier = HybridTargetLevel::HOST);
136 CoordinateFrame(
int natom_in = 0, UnitCellType unit_cell_in = UnitCellType::NONE,
137 HybridFormat format_in = default_hpc_format);
139 CoordinateFrame(
int natom_in, UnitCellType unit_cell_in,
const double* xcrd_in,
140 const double* ycrd_in,
const double* zcrd_in,
const double* umat_in =
nullptr,
141 const double* invu_in =
nullptr,
const double* boxdim_in =
nullptr,
142 HybridFormat format_in = default_hpc_format);
145 CoordinateFileKind file_kind = CoordinateFileKind::UNKNOWN,
146 int frame_number_in = 0, HybridFormat format_in = default_hpc_format);
148 CoordinateFrame(
const TextFile &tf, CoordinateFileKind file_kind = CoordinateFileKind::UNKNOWN,
149 int frame_number_in = 0, HybridFormat format_in = default_hpc_format);
205 void buildFromFile(
const std::string &file_name_in,
const CoordinateFileKind file_kind,
206 int frame_number = 0);
208 void buildFromFile(
const TextFile &tf,
const CoordinateFileKind file_kind,
209 int frame_number = 0);
229 template <
typename T>
230 void fill(
const T* xcrd,
const T* ycrd,
const T* zcrd,
int scale_bits = 0,
231 const double* box_dims =
nullptr);
233 template <
typename T>
234 void fill(
const std::vector<T> &xcrd,
const std::vector<T> &ycrd,
const std::vector<T> &zcrd,
235 int scale_bits = 0,
const std::vector<double> &box_dims = {});
270 HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
277 std::vector<double>
getBoxSpaceTransform(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
283 std::vector<double>
getInverseTransform(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
292 std::vector<double>
getBoxDimensions(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
351 CoordinateFileKind output_kind = CoordinateFileKind::AMBER_CRD,
352 PrintSituation expectation = PrintSituation::UNKNOWN,
353 HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
394 std::string file_name;
398 UnitCellType unit_cell;
424static const size_t coordinateframe_type_index =
425 std::type_index(
typeid(CoordinateFrame)).hash_code();
440std::vector<CoordinateFrame> getSelectedFrames(
const TextFile &tf, CoordinateFileKind kind,
441 int atom_count, UnitCellType unit_cell,
442 const std::vector<int> &frame_numbers);
444std::vector<CoordinateFrame> getSelectedFrames(
const std::string &file_name,
int atom_count,
445 UnitCellType unit_cell,
446 const std::vector<int> &frame_numbers);
461std::vector<CoordinateFrame> getAllFrames(
const TextFile &tf,
const int atom_count,
462 const UnitCellType unit_cell,
463 const ExceptionResponse policy);
465std::vector<CoordinateFrame> getAllFrames(
const std::string &file_name,
const int atom_count,
466 const UnitCellType unit_cell,
467 const ExceptionResponse policy);
473#include "coordinateframe.tpp"
478using trajectory::coordinateframe_type_index;
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
CoordinateFrame(int natom_in=0, UnitCellType unit_cell_in=UnitCellType::NONE, HybridFormat format_in=default_hpc_format)
There are several options for construction of this abridged, coordinate-only object.
Definition coordinateframe.cpp:180
Store the coordinates and box information for a frame, only. This abridged struct can serve when the ...
Definition coordinateframe.h:111
const Hybrid< double > * getStorageHandle() const
Get a pointer to the storage array accessible outside the object.
Definition coordinateframe.cpp:844
HybridFormat getFormat() const
Get the format of the object.
Definition coordinateframe.cpp:684
CoordinateFrame(int natom_in=0, UnitCellType unit_cell_in=UnitCellType::NONE, HybridFormat format_in=default_hpc_format)
There are several options for construction of this abridged, coordinate-only object.
Definition coordinateframe.cpp:180
int getFrameNumber() const
Get the frame number, if this coordinate set originated in a trajectory.
Definition coordinateframe.cpp:694
void exportToFile(const std::string &file_name, CoordinateFileKind output_kind=CoordinateFileKind::AMBER_CRD, PrintSituation expectation=PrintSituation::UNKNOWN, HybridTargetLevel tier=HybridTargetLevel::HOST) const
Export the contents of this coordinate series to a trajectory, restart, or input coordinates file.
Definition coordinateframe.cpp:859
std::vector< double > getInterlacedCoordinates(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the coordinates returned in an X/Y/Z interlaced manner.
Definition coordinateframe.cpp:710
int getAtomCount() const
Get the number of atoms in the frame.
Definition coordinateframe.cpp:699
const CoordinateFrameReader data(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the abstract for this object, containing C-style pointers for the most rapid access to any of its...
Definition coordinateframe.cpp:935
const Hybrid< double > * getBoxDimensionsHandle() const
Get a pointer to the transform that takes coordinates back into real space. Overloading follows from ...
Definition coordinateframe.cpp:834
void setFrameNumber(int frame_number_in)
Set the frame number, for bookkeeping purposes. This function exists that the frame number does not b...
Definition coordinateframe.cpp:993
std::vector< double > getBoxDimensions(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the box dimensions in their pure form. Holding the box dimensions and the transformation matrices...
Definition coordinateframe.cpp:774
std::vector< double > getInverseTransform(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the transformation matrix to take coordinates from fractional space back into real space....
Definition coordinateframe.cpp:760
CoordinateFrame & operator=(const CoordinateFrame &other)
Copy assignment operator likewise handles reassignment of internal POINTER-kind Hybrid objects.
Definition coordinateframe.cpp:468
const Hybrid< double > * getInverseTransformHandle() const
Get a pointer to the inverse transform that takes coordinates back into real space....
Definition coordinateframe.cpp:824
UnitCellType getUnitCellType() const
Get the unit cell type of the coordinate system.
Definition coordinateframe.cpp:704
void fill(const T *xcrd, const T *ycrd, const T *zcrd, int scale_bits=0, const double *box_dims=nullptr)
Fill the object from information in three arrays.
const CoordinateFrame * getSelfPointer() const
Get a pointer to the object itself, useful when working with a const reference.
Definition coordinateframe.cpp:854
std::vector< double > getBoxSpaceTransform(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the transformation matrix to take coordinates into box (fractional) space. The result should be i...
Definition coordinateframe.cpp:746
const Hybrid< double > * getCoordinateHandle(CartesianDimension dim) const
Get a pointer to one of the coordinate arrays.
Definition coordinateframe.cpp:788
std::string getFileName() const
Get the file name that originated this coordinate set.
Definition coordinateframe.cpp:689
void buildFromFile(const std::string &file_name_in, const CoordinateFileKind file_kind, int frame_number=0)
Fill the object from information some coordinate, restart, or trajectory file.
Definition coordinateframe.cpp:535
const Hybrid< double > * getBoxTransformHandle() const
Get a pointer to the box space transform. Overloading follows from getCoordinateHandle(),...
Definition coordinateframe.cpp:814
An object to complement a topology and hold positions, velocities, and forces of all particles in a s...
Definition phasespace.h:141
CoordinateFrameReader(int natom_in, UnitCellType unit_cell_in, const double *xcrd_in, const double *ycrd_in, const double *zcrd_in, const double *umat_in, const double *invu_in, const double *boxdim_in)
The constructor feeds all arguments straight to the inline initialization list.
Definition coordinateframe.cpp:94
CoordinateFrameWriter(int natom_in, UnitCellType unit_cell_in, double *xcrd_in, double *ycrd_in, double *zcrd_in, double *umat_in, double *invu_in, double *boxdim_in)
The constructor feeds all arguments straight to the inline initialization list.
Definition coordinateframe.cpp:33
Collect C-style pointers for the elements of a read-only CoordinateFrame object.
Definition coordinateframe.h:65
CoordinateFrameReader(const CoordinateFrameReader &original)=default
Copy and move constructors. The move assignment operator is implicitly deleted.
const double * umat
Definition coordinateframe.h:101
const double * ycrd
Cartesian Y coordinates of all atoms.
Definition coordinateframe.h:99
CoordinateFrameReader(int natom_in, UnitCellType unit_cell_in, const double *xcrd_in, const double *ycrd_in, const double *zcrd_in, const double *umat_in, const double *invu_in, const double *boxdim_in)
The constructor feeds all arguments straight to the inline initialization list.
Definition coordinateframe.cpp:94
const double * xcrd
Cartesian X coordinates of all atoms.
Definition coordinateframe.h:98
const double * invu
Inverse transformation matrix out of box space.
Definition coordinateframe.h:103
const double * zcrd
Cartesian Z coordinates of all atoms.
Definition coordinateframe.h:100
const int natom
The number of atoms in the system.
Definition coordinateframe.h:96
const UnitCellType unit_cell
The type of unit cell (i.e. ORTHORHOMBIC, could also be NONE)
Definition coordinateframe.h:97
const double * boxdim
Box dimensions (these will be consistent with umat and invu)
Definition coordinateframe.h:104
Collect C-style pointers for the elements of a writable CoordinateFrame object.
Definition coordinateframe.h:30
double * invu
Inverse transformation matrix out of box space.
Definition coordinateframe.h:60
CoordinateFrameWriter(int natom_in, UnitCellType unit_cell_in, double *xcrd_in, double *ycrd_in, double *zcrd_in, double *umat_in, double *invu_in, double *boxdim_in)
The constructor feeds all arguments straight to the inline initialization list.
Definition coordinateframe.cpp:33
CoordinateFrameWriter(const CoordinateFrameWriter &original)=default
Copy and move constructors. The move assignment operator is implicitly deleted.
const int natom
The number of atoms in the system.
Definition coordinateframe.h:53
double * zcrd
Cartesian Z coordinates of all atoms.
Definition coordinateframe.h:57
const UnitCellType unit_cell
The type of unit cell (i.e. ORTHORHOMBIC, could also be NONE)
Definition coordinateframe.h:54
double * umat
Definition coordinateframe.h:58
double * boxdim
Box dimensions (these will be consistent with umat and invu)
Definition coordinateframe.h:61
double * xcrd
Cartesian X coordinates of all atoms.
Definition coordinateframe.h:55
double * ycrd
Cartesian Y coordinates of all atoms.
Definition coordinateframe.h:56