6#ifndef GEMMI_SMALL_HPP_
7#define GEMMI_SMALL_HPP_
32 ops.reserve(symops.size());
33 for (
const std::string& xyz : symops)
57 s += std::to_string(std::abs(
charge));
58 s +=
charge > 0 ?
'+' :
'-';
88 for (
const char* c = order; *c !=
'\0' &&
spacegroup ==
nullptr; ++c) {
101 }
catch (std::exception&) {}
121 char prefer[] = {c,
'\0'};
129 throw std::invalid_argument(
"determine_and_set_spacegroup(): wrong character in 'order'");
140 std::sort(
ops.begin(),
ops.end());
143 cat_to(err,
"symops list is incomplete or incorrect\n");
145 cat_to(err,
"symops list is incorrect or incomplete or redundant\n");
148 cat_to(err,
"space group from symops not found in the table\n");
150 cat_to(err,
"space group from symops differs: ",
sg->xhm(),
'\n');
151 }
catch (std::exception&
e) {
152 cat_to(err,
"error while processing symops: ",
e.what(),
'\n');
159 ") not found in the table\n");
162 ") differs: ",
sg->xhm(),
'\n');
163 }
catch (std::exception&
e) {
164 cat_to(err,
"error while processing Hall symbol: ",
e.what(),
'\n');
172 ") differs: ",
sg->hm,
'\n');
181 if (at.symbol == symbol)
188 std::bitset<(size_t)
El::END> table;
190 table.set((
size_t)atom.element.elem);
215 int len = label.size() > 1 && std::isalpha(label[1]) ? 2 : 1;
216 dest->element = len == 1 ? impl::find_single_letter_element(label[0] & ~0x20)
218 if (
dest->element !=
El::X && (label.back() ==
'+' || label.back() ==
'-')) {
219 int sign = label.back() ==
'+' ? 1 : -1;
220 if (label.size() - len == 1)
222 else if (label.size() - len == 2 && label[len] >=
'0' && label[len] <=
'9')
223 dest->charge = sign * (label[len] -
'0');
227inline std::vector<SmallStructure::Site>
230 std::vector<Site> all;
232 size_t start = all.size();
236 if (std::any_of(all.begin() + start, all.end(), [&](
const Site& other) {
237 return cell.distance_sq(fpos, other.fract) < sq(SPECIAL_POS_TOL);
241 all.back().fract =
fpos;
Elements from the periodic table.
Math utilities. 3D linear algebra.
void vector_remove_if(std::vector< T > &v, F &&condition)
El find_element(const char *symbol)
GEMMI_DLL Op parse_triplet(const std::string &s, char notation=' ')
void split_element_and_charge(const std::string &label, T *dest)
GroupOps symops_from_hall(const char *hall)
const SpaceGroup * find_spacegroup_by_number(int ccp4) noexcept
GEMMI_DLL const SpaceGroup * find_spacegroup_by_name(std::string name, double alpha=0., double gamma=0., const char *prefer=nullptr)
If angles alpha and gamma are provided, they are used to distinguish hexagonal and rhombohedral setti...
GroupOps split_centering_vectors(const std::vector< Op > &ops)
std::vector< Op > triplets_to_ops(const std::vector< std::string > &symops)
void cat_to(std::string &)
const SpaceGroup * find_spacegroup_by_ops(const GroupOps &gops)
bool is_complete(const GroupOps &gops)
const char * name() const
Op * find_by_rotation(const Op::Rot &r)
std::vector< Op > sym_ops
std::vector< Op > all_ops_sorted() const
Coordinates in Angstroms - orthogonal (Cartesian) coordinates.
Position orth(const gemmi::UnitCell &cell_) const
std::string element_and_charge_symbol() const
std::string spacegroup_hm
std::vector< Site > get_all_unit_cell_sites() const
const SpaceGroup * spacegroup
std::vector< Site > sites
std::vector< AtomType > atom_types
std::string check_spacegroup() const
void change_occupancies_to_crystallographic(double max_dist=0.4)
void determine_and_set_spacegroup(const char *order)
const AtomType * get_atom_type(const std::string &symbol) const
std::bitset<(size_t) El::END > present_elements() const
const SpaceGroup * determine_spacegroup_from(char c, GroupOps &gops) const
std::string spacegroup_hall
std::vector< std::string > symops
Position orthogonalize(const Fractional &f) const
void set_cell_images_from_groupops(const GroupOps &group_ops)
std::vector< FTransform > images
void set_cell_images_from_spacegroup(const SpaceGroup *sg)
int is_special_position(const Fractional &fpos, double max_dist) const
Counts nearby symmetry mates (0 = none, 3 = 4-fold axis, etc).
Crystallographic Symmetry. Space Groups. Coordinate Triplets.
Utilities. Mostly for working with strings and vectors.