15 bool occupant_dof_are_equal(
const std::vector<xtal::Molecule> &LHS,
16 const std::vector<xtal::Molecule> &RHS,
18 if (RHS.size() != LHS.size())
return false;
20 for (
Index i = 0; i < LHS.size(); ++i) {
21 for (j = 0; j < RHS.size(); ++j) {
26 if (j == RHS.size()) {
39 :
Coordinate(init_home), m_label(-1), m_type_ID(-1) {}
48 const std::map<std::string, SiteDoFSet> &site_dof)
52 m_occupant_dof(site_occ),
53 m_dof_map(site_dof) {}
61 const std::vector<SiteDoFSet> &dofset_vec)
83 throw std::runtime_error(
84 std::string(
"In Structure::dof(), this structure does not contain any "
85 "global DoF's of type ") +
98 std::vector<std::string> result;
102 result.push_back(it->first);
110 if (_dof.second.traits().time_reversal_active())
return true;
113 if (mol.time_reversal_active())
return true;
196 return (
compare_type(test_site) && Coordinate::operator==(test_site));
243 std::vector<std::string> occ_list;
253 if (new_ind ==
m_label)
return;
267 Eigen::Vector3i SD_flag;
271 for (
int i = 0; i < 3; i++) {
275 }
else if (ch ==
'F') {
281 std::vector<Molecule> tocc;
284 while (ch !=
'\n' && ch !=
':' && !stream.eof()) {
285 while ((ch < 'a' || ch >
'z') && (ch < 'A' || ch >
'Z') && ch !=
'\n' &&
286 ch !=
':' && !stream.eof()) {
290 if (ch !=
'\n' && ch !=
':' && !stream.eof()) {
292 std::string mol_name;
303 std::string mol_name;
308 Index index = tocc.size();
309 for (
Index i = 0; i < tocc.size(); i++)
310 if (tocc[i].
name() == mol_name) {
331 throw std::runtime_error(
332 "Error in Site::read(): Trying to read Site info, but no valid input "
342 throw std::runtime_error(
343 "Error in Site::read(): Trying to read Site info, but no valid input "
346 stream.ignore(1000,
'\n');
354 void Site::read(std::istream &stream, std::string &elem,
bool SD_is_on) {
359 Eigen::Vector3i SD_flag;
363 for (
int i = 0; i < 3; i++) {
367 }
else if (ch ==
'F') {
373 std::vector<Molecule> tocc;
380 throw std::runtime_error(
381 "Error in Site::read(): Trying to read Site info, but no valid input "
384 stream.ignore(1000,
'\n');
396 void Site::print(std::ostream &stream, Eigen::IOFormat format)
const {
400 stream << m.name() <<
" ";
408 std::ostream &out_stream) {
410 out_stream << m.name() <<
' ';
433 for (; it1 !=
m_dof_map.end(); ++it1, ++it2)
463 return Site(LHS) += RHS;
469 return Site(RHS) += LHS;
477 std::swap(transformed_site, mutating_site);
478 return mutating_site;
485 std::vector<xtal::Molecule> transformed_occupants = site.
occupant_dof();
490 std::map<std::string, xtal::SiteDoFSet> transformed_dof;
491 for (
const auto &name_dof_pr : site.
dofs()) {
492 transformed_dof.emplace(name_dof_pr.first,
496 return xtal::Site(transformed_coord, transformed_occupants, transformed_dof);
static COORD_TYPE CHECK()
get the current mode (call using COORD_MODE::CHECK())
Represents cartesian and fractional coordinates.
void print(std::ostream &stream, COORD_TYPE mode, char term=0, Eigen::IOFormat format=Eigen::IOFormat(7, 12)) const
Coordinate & operator+=(const Coordinate &RHS)
Positive translation of this coordinate by RHS.cart()
const Lattice & lattice() const
Access the home lattice of the coordinate.
Coordinate & operator-=(const Coordinate &RHS)
Negative translation of this coordinate by RHS.cart()
void read(std::istream &stream, COORD_TYPE mode)
double min_dist(const Coordinate &neighbor) const
Returns distance (in Angstr) to nearest periodic image of neighbor.
double dist(const Coordinate &neighbor) const
distance (in Angstr) of neighbor from *this
Class representing a Molecule.
bool _compare_type_no_ID(const Site &test_site) const
bool operator==(const Site &test_site) const
bool time_reversal_active() const
bool compare_type(const Site &test_site) const
std::map< std::string, SiteDoFSet > const & dofs() const
bool compare(const Coordinate &test_coord) const
Site(const Lattice &init_home)
bool has_dof(std::string const &_dof_type) const
void read(std::istream &stream, bool SD_is_on=false)
bool contains(const std::string &name) const
void set_dofs(std::map< std::string, SiteDoFSet > _dofs)
const std::vector< Molecule > & occupant_dof() const
Site & operator-=(const Coordinate &translation)
void print(std::ostream &stream, Eigen::IOFormat format=Eigen::IOFormat(7, 12)) const
SiteDoFSet const & dof(std::string const &_dof_type) const
void set_label(Index _new_label)
Index m_label
Integer label used to differentiate sites of otherwise identical type.
static std::vector< Site > & _type_prototypes()
std::vector< std::string > allowed_occupants() const
void set_allowed_occupants(const std::vector< Molecule > &new_occ_domain)
std::map< std::string, SiteDoFSet > m_dof_map
additional continuous degrees of freedom
Site & operator+=(const Coordinate &translation)
std::vector< std::string > dof_types() const
static void print_occupant_dof(const std::vector< Molecule > &allowed_occupants, std::ostream &out_stream)
std::vector< Molecule > m_occupant_dof
bool almost_equal(const Site &test_site) const
Index label() const
access m_label;
Coordinate operator*(const SymOp &LHS, const Coordinate &RHS)
Coordinate operator+(const Coordinate &LHS, const Coordinate &RHS)
static Molecule make_atom(std::string const &atom_name)
Return an atomic Molecule with specified name.
xtal::Coordinate copy_apply(const xtal::SymOp &op, xtal::Coordinate coord)
Copy and apply SymOp to a Coordinate.
xtal::Coordinate & apply(const xtal::SymOp &op, xtal::Coordinate &coord)
apply SymOp to a Coordinate
std::map< std::string, DoFSetType > make_dofset_map(std::vector< DoFSetType > const &dofset_vec)
std::ostream & operator<<(std::ostream &stream, const Site &site)
void swap(ConfigDoF &A, ConfigDoF &B)
GenericDatumFormatter< std::string, DataObject > name()
bool identical(AnisoValTraits const &A, AnisoValTraits const &B)
bool valid_index(Index i)
INDEX_TYPE Index
For long integer indexing: