65 auto print = [&](
bool val) {
83 namespace vaspio_impl {
188 const std::vector<std::string> &
ignore()
const {
196 template<
typename TupleIterator>
197 void _print(std::ostream &sout, TupleIterator begin, TupleIterator end);
239 typedef std::tuple<AtomName, Coordinate, SelectiveDynamics>
tuple_type;
241 typedef std::vector<tuple_type>::iterator
iterator;
279 void print(std::ostream &sout);
292 namespace vaspio_impl {
295 template<
typename TupleIterator>
300 int tprec = sout.precision();
301 std::ios::fmtflags tflags = sout.flags();
304 typedef std::tuple<std::string, Coordinate, SelectiveDynamics> tuple_type;
307 std::vector<tuple_type> atom;
308 for(
auto it = begin; it != end; ++it) {
313 [&](
const std::string & name) {
314 if(std::get<0>(*it) == name) {
325 sout << std::fixed << std::setprecision(8) <<
m_scale <<
"\n";
327 sout.flags(std::ios::showpoint | std::ios::fixed | std::ios::right);
329 sout <<
' ' << std::setw(16) <<
m_lat[0].transpose() <<
'\n';
330 sout <<
' ' << std::setw(16) <<
m_lat[1].transpose() <<
'\n';
331 sout <<
' ' << std::setw(16) <<
m_lat[2].transpose() <<
'\n';
334 if(atom.size() == 0) {
339 std::vector<int> atom_count = {1};
340 auto it = atom.cbegin();
341 std::string curr_atom = std::get<0>(*it);
343 sout << curr_atom <<
" ";
346 for(; it != atom.cend(); ++it) {
347 if(std::get<0>(*it) != curr_atom) {
348 atom_count.push_back(1);
349 curr_atom = std::get<0>(*it);
351 sout << curr_atom <<
" ";
362 for(
int i = 0; i < atom_count.size(); i++) {
363 sout << atom_count[i] <<
" ";
369 sout <<
"Selective Dynamics\n";
376 for(
auto it = atom.cbegin(); it != atom.cend(); ++it) {
379 sout <<
" " << std::get<2>(*it);
382 sout <<
" " << std::get<0>(*it);
388 sout.precision(tprec);
411 vaspio_impl::PrintPOSCARBase(struc.lattice()) {
416 for(
int i = 0; i < struc.
basis.
size(); ++i) {
419 struc.
basis[i].occ_name(),
443 vaspio_impl::PrintPOSCARBase(config.get_supercell().get_real_super_lattice()) {
450 for(
int i = 0; i < config.
size(); ++i) {
478 vaspio_impl::PrintPOSCARBase(scel.get_real_super_lattice()) {
481 auto occ_name = [&](
int i) {
486 for(
int i = 0; i < configdof.
size(); ++i) {
504 return std::get<0>(A) < std::get<0>(B);
SelectiveDynamics()
Default Constructor sets to false for all directions.
PrintPOSCARBase(const Lattice &lat)
Construct PrintPOSCAR object.
std::vector< std::string > m_ignore
List of atom names which should not be printed (primarily for vacancies)
Coordinate coord(const UnitCellCoord &bijk) const
const bool & operator[](int i) const
const_iterator cbegin() const
Iterate over tuples of (AtomName, Coordinate, SelectiveDynamics)
std::vector< tuple_type >::iterator iterator
const Molecule & get_mol(Index site_l) const
Molecule on site l.
const Structure & get_prim() const
void set_atom_names_off()
Do not print atom names line.
void set_atom_names_on()
Print atom names line.
PrintPOSCAR(const BasicStructure< Site > &struc)
Construct PrintPOSCAR object.
std::tuple< AtomName, Coordinate, SelectiveDynamics > tuple_type
Atom name, Coordinate, SelectiveDynamics.
Represents a supercell of the primitive parent crystal structure.
std::vector< tuple_type >::const_iterator const_iterator
Index size() const
*** ACCESSORS ***
void set_selective_dynamics_off()
Set selective dynamics off.
void _print(std::ostream &sout, TupleIterator begin, TupleIterator end)
Print POSCAR, provide a range of std::tuple
...
void print(std::ostream &sout)
Print POSCAR to stream.
std::ostream & operator<<(std::ostream &sout, const SelectiveDynamics &sel)
Write SelectiveDynamics options.
iterator begin()
Iterate over tuples of (AtomName, Coordinate, SelectiveDynamics)
void set_selective_dynamics_on()
Set selective dynamics on.
void set_cart()
Set coordinate mode to Cartesian.
void sort()
Default sort is by atom name.
std::vector< tuple_type > m_atom_order
(AtomName, Coordinate, SelectiveDynamics)
A container class for the different degrees of freedom a Configuration might have.
Array< CoordType > basis
Lattice vectors that specifies periodicity of the crystal.
PrintPOSCARBase()
Construct PrintPOSCAR object.
iterator end()
Iterate over tuples of (AtomName, Coordinate, SelectiveDynamics)
void set_direct()
Set coordinate mode to Direct (fractional)
std::string title
User-specified name of this Structure.
void set_frac()
Set coordinate mode to fractional (Direct)
Store SelectiveDynamics options.
std::vector< std::string > & ignore()
Access vector of atom names which should not be printed, such as for vacancies.
std::string name() const
SCELV_A_B_C_D_E_F/i.
void set_title(std::string title)
Set title.
Index size() const
Returns number of sites, NOT the number of primitives that fit in here.
void set_coord_mode(COORD_TYPE mode)
Set coordinate mode.
static std::string NAME()
get a string with the name of the active mode
const_iterator cend() const
Iterate over tuples of (AtomName, Coordinate, SelectiveDynamics)
Print POSCAR with formating options.
void set_scale(double s)
Set scaling factor.
const std::vector< std::string > & ignore() const
const Access vector of atom names which should not be printed, such as for vacancies ...
Supercell & get_supercell() const
Get the Supercell for this Configuration.
void set_append_atom_names_on()
Append atom name to end of each coordinate line.
Index get_b(Index i) const
void set_append_atom_names_off()
Do not append atom name to end of each coordinate line.
SelectiveDynamics(bool x, bool y, bool z)
A Configuration represents the values of all degrees of freedom in a Supercell.