votca 2024.2-dev
Loading...
Searching...
No Matches
votca::csg::LAMMPSDataReader Class Reference

class for reading lammps data files More...

#include <lammpsdatareader.h>

Inheritance diagram for votca::csg::LAMMPSDataReader:
Collaboration diagram for votca::csg::LAMMPSDataReader:

Public Member Functions

 LAMMPSDataReader ()=default
 
 ~LAMMPSDataReader () override=default
 
bool ReadTopology (std::string file, Topology &top) override
 open, read and close topology file
 
bool Open (const std::string &file) override
 open a trajectory file
 
bool FirstFrame (Topology &top) override
 read in the first frame of trajectory file
 
bool NextFrame (Topology &top) override
 read in the next frame of trajectory file
 
void Close () override
 close the topology file
 
- Public Member Functions inherited from votca::csg::TrajectoryReader
virtual ~TrajectoryReader ()=default
 
- Public Member Functions inherited from votca::csg::TopologyReader
virtual ~TopologyReader ()=default
 

Public Attributes

const tools::DistanceUnit distance_unit = tools::DistanceUnit::angstroms
 
const tools::TimeUnit time_unit = tools::TimeUnit::femtoseconds
 
const tools::MassUnit mass_unit = tools::MassUnit::grams_per_mole
 
const tools::MolarEnergyUnit energy_unit
 
const tools::ChargeUnit charge_unit = tools::ChargeUnit::e
 
const tools::MolarForceUnit force_unit
 

Private Types

enum  lammps_format { style_angle_bond_molecule = 0 , style_atomic = 1 , style_full = 2 }
 

Private Member Functions

bool MatchOneFieldLabel_ (std::vector< std::string > fields, Topology &top)
 
bool MatchTwoFieldLabels_ (std::vector< std::string > fields, Topology &top)
 
bool MatchThreeFieldLabels_ (std::vector< std::string > fields)
 
bool MatchFourFieldLabels_ (std::vector< std::string > fields, Topology &top)
 
void ReadBox_ (std::vector< std::string > fields, Topology &top)
 
void SortIntoDataGroup_ (std::string tag)
 
void ReadNumTypes_ (std::vector< std::string > fields, std::string type)
 
void ReadNumOfAtoms_ (std::vector< std::string > fields, Topology &top)
 
void ReadNumOfBonds_ (std::vector< std::string > fields)
 
void ReadNumOfAngles_ (std::vector< std::string > fields)
 
void ReadNumOfDihedrals_ (std::vector< std::string > fields)
 
void ReadNumOfImpropers_ (std::vector< std::string > fields)
 
void ReadAtoms_ (Topology &top)
 
void ReadBonds_ (Topology &top)
 
void ReadAngles_ (Topology &top)
 
void ReadDihedrals_ (Topology &top)
 
void SkipImpropers_ ()
 
void RenameMolecules (MoleculeContainer &molecules) const
 
lammps_format determineDataFileFormat_ (std::string line)
 
void InitializeAtomAndBeadTypes_ ()
 Determines atom and bead types based on masses in lammps files.
 

Private Attributes

std::ifstream fl_
 
std::string fname_
 
bool topology_
 
std::map< std::string, std::vector< std::vector< std::string > > > data_
 
std::map< Index, std::string > atomtypes_
 
std::map< std::string, IndexnumberOfDifferentTypes_
 
std::map< std::string, IndexnumberOf_
 
std::map< Index, Molecule * > molecules_
 
std::map< Index, IndexatomIdToMoleculeId_
 
std::map< Index, IndexatomIdToIndex_
 

Additional Inherited Members

- Static Public Member Functions inherited from votca::csg::TrajectoryReader
static void RegisterPlugins (void)
 
- Static Public Member Functions inherited from votca::csg::TopologyReader
static void RegisterPlugins (void)
 

Detailed Description

class for reading lammps data files

This class provides the TrajectoryReader + Topology reader interface for lammps data files

Definition at line 45 of file lammpsdatareader.h.

Member Enumeration Documentation

◆ lammps_format

Enumerator
style_angle_bond_molecule 
style_atomic 
style_full 

Definition at line 125 of file lammpsdatareader.h.

Constructor & Destructor Documentation

◆ LAMMPSDataReader()

votca::csg::LAMMPSDataReader::LAMMPSDataReader ( )
default

◆ ~LAMMPSDataReader()

votca::csg::LAMMPSDataReader::~LAMMPSDataReader ( )
overridedefault

Member Function Documentation

◆ Close()

void votca::csg::LAMMPSDataReader::Close ( )
overridevirtual

close the topology file

Reimplemented from votca::csg::TrajectoryReader.

Definition at line 113 of file lammpsdatareader.cc.

◆ determineDataFileFormat_()

LAMMPSDataReader::lammps_format votca::csg::LAMMPSDataReader::determineDataFileFormat_ ( std::string line)
private

Definition at line 377 of file lammpsdatareader.cc.

◆ FirstFrame()

bool votca::csg::LAMMPSDataReader::FirstFrame ( Topology & top)
overridevirtual

read in the first frame of trajectory file

Implements votca::csg::TrajectoryReader.

Definition at line 115 of file lammpsdatareader.cc.

◆ InitializeAtomAndBeadTypes_()

void votca::csg::LAMMPSDataReader::InitializeAtomAndBeadTypes_ ( )
private

Determines atom and bead types based on masses in lammps files.

The purpose of this function is to take lammps output where there are more than a single atom type of the same element. For instance there may be 4 atom types with mass of 12.01. Well this means that they are all carbon but are treated differently in lammps. It makes sense to keep track of this. If a mass cannot be associated with an element we will assume it is pseudo atom or course grained watom which we will represent as a bead. So when creating the atom names we will take this into account. So say we have the following masses in the lammps .data file:

Masses

1 1.0 2 12.01 3 12.01 4 16.0 5 12.01 6 15.2 7 12.8 8 15.2

Then we would translate this to the following atom names 1 H 2 C1 3 C2 4 O 5 C3 6 Bead1 BeadType 1 7 Bead2 BeadType 8 Bead1 BeadType 2

Note that we do not append a number if it is singular, in such cases the element and the atom name is the same.

Definition at line 291 of file lammpsdatareader.cc.

◆ MatchFourFieldLabels_()

bool votca::csg::LAMMPSDataReader::MatchFourFieldLabels_ ( std::vector< std::string > fields,
Topology & top )
private

Definition at line 280 of file lammpsdatareader.cc.

◆ MatchOneFieldLabel_()

bool votca::csg::LAMMPSDataReader::MatchOneFieldLabel_ ( std::vector< std::string > fields,
Topology & top )
private

Definition at line 207 of file lammpsdatareader.cc.

◆ MatchThreeFieldLabels_()

bool votca::csg::LAMMPSDataReader::MatchThreeFieldLabels_ ( std::vector< std::string > fields)
private

Definition at line 262 of file lammpsdatareader.cc.

◆ MatchTwoFieldLabels_()

bool votca::csg::LAMMPSDataReader::MatchTwoFieldLabels_ ( std::vector< std::string > fields,
Topology & top )
private

Definition at line 233 of file lammpsdatareader.cc.

◆ NextFrame()

bool votca::csg::LAMMPSDataReader::NextFrame ( Topology & top)
overridevirtual

read in the next frame of trajectory file

Implements votca::csg::TrajectoryReader.

Definition at line 121 of file lammpsdatareader.cc.

◆ Open()

bool votca::csg::LAMMPSDataReader::Open ( const std::string & file)
overridevirtual

open a trajectory file

Implements votca::csg::TrajectoryReader.

Definition at line 104 of file lammpsdatareader.cc.

◆ ReadAngles_()

void votca::csg::LAMMPSDataReader::ReadAngles_ ( Topology & top)
private

Definition at line 613 of file lammpsdatareader.cc.

◆ ReadAtoms_()

void votca::csg::LAMMPSDataReader::ReadAtoms_ ( Topology & top)
private

Definition at line 396 of file lammpsdatareader.cc.

◆ ReadBonds_()

void votca::csg::LAMMPSDataReader::ReadBonds_ ( Topology & top)
private

Definition at line 548 of file lammpsdatareader.cc.

◆ ReadBox_()

void votca::csg::LAMMPSDataReader::ReadBox_ ( std::vector< std::string > fields,
Topology & top )
private

Definition at line 316 of file lammpsdatareader.cc.

◆ ReadDihedrals_()

void votca::csg::LAMMPSDataReader::ReadDihedrals_ ( Topology & top)
private

Definition at line 681 of file lammpsdatareader.cc.

◆ ReadNumOfAngles_()

void votca::csg::LAMMPSDataReader::ReadNumOfAngles_ ( std::vector< std::string > fields)
private

Definition at line 365 of file lammpsdatareader.cc.

◆ ReadNumOfAtoms_()

void votca::csg::LAMMPSDataReader::ReadNumOfAtoms_ ( std::vector< std::string > fields,
Topology & top )
private

Definition at line 353 of file lammpsdatareader.cc.

◆ ReadNumOfBonds_()

void votca::csg::LAMMPSDataReader::ReadNumOfBonds_ ( std::vector< std::string > fields)
private

Definition at line 361 of file lammpsdatareader.cc.

◆ ReadNumOfDihedrals_()

void votca::csg::LAMMPSDataReader::ReadNumOfDihedrals_ ( std::vector< std::string > fields)
private

Definition at line 369 of file lammpsdatareader.cc.

◆ ReadNumOfImpropers_()

void votca::csg::LAMMPSDataReader::ReadNumOfImpropers_ ( std::vector< std::string > fields)
private

Definition at line 373 of file lammpsdatareader.cc.

◆ ReadNumTypes_()

void votca::csg::LAMMPSDataReader::ReadNumTypes_ ( std::vector< std::string > fields,
std::string type )
private

Definition at line 348 of file lammpsdatareader.cc.

◆ ReadTopology()

bool votca::csg::LAMMPSDataReader::ReadTopology ( std::string file,
Topology & top )
overridevirtual

open, read and close topology file

Implements votca::csg::TopologyReader.

Definition at line 66 of file lammpsdatareader.cc.

◆ RenameMolecules()

void votca::csg::LAMMPSDataReader::RenameMolecules ( MoleculeContainer & molecules) const
private

Definition at line 176 of file lammpsdatareader.cc.

◆ SkipImpropers_()

void votca::csg::LAMMPSDataReader::SkipImpropers_ ( )
private

Definition at line 672 of file lammpsdatareader.cc.

◆ SortIntoDataGroup_()

void votca::csg::LAMMPSDataReader::SortIntoDataGroup_ ( std::string tag)
private

Definition at line 334 of file lammpsdatareader.cc.

Member Data Documentation

◆ atomIdToIndex_

std::map<Index, Index> votca::csg::LAMMPSDataReader::atomIdToIndex_
private

Definition at line 100 of file lammpsdatareader.h.

◆ atomIdToMoleculeId_

std::map<Index, Index> votca::csg::LAMMPSDataReader::atomIdToMoleculeId_
private

Definition at line 97 of file lammpsdatareader.h.

◆ atomtypes_

std::map<Index, std::string> votca::csg::LAMMPSDataReader::atomtypes_
private

Definition at line 82 of file lammpsdatareader.h.

◆ charge_unit

const tools::ChargeUnit votca::csg::LAMMPSDataReader::charge_unit = tools::ChargeUnit::e

Definition at line 52 of file lammpsdatareader.h.

◆ data_

std::map<std::string, std::vector<std::vector<std::string> > > votca::csg::LAMMPSDataReader::data_
private

Definition at line 76 of file lammpsdatareader.h.

◆ distance_unit

const tools::DistanceUnit votca::csg::LAMMPSDataReader::distance_unit = tools::DistanceUnit::angstroms

Definition at line 47 of file lammpsdatareader.h.

◆ energy_unit

const tools::MolarEnergyUnit votca::csg::LAMMPSDataReader::energy_unit
Initial value:

Definition at line 50 of file lammpsdatareader.h.

◆ fl_

std::ifstream votca::csg::LAMMPSDataReader::fl_
private

Definition at line 72 of file lammpsdatareader.h.

◆ fname_

std::string votca::csg::LAMMPSDataReader::fname_
private

Definition at line 73 of file lammpsdatareader.h.

◆ force_unit

const tools::MolarForceUnit votca::csg::LAMMPSDataReader::force_unit
Initial value:

Definition at line 53 of file lammpsdatareader.h.

◆ mass_unit

const tools::MassUnit votca::csg::LAMMPSDataReader::mass_unit = tools::MassUnit::grams_per_mole

Definition at line 49 of file lammpsdatareader.h.

◆ molecules_

std::map<Index, Molecule *> votca::csg::LAMMPSDataReader::molecules_
private

Definition at line 94 of file lammpsdatareader.h.

◆ numberOf_

std::map<std::string, Index> votca::csg::LAMMPSDataReader::numberOf_
private

Definition at line 90 of file lammpsdatareader.h.

◆ numberOfDifferentTypes_

std::map<std::string, Index> votca::csg::LAMMPSDataReader::numberOfDifferentTypes_
private

Definition at line 86 of file lammpsdatareader.h.

◆ time_unit

const tools::TimeUnit votca::csg::LAMMPSDataReader::time_unit = tools::TimeUnit::femtoseconds

Definition at line 48 of file lammpsdatareader.h.

◆ topology_

bool votca::csg::LAMMPSDataReader::topology_
private

Definition at line 74 of file lammpsdatareader.h.


The documentation for this class was generated from the following files: