Commit 7f820449 by Maarten L. Hekkelman

formatting

parent ecb2cf5f
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <string>
#include <stdexcept> #include <stdexcept>
#include <string>
namespace mmcif namespace mmcif
{ {
...@@ -172,7 +172,8 @@ enum AtomType : uint8_t ...@@ -172,7 +172,8 @@ enum AtomType : uint8_t
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// AtomTypeInfo // AtomTypeInfo
enum RadiusType { enum RadiusType
{
eRadiusCalculated, eRadiusCalculated,
eRadiusEmpirical, eRadiusEmpirical,
eRadiusCovalentEmpirical, eRadiusCovalentEmpirical,
...@@ -205,7 +206,7 @@ class AtomTypeTraits ...@@ -205,7 +206,7 @@ class AtomTypeTraits
{ {
public: public:
AtomTypeTraits(AtomType a); AtomTypeTraits(AtomType a);
AtomTypeTraits(const std::string& symbol); AtomTypeTraits(const std::string &symbol);
AtomType type() const { return mInfo->type; } AtomType type() const { return mInfo->type; }
std::string name() const { return mInfo->name; } std::string name() const { return mInfo->name; }
...@@ -214,8 +215,8 @@ class AtomTypeTraits ...@@ -214,8 +215,8 @@ class AtomTypeTraits
bool isMetal() const { return mInfo->metal; } bool isMetal() const { return mInfo->metal; }
static bool isElement(const std::string& symbol); static bool isElement(const std::string &symbol);
static bool isMetal(const std::string& symbol); static bool isMetal(const std::string &symbol);
float radius(RadiusType type = eRadiusSingleBond) const float radius(RadiusType type = eRadiusSingleBond) const
{ {
...@@ -233,13 +234,16 @@ class AtomTypeTraits ...@@ -233,13 +234,16 @@ class AtomTypeTraits
}; };
// to get the Cval and Siva values, use this constant as charge: // to get the Cval and Siva values, use this constant as charge:
enum { kWKSFVal = -99 }; enum
{
kWKSFVal = -99
};
const SFData& wksf(int charge = 0) const; const SFData &wksf(int charge = 0) const;
const SFData& elsf() const; const SFData &elsf() const;
private: private:
const struct AtomTypeInfo* mInfo; const struct AtomTypeInfo *mInfo;
}; };
} } // namespace mmcif
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#pragma once #pragma once
#include <unordered_map>
#include <filesystem> #include <filesystem>
#include <stdexcept> #include <stdexcept>
#include <unordered_map>
#include "cif++/Structure.hpp" #include "cif++/Structure.hpp"
...@@ -38,24 +38,26 @@ namespace mmcif ...@@ -38,24 +38,26 @@ namespace mmcif
class BondMapException : public std::runtime_error class BondMapException : public std::runtime_error
{ {
public: public:
BondMapException(const std::string& msg) BondMapException(const std::string &msg)
: runtime_error(msg) {} : runtime_error(msg)
{
}
}; };
class BondMap class BondMap
{ {
public: public:
BondMap(const Structure& p); BondMap(const Structure &p);
BondMap(const BondMap&) = delete; BondMap(const BondMap &) = delete;
BondMap& operator=(const BondMap&) = delete; BondMap &operator=(const BondMap &) = delete;
bool operator()(const Atom& a, const Atom& b) const bool operator()(const Atom &a, const Atom &b) const
{ {
return isBonded(index.at(a.id()), index.at(b.id())); return isBonded(index.at(a.id()), index.at(b.id()));
} }
bool is1_4(const Atom& a, const Atom& b) const bool is1_4(const Atom &a, const Atom &b) const
{ {
uint32_t ixa = index.at(a.id()); uint32_t ixa = index.at(a.id());
uint32_t ixb = index.at(b.id()); uint32_t ixb = index.at(b.id());
...@@ -64,13 +66,12 @@ class BondMap ...@@ -64,13 +66,12 @@ class BondMap
} }
// links coming from the struct_conn records: // links coming from the struct_conn records:
std::vector<std::string> linked(const Atom& a) const; std::vector<std::string> linked(const Atom &a) const;
// This list of atomID's is comming from either CCD or the CCP4 dictionaries loaded // This list of atomID's is comming from either CCD or the CCP4 dictionaries loaded
static std::vector<std::string> atomIDsForCompound(const std::string& compoundID); static std::vector<std::string> atomIDsForCompound(const std::string &compoundID);
private: private:
bool isBonded(uint32_t ai, uint32_t bi) const bool isBonded(uint32_t ai, uint32_t bi) const
{ {
return bond.count(key(ai, bi)) != 0; return bond.count(key(ai, bi)) != 0;
...@@ -83,19 +84,18 @@ class BondMap ...@@ -83,19 +84,18 @@ class BondMap
return static_cast<uint64_t>(a) | (static_cast<uint64_t>(b) << 32); return static_cast<uint64_t>(a) | (static_cast<uint64_t>(b) << 32);
} }
std::tuple<uint32_t,uint32_t> dekey(uint64_t k) const std::tuple<uint32_t, uint32_t> dekey(uint64_t k) const
{ {
return std::make_tuple( return std::make_tuple(
static_cast<uint32_t>(k >> 32), static_cast<uint32_t>(k >> 32),
static_cast<uint32_t>(k) static_cast<uint32_t>(k));
);
} }
uint32_t dim; uint32_t dim;
std::unordered_map<std::string,uint32_t> index; std::unordered_map<std::string, uint32_t> index;
std::set<uint64_t> bond, bond_1_4; std::set<uint64_t> bond, bond_1_4;
std::map<std::string,std::set<std::string>> link; std::map<std::string, std::set<std::string>> link;
}; };
} } // namespace mmcif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment