34 : m_title(
std::move(_title)),
35 m_species_mode(_mode),
36 m_struc(
std::move(_struc)),
37 m_permute(
sequence<
Index>(0, m_struc.info(_mode).size() - 1)),
41 m_sel_dynamics(false),
42 m_append_atom_names(true),
43 m_ignore{
"VA",
"Va",
"va"} {
67 int tprec = sout.
ostream().precision();
68 std::ios::fmtflags tflags = sout.
ostream().flags();
75 throw std::runtime_error(
76 "Error in PrintPOSCAR::print: m_permute.size() != info.size()");
81 std::vector<Index> atom;
84 std::vector<std::pair<std::string, Index> > atom_count;
90 if (atom_count.empty() || info.names[i] != atom_count.back().first)
91 atom_count.emplace_back(info.names[i], 0);
93 atom_count.back().second++;
107 for (
Index i : atom) {
108 Eigen::Vector3d vec = c2f * info.cart_coord(i);
111 Eigen::IOFormat format(prec, width + 1);
119 sout.
ostream().flags(std::ios::showpoint | std::ios::fixed | std::ios::right);
121 for (
Index i = 0; i < 3; ++i)
126 if (atom.size() == 0) {
134 for (
auto const &p : atom_count) {
135 sout << p.first <<
" ";
141 for (
auto const &p : atom_count) {
142 sout << p.second <<
" ";
148 sout << sout.
indent_str() <<
"Selective Dynamics\n";
156 for (
Index i : atom) {
158 << (c2f * info.cart_coord(i)).transpose().format(format);
165 for (
Index j = 0; j < 3; ++j) sout << (sd[j] ?
"T " :
"F ");
169 sout <<
" " << info.names[i];
175 sout.
ostream().precision(tprec);
std::string const & name() const
Const access of name.
static AnisoValTraits selective_dynamics()
Named constructor for selective_dynamics AnisoValTraits.
std::string indent_str() const
SpeciesMode m_species_mode
xtal::SimpleStructure m_struc
std::set< std::string > & ignore()
Access set of atom names which should not be printed, such as for vacancies.
void sort()
Default sort is by atom name.
PrintPOSCAR(xtal::SimpleStructure _struc, std::string _title="", SpeciesMode _mode=SpeciesMode::ATOM)
Construct PrintPOSCAR object.
void print(std::ostream &sout) const
Print POSCAR to stream.
std::vector< Index > m_permute
static std::string NAME()
get a string with the name of the active mode
Representation of a crystal of molecular and/or atomic occupants, and any additional properties....
Info & info(SpeciesMode _mode)
Info of specified context (atomic/molecular)
Eigen::Matrix3d lat_column_mat
Eigen::CwiseUnaryOp< decltype(Local::iround_l< typename Derived::Scalar >), const Derived > iround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXi.
std::vector< T > sequence(T first, T last)
GenericDatumFormatter< std::string, DataObject > name()
INDEX_TYPE Index
For long integer indexing:
Index print_matrix_width(std::ostream &s, const Derived &m, Index width)
std::map< std::string, Eigen::MatrixXd > properties
map of [property name, (m x names.size()) matrix] for all numerical site properties properties are as...
std::vector< Index > sort_by_name()
permutation that results in sites sorted alphabetically by species Guaranteed stable: will not change...