QMCPACK
LatticeXMLWriter Class Reference
+ Collaboration diagram for LatticeXMLWriter:

Public Member Functions

 LatticeXMLWriter (const ParticleLayout &lat)
 
bool get (std::ostream &) const
 
xmlNodePtr createNode ()
 

Private Types

using ParticleLayout = PtclOnLatticeTraits::ParticleLayout
 

Private Attributes

const ParticleLayoutref_
 

Detailed Description

Definition at line 34 of file LatticeIO.h.

Member Typedef Documentation

◆ ParticleLayout

Definition at line 36 of file LatticeIO.h.

Constructor & Destructor Documentation

◆ LatticeXMLWriter()

LatticeXMLWriter ( const ParticleLayout lat)
inline

Definition at line 40 of file LatticeIO.h.

40 : ref_(lat) {}
const ParticleLayout & ref_
Definition: LatticeIO.h:37

Member Function Documentation

◆ createNode()

xmlNodePtr createNode ( )

Definition at line 259 of file LatticeIO.cpp.

References CrystalLattice< T, D >::R, and LatticeXMLWriter::ref_.

260 {
261  xmlNodePtr cur = xmlNewNode(NULL, (const xmlChar*)"unitcell");
262  std::ostringstream l;
263  l.setf(std::ios_base::scientific);
264  l.precision(12);
265  l << ref_.R;
266  xmlNodePtr p = xmlNewTextChild(cur, NULL, (const xmlChar*)"parameter", (const xmlChar*)l.str().c_str());
267  xmlNewProp(p, (const xmlChar*)"name", (const xmlChar*)"lattice");
268  return cur;
269 }
const ParticleLayout & ref_
Definition: LatticeIO.h:37
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ get()

bool get ( std::ostream &  os) const

Definition at line 240 of file LatticeIO.cpp.

References CrystalLattice< T, D >::BoxBConds, qmcplusplus::ewaldref::DIM, CrystalLattice< T, D >::R, LatticeXMLWriter::ref_, and TinyVector< T, D >::Size.

Referenced by XMLSaveParticle::get().

241 {
242  os << "<unitcell>" << std::endl;
243  os << R"(<parameter name="lattice" datatype="tensor">)" << std::endl;
244  os << ref_.R << "</parameter>" << std::endl;
245  os << "<parameter name=\"bconds\">";
247  for (int idir = 0; idir < DIM; idir++)
248  {
249  if (ref_.BoxBConds[idir])
250  os << "p ";
251  else
252  os << "n ";
253  }
254  os << "</parameter>" << std::endl;
255  os << "</unitcell>" << std::endl;
256  return true;
257 }
const ParticleLayout & ref_
Definition: LatticeIO.h:37
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

Member Data Documentation

◆ ref_

const ParticleLayout& ref_
private

Definition at line 37 of file LatticeIO.h.

Referenced by LatticeXMLWriter::createNode(), and LatticeXMLWriter::get().


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