Commit f3c2e591 by Maarten L. Hekkelman

Merge branch 'develop' of github.com:PDB-REDO/libcifpp into develop

parents 24ab660e 4732004b
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
# set the project name # set the project name
project(cifpp VERSION 3.0.1 LANGUAGES CXX) project(cifpp VERSION 3.0.2 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
...@@ -133,8 +133,6 @@ if(MSVC) ...@@ -133,8 +133,6 @@ if(MSVC)
message(FATAL_ERROR "Unsupported or unknown processor type ${CMAKE_SYSTEM_PROCESSOR}") message(FATAL_ERROR "Unsupported or unknown processor type ${CMAKE_SYSTEM_PROCESSOR}")
endif() endif()
set(COFF_SPEC "--coff=${COFF_TYPE}")
# for mrc, just in case # for mrc, just in case
list(APPEND CMAKE_PREFIX_PATH "$ENV{LOCALAPPDATA}/mrc") list(APPEND CMAKE_PREFIX_PATH "$ENV{LOCALAPPDATA}/mrc")
endif() endif()
...@@ -150,12 +148,12 @@ endif() ...@@ -150,12 +148,12 @@ endif()
if(WIN32 AND BUILD_SHARED_LIBS) if(WIN32 AND BUILD_SHARED_LIBS)
message("Not using resources when building shared libraries for Windows") message("Not using resources when building shared libraries for Windows")
else() else()
find_program(MRC mrc) find_package(Mrc)
if(MRC) if(MRC_FOUND)
option(CIFPP_USE_RSRC "Use mrc to create resources" ON) option(USE_RSRC "Use mrc to create resources" ON)
else() else()
message("Using resources not possible since mrc was not found") message(WARNING "Not using resources since mrc was not found")
endif() endif()
if(CIFPP_USE_RSRC STREQUAL "ON") if(CIFPP_USE_RSRC STREQUAL "ON")
...@@ -176,9 +174,7 @@ find_package(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_opt ...@@ -176,9 +174,7 @@ find_package(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_opt
if(NOT MSVC AND Boost_USE_STATIC_LIBS) if(NOT MSVC AND Boost_USE_STATIC_LIBS)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED) list(APPEND CIFPP_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND CIFPP_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES} ${BZip2_LIBRARIES})
endif() endif()
include(FindFilesystem) include(FindFilesystem)
...@@ -341,6 +337,13 @@ install(TARGETS cifpp ...@@ -341,6 +337,13 @@ install(TARGETS cifpp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(MSVC)
install(
FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
OPTIONAL)
endif()
install(EXPORT cifppTargets install(EXPORT cifppTargets
FILE "cifppTargets.cmake" FILE "cifppTargets.cmake"
NAMESPACE cifpp:: NAMESPACE cifpp::
...@@ -414,13 +417,6 @@ option(CIFPP_BUILD_TESTS "Build test exectuables" OFF) ...@@ -414,13 +417,6 @@ option(CIFPP_BUILD_TESTS "Build test exectuables" OFF)
if(CIFPP_BUILD_TESTS) if(CIFPP_BUILD_TESTS)
if(CIFPP_USE_RSRC)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj
COMMAND ${MRC} -o ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic ${COFF_SPEC}
)
set(CIFPP_TEST_RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj)
endif()
list(APPEND CIFPP_tests list(APPEND CIFPP_tests
# pdb2cif # pdb2cif
rename-compound rename-compound
...@@ -431,7 +427,7 @@ if(CIFPP_BUILD_TESTS) ...@@ -431,7 +427,7 @@ if(CIFPP_BUILD_TESTS)
set(CIFPP_TEST "${CIFPP_TEST}-test") set(CIFPP_TEST "${CIFPP_TEST}-test")
set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test/${CIFPP_TEST}.cpp") set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test/${CIFPP_TEST}.cpp")
add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE} ${CIFPP_TEST_RESOURCE}) add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE})
target_include_directories(${CIFPP_TEST} PRIVATE target_include_directories(${CIFPP_TEST} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
...@@ -440,6 +436,10 @@ if(CIFPP_BUILD_TESTS) ...@@ -440,6 +436,10 @@ if(CIFPP_BUILD_TESTS)
target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp ${Boost_LIBRARIES} ${CIFPP_REQUIRED_LIBRARIES}) target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp ${Boost_LIBRARIES} ${CIFPP_REQUIRED_LIBRARIES})
if(CIFPP_USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
endif()
if(MSVC) if(MSVC)
# Specify unwind semantics so that MSVC knowns how to handle exceptions # Specify unwind semantics so that MSVC knowns how to handle exceptions
target_compile_options(${CIFPP_TEST} PRIVATE /EHsc) target_compile_options(${CIFPP_TEST} PRIVATE /EHsc)
......
...@@ -4,7 +4,6 @@ include(CMakeFindDependencyMacro) ...@@ -4,7 +4,6 @@ include(CMakeFindDependencyMacro)
find_dependency(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_options) find_dependency(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_options)
if(NOT WIN32) if(NOT WIN32)
find_dependency(ZLIB) find_dependency(ZLIB)
find_dependency(BZip2)
endif() endif()
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake") INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
......
Version 3.0.2
- refactored mmcif::Atom for performance reasons
Version 3.0.1
- Fixed processing of proline restraints file from CCP4, proline
is a peptide, really.
- Added code to facilitate DSSP
Version 3.0.0 Version 3.0.0
- Replaced many strings in the API with string_view for - Replaced many strings in the API with string_view for
performance reasons. performance reasons.
......
...@@ -792,7 +792,7 @@ class Row ...@@ -792,7 +792,7 @@ class Row
} }
void assign(const std::vector<Item> &values); void assign(const std::vector<Item> &values);
void assign(std::string_view name, const std::string &value, bool updateLinked); void assign(std::string_view name, const std::string &value, bool updateLinked, bool validate = true);
bool operator==(const Row &rhs) const bool operator==(const Row &rhs) const
{ {
...@@ -814,7 +814,7 @@ class Row ...@@ -814,7 +814,7 @@ class Row
friend std::ostream &operator<<(std::ostream &os, const Row &row); friend std::ostream &operator<<(std::ostream &os, const Row &row);
private: private:
void assign(size_t column, const std::string &value, bool updateLinked); void assign(size_t column, const std::string &value, bool updateLinked, bool validate = true);
void assign(const Item &i, bool updateLinked); void assign(const Item &i, bool updateLinked);
static void swap(size_t column, ItemRow *a, ItemRow *b); static void swap(size_t column, ItemRow *a, ItemRow *b);
...@@ -2152,6 +2152,7 @@ class Category ...@@ -2152,6 +2152,7 @@ class Category
std::vector<ItemColumn> mColumns; std::vector<ItemColumn> mColumns;
ItemRow *mHead; ItemRow *mHead;
ItemRow *mTail; ItemRow *mTail;
size_t mLastUniqueNr = 0;
class CatIndex *mIndex; class CatIndex *mIndex;
std::vector<Linked> mParentLinks, mChildLinks; std::vector<Linked> mParentLinks, mChildLinks;
......
...@@ -184,6 +184,15 @@ class DSSP ...@@ -184,6 +184,15 @@ class DSSP
std::tuple<ResidueInfo,double> acceptor(int i) const; std::tuple<ResidueInfo,double> acceptor(int i) const;
std::tuple<ResidueInfo,double> donor(int i) const; std::tuple<ResidueInfo,double> donor(int i) const;
/// \brief Simple compare equals
bool operator==(const ResidueInfo &rhs) const
{
return mImpl == rhs.mImpl;
}
/// \brief Returns \result true if there is a bond between two residues
friend bool TestBond(ResidueInfo const &a, ResidueInfo const &b);
private: private:
ResidueInfo(Res* res) : mImpl(res) {} ResidueInfo(Res* res) : mImpl(res) {}
...@@ -193,7 +202,7 @@ class DSSP ...@@ -193,7 +202,7 @@ class DSSP
class iterator class iterator
{ {
public: public:
using iterator_category = std::input_iterator_tag; using iterator_category = std::bidirectional_iterator_tag;
using value_type = ResidueInfo; using value_type = ResidueInfo;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
using pointer = value_type*; using pointer = value_type*;
...@@ -214,6 +223,14 @@ class DSSP ...@@ -214,6 +223,14 @@ class DSSP
return tmp; return tmp;
} }
iterator& operator--();
iterator operator--(int)
{
auto tmp(*this);
this->operator--();
return tmp;
}
bool operator==(const iterator& rhs) const { return mCurrent.mImpl == rhs.mCurrent.mImpl; } bool operator==(const iterator& rhs) const { return mCurrent.mImpl == rhs.mCurrent.mImpl; }
bool operator!=(const iterator& rhs) const { return mCurrent.mImpl != rhs.mCurrent.mImpl; } bool operator!=(const iterator& rhs) const { return mCurrent.mImpl != rhs.mCurrent.mImpl; }
......
...@@ -60,30 +60,101 @@ class File; ...@@ -60,30 +60,101 @@ class File;
class Atom class Atom
{ {
private:
struct AtomImpl : public std::enable_shared_from_this<AtomImpl>
{
AtomImpl(cif::Datablock &db, const std::string &id, cif::Row row);
// constructor for a symmetry copy of an atom
AtomImpl(const AtomImpl &impl, const Point &loc, const std::string &sym_op);
AtomImpl(const AtomImpl &i) = default;
void prefetch();
int compare(const AtomImpl &b) const;
bool getAnisoU(float anisou[6]) const;
void moveTo(const Point &p);
const Compound &comp() const;
const std::string get_property(const std::string_view name) const;
void set_property(const std::string_view name, const std::string &value);
const cif::Datablock &mDb;
std::string mID;
AtomType mType;
std::string mAtomID;
std::string mCompID;
std::string mAsymID;
int mSeqID;
std::string mAltID;
std::string mAuthSeqID;
Point mLocation;
int mRefcount;
cif::Row mRow;
mutable std::vector<std::tuple<std::string,cif::detail::ItemReference>> mCachedRefs;
mutable const Compound *mCompound = nullptr;
bool mSymmetryCopy = false;
bool mClone = false;
std::string mSymmetryOperator = "1_555";
};
public: public:
Atom();
Atom(struct AtomImpl *impl); Atom() {}
Atom(const Atom &rhs);
Atom(std::shared_ptr<AtomImpl> impl)
: mImpl(impl) {}
Atom(const Atom &rhs)
: mImpl(rhs.mImpl) {}
Atom(cif::Datablock &db, cif::Row &row); Atom(cif::Datablock &db, cif::Row &row);
// a special constructor to create symmetry copies // a special constructor to create symmetry copies
Atom(const Atom &rhs, const Point &symmmetry_location, const std::string &symmetry_operation); Atom(const Atom &rhs, const Point &symmmetry_location, const std::string &symmetry_operation);
~Atom(); explicit operator bool() const { return (bool)mImpl; }
explicit operator bool() const { return mImpl_ != nullptr; }
// return a copy of this atom, with data copied instead of referenced // return a copy of this atom, with data copied instead of referenced
Atom clone() const; Atom clone() const
{
auto copy = std::make_shared<AtomImpl>(*mImpl);
copy->mClone = true;
return Atom(copy);
}
Atom &operator=(const Atom &rhs) = default;
Atom &operator=(const Atom &rhs); template <typename T>
T get_property(const std::string_view name) const;
void set_property(const std::string_view name, const std::string &value)
{
mImpl->set_property(name, value);
}
template <typename T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
void property(const std::string_view name, const T &value)
{
set_property(name, std::to_string(value));
}
const std::string &id() const; const std::string &id() const { return mImpl->mID; }
AtomType type() const; AtomType type() const { return mImpl->mType; }
Point location() const; Point location() const { return mImpl->mLocation; }
void location(Point p); void location(Point p) { mImpl->moveTo(p); }
/// \brief Translate the position of this atom by \a t /// \brief Translate the position of this atom by \a t
void translate(Point t); void translate(Point t);
...@@ -91,47 +162,40 @@ class Atom ...@@ -91,47 +162,40 @@ class Atom
/// \brief Rotate the position of this atom by \a q /// \brief Rotate the position of this atom by \a q
void rotate(Quaternion q); void rotate(Quaternion q);
/// \brief Translate and rotate the position of this atom by \a t and \a q
void translateAndRotate(Point t, Quaternion q);
/// \brief Translate, rotate and translate again the coordinates this atom by \a t1 , \a q and \a t2
void translateRotateAndTranslate(Point t1, Quaternion q, Point t2);
// for direct access to underlying data, be careful! // for direct access to underlying data, be careful!
const cif::Row getRow() const; const cif::Row getRow() const { return mImpl->mRow; }
const cif::Row getRowAniso() const; const cif::Row getRowAniso() const;
// Atom symmetryCopy(const Point& d, const clipper::RTop_orth& rt); bool isSymmetryCopy() const { return mImpl->mSymmetryCopy; }
bool isSymmetryCopy() const; std::string symmetry() const { return mImpl->mSymmetryOperator; }
std::string symmetry() const;
// const clipper::RTop_orth& symop() const;
const Compound &comp() const; const Compound &comp() const { return mImpl->comp(); }
bool isWater() const; bool isWater() const { return mImpl->mCompID == "HOH" or mImpl->mCompID == "H2O" or mImpl->mCompID == "WAT"; }
int charge() const; int charge() const;
float uIso() const; float uIso() const;
bool getAnisoU(float anisou[6]) const; bool getAnisoU(float anisou[6]) const { return mImpl->getAnisoU(anisou); }
float occupancy() const; float occupancy() const;
template <typename T>
T property(const std::string_view name) const;
void property(const std::string_view name, const std::string &value);
template <typename T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
void property(const std::string_view name, const T &value)
{
property(name, std::to_string(value));
}
// specifications // specifications
std::string labelAtomID() const; const std::string& labelAtomID() const { return mImpl->mAtomID; }
std::string labelCompID() const; const std::string& labelCompID() const { return mImpl->mCompID; }
std::string labelAsymID() const; const std::string& labelAsymID() const { return mImpl->mAsymID; }
std::string labelEntityID() const; std::string labelEntityID() const;
int labelSeqID() const; int labelSeqID() const { return mImpl->mSeqID; }
std::string labelAltID() const; const std::string& labelAltID() const { return mImpl->mAltID; }
bool isAlternate() const; bool isAlternate() const { return not mImpl->mAltID.empty(); }
std::string authAtomID() const; std::string authAtomID() const;
std::string authCompID() const; std::string authCompID() const;
std::string authAsymID() const; std::string authAsymID() const;
std::string authSeqID() const; const std::string& authSeqID() const { return mImpl->mAuthSeqID; }
std::string pdbxAuthInsCode() const; std::string pdbxAuthInsCode() const;
std::string pdbxAuthAltID() const; std::string pdbxAuthAltID() const;
...@@ -140,13 +204,6 @@ class Atom ...@@ -140,13 +204,6 @@ class Atom
bool operator==(const Atom &rhs) const; bool operator==(const Atom &rhs) const;
// // get clipper format Atom
// clipper::Atom toClipper() const;
// Radius calculation based on integrating the density until perc of electrons is found
void calculateRadius(float resHigh, float resLow, float perc);
float radius() const;
// access data in compound for this atom // access data in compound for this atom
// convenience routine // convenience routine
...@@ -158,10 +215,10 @@ class Atom ...@@ -158,10 +215,10 @@ class Atom
void swap(Atom &b) void swap(Atom &b)
{ {
std::swap(mImpl_, b.mImpl_); std::swap(mImpl, b.mImpl);
} }
int compare(const Atom &b) const; int compare(const Atom &b) const { return mImpl->compare(*b.mImpl); }
bool operator<(const Atom &rhs) const bool operator<(const Atom &rhs) const
{ {
...@@ -172,14 +229,31 @@ class Atom ...@@ -172,14 +229,31 @@ class Atom
private: private:
friend class Structure; friend class Structure;
void setID(int id);
AtomImpl *impl(); void setID(int id);
const AtomImpl *impl() const;
struct AtomImpl *mImpl_; std::shared_ptr<AtomImpl> mImpl;
}; };
template <>
inline std::string Atom::get_property<std::string>(const std::string_view name) const
{
return mImpl->get_property(name);
}
template <>
inline int Atom::get_property<int>(const std::string_view name) const
{
auto v = mImpl->get_property(name);
return v.empty() ? 0 : stoi(v);
}
template <>
inline float Atom::get_property<float>(const std::string_view name) const
{
return stof(mImpl->get_property(name));
}
inline void swap(mmcif::Atom &a, mmcif::Atom &b) inline void swap(mmcif::Atom &a, mmcif::Atom &b)
{ {
a.swap(b); a.swap(b);
...@@ -202,19 +276,16 @@ typedef std::vector<Atom> AtomView; ...@@ -202,19 +276,16 @@ typedef std::vector<Atom> AtomView;
class Residue class Residue
{ {
public: public:
// constructors should be private, but that's not possible for now (needed in emplace) // constructor
// constructor for waters
Residue(const Structure &structure, const std::string &compoundID, Residue(const Structure &structure, const std::string &compoundID,
const std::string &asymID, const std::string &authSeqID); const std::string &asymID, int seqID = 0, const std::string &authSeqID = {})
: mStructure(&structure)
// constructor for a residue without a sequence number , mCompoundID(compoundID)
Residue(const Structure &structure, const std::string &compoundID, , mAsymID(asymID)
const std::string &asymID); , mSeqID(seqID)
, mAuthSeqID(authSeqID)
// constructor for a residue with a sequence number {
Residue(const Structure &structure, const std::string &compoundID, }
const std::string &asymID, int seqID, const std::string &authSeqID);
Residue(const Residue &rhs) = delete; Residue(const Residue &rhs) = delete;
Residue &operator=(const Residue &rhs) = delete; Residue &operator=(const Residue &rhs) = delete;
...@@ -227,6 +298,11 @@ class Residue ...@@ -227,6 +298,11 @@ class Residue
const Compound &compound() const; const Compound &compound() const;
const AtomView &atoms() const; const AtomView &atoms() const;
void addAtom(const Atom &atom)
{
mAtoms.push_back(atom);
}
/// \brief Unique atoms returns only the atoms without alternates and the first of each alternate atom id. /// \brief Unique atoms returns only the atoms without alternates and the first of each alternate atom id.
AtomView unique_atoms() const; AtomView unique_atoms() const;
...@@ -277,6 +353,8 @@ class Residue ...@@ -277,6 +353,8 @@ class Residue
friend std::ostream &operator<<(std::ostream &os, const Residue &res); friend std::ostream &operator<<(std::ostream &os, const Residue &res);
friend Structure;
protected: protected:
Residue() {} Residue() {}
...@@ -537,6 +615,12 @@ class Structure ...@@ -537,6 +615,12 @@ class Structure
/// \brief Rotate the coordinates of all atoms in the structure by \a q /// \brief Rotate the coordinates of all atoms in the structure by \a q
void rotate(Quaternion t); void rotate(Quaternion t);
/// \brief Translate and rotate the coordinates of all atoms in the structure by \a t and \a q
void translateAndRotate(Point t, Quaternion q);
/// \brief Translate, rotate and translate again the coordinates of all atoms in the structure by \a t1 , \a q and \a t2
void translateRotateAndTranslate(Point t1, Quaternion q, Point t2);
const std::vector<Residue> &getNonPolymers() const { return mNonPolymers; } const std::vector<Residue> &getNonPolymers() const { return mNonPolymers; }
const std::vector<Residue> &getBranchResidues() const { return mBranchResidues; } const std::vector<Residue> &getBranchResidues() const { return mBranchResidues; }
......
...@@ -180,7 +180,10 @@ bool CompoundBondMap::bonded(const std::string &compoundID, const std::string &a ...@@ -180,7 +180,10 @@ bool CompoundBondMap::bonded(const std::string &compoundID, const std::string &a
auto compound = mmcif::CompoundFactory::instance().create(compoundID); auto compound = mmcif::CompoundFactory::instance().create(compoundID);
if (not compound) if (not compound)
{
if (cif::VERBOSE >= 0)
std::cerr << "Missing compound bond info for " << compoundID << std::endl; std::cerr << "Missing compound bond info for " << compoundID << std::endl;
}
else else
{ {
for (auto &atom : compound->bonds()) for (auto &atom : compound->bonds())
...@@ -308,7 +311,7 @@ BondMap::BondMap(const Structure &p) ...@@ -308,7 +311,7 @@ BondMap::BondMap(const Structure &p)
{ {
if (c == "HOH" or c == "H2O" or c == "WAT") if (c == "HOH" or c == "H2O" or c == "WAT")
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "skipping water in bond map calculation" << std::endl; std::cerr << "skipping water in bond map calculation" << std::endl;
continue; continue;
} }
......
...@@ -753,6 +753,7 @@ class Ff : public FBase ...@@ -753,6 +753,7 @@ class Ff : public FBase
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Failed to write '" << s << "' as a double, this indicates an error in the code for writing PDB files" << std::endl; std::cerr << "Failed to write '" << s << "' as a double, this indicates an error in the code for writing PDB files" << std::endl;
os << s; os << s;
} }
...@@ -2329,6 +2330,7 @@ void WriteRemark200(std::ostream& pdbFile, Datablock& db) ...@@ -2329,6 +2330,7 @@ void WriteRemark200(std::ostream& pdbFile, Datablock& db)
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
if (cif::VERBOSE >= 0)
std::cerr << ex.what() << std::endl; std::cerr << ex.what() << std::endl;
} }
} }
...@@ -2390,6 +2392,7 @@ void WriteRemark280(std::ostream& pdbFile, Datablock& db) ...@@ -2390,6 +2392,7 @@ void WriteRemark280(std::ostream& pdbFile, Datablock& db)
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
if (cif::VERBOSE >= 0)
std::cerr << ex.what() << std::endl; std::cerr << ex.what() << std::endl;
} }
} }
......
...@@ -288,7 +288,7 @@ SacParser::CIFToken SacParser::getNextToken() ...@@ -288,7 +288,7 @@ SacParser::CIFToken SacParser::getNextToken()
mState = eStateTextField + 1; mState = eStateTextField + 1;
else if (ch == kEOF) else if (ch == kEOF)
error("unterminated textfield"); error("unterminated textfield");
else if (not isAnyPrint(ch)) else if (not isAnyPrint(ch) and cif::VERBOSE >= 0)
// error("invalid character in text field '" + string({ static_cast<char>(ch) }) + "' (" + to_string((int)ch) + ")"); // error("invalid character in text field '" + string({ static_cast<char>(ch) }) + "' (" + to_string((int)ch) + ")");
std::cerr << "invalid character in text field '" << std::string({static_cast<char>(ch)}) << "' (" << ch << ") line: " << mLineNr << std::endl; std::cerr << "invalid character in text field '" << std::string({static_cast<char>(ch)}) << "' (" << ch << ") line: " << mLineNr << std::endl;
break; break;
...@@ -1220,7 +1220,7 @@ void DictParser::linkItems() ...@@ -1220,7 +1220,7 @@ void DictParser::linkItems()
{ {
for (auto &iv : cv.mItemValidators) for (auto &iv : cv.mItemValidators)
{ {
if (iv.mType == nullptr) if (iv.mType == nullptr and cif::VERBOSE >= 0)
std::cerr << "Missing item_type for " << iv.mTag << std::endl; std::cerr << "Missing item_type for " << iv.mTag << std::endl;
} }
} }
...@@ -1255,6 +1255,7 @@ void DictParser::loadDictionary() ...@@ -1255,6 +1255,7 @@ void DictParser::loadDictionary()
} }
catch (const std::exception &) catch (const std::exception &)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Error parsing dictionary" << std::endl; std::cerr << "Error parsing dictionary" << std::endl;
throw; throw;
} }
......
...@@ -1237,7 +1237,7 @@ std::filesystem::path gDataDir; ...@@ -1237,7 +1237,7 @@ std::filesystem::path gDataDir;
void addDataDirectory(std::filesystem::path dataDir) void addDataDirectory(std::filesystem::path dataDir)
{ {
if (VERBOSE and not fs::exists(dataDir)) if (VERBOSE > 0 and not fs::exists(dataDir))
std::cerr << "The specified data directory " << dataDir << " does not exist" << std::endl; std::cerr << "The specified data directory " << dataDir << " does not exist" << std::endl;
gDataDir = dataDir; gDataDir = dataDir;
} }
......
...@@ -354,7 +354,7 @@ void Validator::reportError(const std::string &msg, bool fatal) const ...@@ -354,7 +354,7 @@ void Validator::reportError(const std::string &msg, bool fatal) const
{ {
if (mStrict or fatal) if (mStrict or fatal)
throw ValidationError(msg); throw ValidationError(msg);
else if (VERBOSE) else if (VERBOSE > 0)
std::cerr << msg << std::endl; std::cerr << msg << std::endl;
} }
......
...@@ -193,7 +193,7 @@ Compound::Compound(cif::Datablock &db, const std::string &id, const std::string ...@@ -193,7 +193,7 @@ Compound::Compound(cif::Datablock &db, const std::string &id, const std::string
bond.type = BondType::delo; bond.type = BondType::delo;
else else
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Unimplemented chem_comp_bond.type " << btype << " in " << id << std::endl; std::cerr << "Unimplemented chem_comp_bond.type " << btype << " in " << id << std::endl;
bond.type = BondType::sing; bond.type = BondType::sing;
} }
...@@ -403,7 +403,7 @@ CompoundFactoryImpl::CompoundFactoryImpl(const std::filesystem::path &file, std: ...@@ -403,7 +403,7 @@ CompoundFactoryImpl::CompoundFactoryImpl(const std::filesystem::path &file, std:
if (cif::iequals(id, "gly")) if (cif::iequals(id, "gly"))
type = "peptide linking"; type = "peptide linking";
else if (cif::iequals(group, "l-peptide") or cif::iequals(group, "L-peptide linking") or cif::iequals(group, "peptide")) else if (cif::iequals(group, "l-peptide") or cif::iequals(group, "L-peptide linking") or cif::iequals(group, "peptide") or cif::iequals(group, "p-peptide"))
type = "L-peptide linking"; type = "L-peptide linking";
else if (cif::iequals(group, "DNA")) else if (cif::iequals(group, "DNA"))
type = "DNA linking"; type = "DNA linking";
...@@ -520,7 +520,7 @@ Compound *CCDCompoundFactoryImpl::create(const std::string &id) ...@@ -520,7 +520,7 @@ Compound *CCDCompoundFactoryImpl::create(const std::string &id)
} }
} }
if (result == nullptr and cif::VERBOSE) if (result == nullptr and cif::VERBOSE > 0)
std::cerr << "Could not locate compound " << id << " in the CCD components file" << std::endl; std::cerr << "Could not locate compound " << id << " in the CCD components file" << std::endl;
return result; return result;
...@@ -611,7 +611,7 @@ Compound *CCP4CompoundFactoryImpl::create(const std::string &id) ...@@ -611,7 +611,7 @@ Compound *CCP4CompoundFactoryImpl::create(const std::string &id)
if (cif::iequals(id, "gly")) if (cif::iequals(id, "gly"))
type = "peptide linking"; type = "peptide linking";
else if (cif::iequals(group, "l-peptide") or cif::iequals(group, "L-peptide linking") or cif::iequals(group, "peptide")) else if (cif::iequals(group, "l-peptide") or cif::iequals(group, "L-peptide linking") or cif::iequals(group, "peptide") or cif::iequals(group, "p-peptide"))
type = "L-peptide linking"; type = "L-peptide linking";
else if (cif::iequals(group, "DNA")) else if (cif::iequals(group, "DNA"))
type = "DNA linking"; type = "DNA linking";
...@@ -645,13 +645,13 @@ CompoundFactory::CompoundFactory() ...@@ -645,13 +645,13 @@ CompoundFactory::CompoundFactory()
auto ccd = cif::loadResource("components.cif"); auto ccd = cif::loadResource("components.cif");
if (ccd) if (ccd)
mImpl.reset(new CCDCompoundFactoryImpl(mImpl)); mImpl.reset(new CCDCompoundFactoryImpl(mImpl));
else if (cif::VERBOSE) else if (cif::VERBOSE > 0)
std::cerr << "CCD components.cif file was not found" << std::endl; std::cerr << "CCD components.cif file was not found" << std::endl;
const char *clibd_mon = getenv("CLIBD_MON"); const char *clibd_mon = getenv("CLIBD_MON");
if (clibd_mon != nullptr and fs::is_directory(clibd_mon)) if (clibd_mon != nullptr and fs::is_directory(clibd_mon))
mImpl.reset(new CCP4CompoundFactoryImpl(clibd_mon)); mImpl.reset(new CCP4CompoundFactoryImpl(clibd_mon));
else if (cif::VERBOSE) else if (cif::VERBOSE > 0)
std::cerr << "CCP4 monomers library not found, CLIBD_MON is not defined" << std::endl; std::cerr << "CCP4 monomers library not found, CLIBD_MON is not defined" << std::endl;
} }
...@@ -695,6 +695,7 @@ void CompoundFactory::setDefaultDictionary(const std::filesystem::path &inDictFi ...@@ -695,6 +695,7 @@ void CompoundFactory::setDefaultDictionary(const std::filesystem::path &inDictFi
} }
catch (const std::exception &) catch (const std::exception &)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Error loading dictionary " << inDictFile << std::endl; std::cerr << "Error loading dictionary " << inDictFile << std::endl;
throw; throw;
} }
...@@ -715,6 +716,7 @@ void CompoundFactory::pushDictionary(const std::filesystem::path &inDictFile) ...@@ -715,6 +716,7 @@ void CompoundFactory::pushDictionary(const std::filesystem::path &inDictFile)
} }
catch (const std::exception &) catch (const std::exception &)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Error loading dictionary " << inDictFile << std::endl; std::cerr << "Error loading dictionary " << inDictFile << std::endl;
throw; throw;
} }
......
...@@ -1320,7 +1320,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1320,7 +1320,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
if (line != "REFINEMENT.") if (line != "REFINEMENT.")
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Unexpected data in REMARK 3" << std::endl; std::cerr << "Unexpected data in REMARK 3" << std::endl;
return false; return false;
} }
...@@ -1332,7 +1332,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1332,7 +1332,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
if (not std::regex_match(line, m, rxp)) if (not std::regex_match(line, m, rxp))
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Expected valid PROGRAM line in REMARK 3" << std::endl; std::cerr << "Expected valid PROGRAM line in REMARK 3" << std::endl;
return false; return false;
} }
...@@ -1367,6 +1367,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1367,6 +1367,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
} }
catch(const std::exception& e) catch(const std::exception& e)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Error parsing REMARK 3 with " << parser->program() << std::endl std::cerr << "Error parsing REMARK 3 with " << parser->program() << std::endl
<< e.what() << '\n'; << e.what() << '\n';
score = 0; score = 0;
...@@ -1411,7 +1412,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1411,7 +1412,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
tryParser(new TNT_Remark3Parser(program, expMethod, r, db)); tryParser(new TNT_Remark3Parser(program, expMethod, r, db));
else if (ba::starts_with(program, "X-PLOR")) else if (ba::starts_with(program, "X-PLOR"))
tryParser(new XPLOR_Remark3Parser(program, expMethod, r, db)); tryParser(new XPLOR_Remark3Parser(program, expMethod, r, db));
else if (cif::VERBOSE) else if (cif::VERBOSE > 0)
std::cerr << "Skipping unknown program (" << program << ") in REMARK 3" << std::endl; std::cerr << "Skipping unknown program (" << program << ") in REMARK 3" << std::endl;
} }
...@@ -1420,6 +1421,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1420,6 +1421,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
bool guessProgram = scores.empty() or scores.front().score < 0.9f;; bool guessProgram = scores.empty() or scores.front().score < 0.9f;;
if (guessProgram) if (guessProgram)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "Unknown or untrusted program in REMARK 3, trying all parsers to see if there is a match" << std::endl; std::cerr << "Unknown or untrusted program in REMARK 3, trying all parsers to see if there is a match" << std::endl;
tryParser(new BUSTER_TNT_Remark3Parser("BUSTER-TNT", expMethod, r, db)); tryParser(new BUSTER_TNT_Remark3Parser("BUSTER-TNT", expMethod, r, db));
...@@ -1444,7 +1446,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab ...@@ -1444,7 +1446,7 @@ bool Remark3Parser::parse(const std::string& expMethod, PDBRecord* r, cif::Datab
auto& best = scores.front(); auto& best = scores.front();
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Choosing " << best.parser->program() << " version '" << best.parser->version() << "' as refinement program. Score = " << best.score << std::endl; std::cerr << "Choosing " << best.parser->program() << " version '" << best.parser->version() << "' as refinement program. Score = " << best.score << std::endl;
auto& software = db["software"]; auto& software = db["software"];
......
...@@ -248,7 +248,7 @@ struct TLSSelectionNot : public TLSSelection ...@@ -248,7 +248,7 @@ struct TLSSelectionNot : public TLSSelection
for (auto& r: residues) for (auto& r: residues)
r.selected = not r.selected; r.selected = not r.selected;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "NOT" << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "NOT" << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -267,7 +267,7 @@ struct TLSSelectionAll : public TLSSelection ...@@ -267,7 +267,7 @@ struct TLSSelectionAll : public TLSSelection
for (auto& r: residues) for (auto& r: residues)
r.selected = true; r.selected = true;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "ALL" << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "ALL" << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -287,7 +287,7 @@ struct TLSSelectionChain : public TLSSelectionAll ...@@ -287,7 +287,7 @@ struct TLSSelectionChain : public TLSSelectionAll
for (auto& r: residues) for (auto& r: residues)
r.selected = allChains or r.chainID == m_chain; r.selected = allChains or r.chainID == m_chain;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "CHAIN " << m_chain << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "CHAIN " << m_chain << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -307,7 +307,7 @@ struct TLSSelectionResID : public TLSSelectionAll ...@@ -307,7 +307,7 @@ struct TLSSelectionResID : public TLSSelectionAll
for (auto& r: residues) for (auto& r: residues)
r.selected = r.seqNr == m_seq_nr and r.iCode == m_icode; r.selected = r.seqNr == m_seq_nr and r.iCode == m_icode;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "ResID " << m_seq_nr << (m_icode ? std::string { m_icode} : "") << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "ResID " << m_seq_nr << (m_icode ? std::string { m_icode} : "") << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -331,7 +331,7 @@ struct TLSSelectionRangeSeq : public TLSSelectionAll ...@@ -331,7 +331,7 @@ struct TLSSelectionRangeSeq : public TLSSelectionAll
(r.seqNr <= m_last or m_last == kResidueNrWildcard)); (r.seqNr <= m_last or m_last == kResidueNrWildcard));
} }
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Range " << m_first << ':' << m_last << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Range " << m_first << ':' << m_last << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -374,7 +374,7 @@ struct TLSSelectionRangeID : public TLSSelectionAll ...@@ -374,7 +374,7 @@ struct TLSSelectionRangeID : public TLSSelectionAll
} }
} }
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Through " << m_first << ':' << m_last << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Through " << m_first << ':' << m_last << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -407,7 +407,7 @@ struct TLSSelectionUnion : public TLSSelection ...@@ -407,7 +407,7 @@ struct TLSSelectionUnion : public TLSSelection
for (auto ai = a.begin(), bi = b.begin(), ri = residues.begin(); ri != residues.end(); ++ai, ++bi, ++ri) for (auto ai = a.begin(), bi = b.begin(), ri = residues.begin(); ri != residues.end(); ++ai, ++bi, ++ri)
ri->selected = ai->selected or bi->selected; ri->selected = ai->selected or bi->selected;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Union" << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Union" << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -440,7 +440,7 @@ struct TLSSelectionIntersection : public TLSSelection ...@@ -440,7 +440,7 @@ struct TLSSelectionIntersection : public TLSSelection
for (auto ai = a.begin(), bi = b.begin(), ri = residues.begin(); ri != residues.end(); ++ai, ++bi, ++ri) for (auto ai = a.begin(), bi = b.begin(), ri = residues.begin(); ri != residues.end(); ++ai, ++bi, ++ri)
ri->selected = ai->selected and bi->selected; ri->selected = ai->selected and bi->selected;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Intersection" << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Intersection" << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -462,7 +462,7 @@ struct TLSSelectionByName : public TLSSelectionAll ...@@ -462,7 +462,7 @@ struct TLSSelectionByName : public TLSSelectionAll
for (auto& r: residues) for (auto& r: residues)
r.selected = r.name == m_name; r.selected = r.name == m_name;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Name " << m_name << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Name " << m_name << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -488,7 +488,7 @@ struct TLSSelectionByElement : public TLSSelectionAll ...@@ -488,7 +488,7 @@ struct TLSSelectionByElement : public TLSSelectionAll
for (auto& r: residues) for (auto& r: residues)
r.selected = iequals(r.name, m_element); r.selected = iequals(r.name, m_element);
if (cif::VERBOSE) if (cif::VERBOSE > 0)
{ {
std::cout << std::string(indentLevel * 2, ' ') << "Element " << m_element << std::endl; std::cout << std::string(indentLevel * 2, ' ') << "Element " << m_element << std::endl;
DumpSelection(residues, indentLevel); DumpSelection(residues, indentLevel);
...@@ -890,7 +890,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::Parse() ...@@ -890,7 +890,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::Parse()
Match(pt_EOLN); Match(pt_EOLN);
if (extraParenthesis) if (extraParenthesis and cif::VERBOSE > 0)
std::cerr << "WARNING: too many closing parenthesis in TLS selection statement" << std::endl; std::cerr << "WARNING: too many closing parenthesis in TLS selection statement" << std::endl;
return result; return result;
...@@ -931,7 +931,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::ParseFactor() ...@@ -931,7 +931,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::ParseFactor()
case '(': case '(':
Match('('); Match('(');
result = ParseAtomSelection(); result = ParseAtomSelection();
if (m_lookahead == pt_EOLN) if (m_lookahead == pt_EOLN and cif::VERBOSE > 0)
std::cerr << "WARNING: missing closing parenthesis in TLS selection statement" << std::endl; std::cerr << "WARNING: missing closing parenthesis in TLS selection statement" << std::endl;
else else
Match(')'); Match(')');
...@@ -1033,7 +1033,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::ParseFactor() ...@@ -1033,7 +1033,7 @@ TLSSelectionPtr TLSSelectionParserImplPhenix::ParseFactor()
result.reset(new TLSSelectionRangeID(from, to, icode_from, icode_to)); result.reset(new TLSSelectionRangeID(from, to, icode_from, icode_to));
else else
{ {
if (cif::VERBOSE and (icode_from or icode_to)) if (cif::VERBOSE > 0 and (icode_from or icode_to))
std::cerr << "Warning, ignoring insertion codes" << std::endl; std::cerr << "Warning, ignoring insertion codes" << std::endl;
result.reset(new TLSSelectionRangeSeq(from, to)); result.reset(new TLSSelectionRangeSeq(from, to));
...@@ -1231,6 +1231,7 @@ TLSSelectionPtr TLSSelectionParserImplBuster::ParseGroup() ...@@ -1231,6 +1231,7 @@ TLSSelectionPtr TLSSelectionParserImplBuster::ParseGroup()
std::tie(chain2, seqNr2) = ParseAtom(); std::tie(chain2, seqNr2) = ParseAtom();
if (chain1 != chain2) if (chain1 != chain2)
{ {
if (cif::VERBOSE > 0)
std::cerr << "Warning, ranges over multiple chains detected" << std::endl; std::cerr << "Warning, ranges over multiple chains detected" << std::endl;
TLSSelectionPtr sc1(new TLSSelectionChain(chain1)); TLSSelectionPtr sc1(new TLSSelectionChain(chain1));
...@@ -1289,7 +1290,7 @@ std::tuple<std::string,int> TLSSelectionParserImplBuster::ParseAtom() ...@@ -1289,7 +1290,7 @@ std::tuple<std::string,int> TLSSelectionParserImplBuster::ParseAtom()
Match(':'); Match(':');
std::string atom = m_value_s; std::string atom = m_value_s;
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Warning: ignoring atom ID '" << atom << "' in TLS selection" << std::endl; std::cerr << "Warning: ignoring atom ID '" << atom << "' in TLS selection" << std::endl;
Match(bt_IDENT); Match(bt_IDENT);
...@@ -1810,6 +1811,7 @@ class TLSSelectionParser ...@@ -1810,6 +1811,7 @@ class TLSSelectionParser
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
if (cif::VERBOSE >= 0)
std::cerr << "ParseError: " << ex.what() << std::endl; std::cerr << "ParseError: " << ex.what() << std::endl;
} }
...@@ -1834,14 +1836,14 @@ TLSSelectionPtr ParseSelectionDetails(const std::string& program, const std::str ...@@ -1834,14 +1836,14 @@ TLSSelectionPtr ParseSelectionDetails(const std::string& program, const std::str
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to old BUSTER" << std::endl; std::cerr << "Falling back to old BUSTER" << std::endl;
result = busterOld.Parse(selection); result = busterOld.Parse(selection);
} }
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to PHENIX" << std::endl; std::cerr << "Falling back to PHENIX" << std::endl;
result = phenix.Parse(selection); result = phenix.Parse(selection);
} }
...@@ -1852,35 +1854,35 @@ TLSSelectionPtr ParseSelectionDetails(const std::string& program, const std::str ...@@ -1852,35 +1854,35 @@ TLSSelectionPtr ParseSelectionDetails(const std::string& program, const std::str
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to BUSTER" << std::endl; std::cerr << "Falling back to BUSTER" << std::endl;
result = buster.Parse(selection); result = buster.Parse(selection);
} }
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to old BUSTER" << std::endl; std::cerr << "Falling back to old BUSTER" << std::endl;
result = busterOld.Parse(selection); result = busterOld.Parse(selection);
} }
} }
else else
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "No known program specified, trying PHENIX" << std::endl; std::cerr << "No known program specified, trying PHENIX" << std::endl;
result = phenix.Parse(selection); result = phenix.Parse(selection);
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to BUSTER" << std::endl; std::cerr << "Falling back to BUSTER" << std::endl;
result = buster.Parse(selection); result = buster.Parse(selection);
} }
if (not result) if (not result)
{ {
if (cif::VERBOSE) if (cif::VERBOSE > 0)
std::cerr << "Falling back to old BUSTER" << std::endl; std::cerr << "Falling back to old BUSTER" << std::endl;
result = busterOld.Parse(selection); result = busterOld.Parse(selection);
} }
......
...@@ -179,3 +179,23 @@ _struct_asym.details ? ...@@ -179,3 +179,23 @@ _struct_asym.details ?
<< structure.getFile().data() << std::endl; << structure.getFile().data() << std::endl;
} }
} }
// // --------------------------------------------------------------------
// BOOST_AUTO_TEST_CASE(test_load_1)
// {
// mmcif::File cf(gTestDir / "5v3g.cif.gz");
// mmcif::Structure s(cf);
// for (auto &poly : s.polymers())
// {
// std::cout << std::string(80, '=') << std::endl;
// for (auto &res : poly)
// {
// std::cout << res << std::endl;
// for (auto &atom : res.atoms())
// std::cout << " " << atom << std::endl;
// }
// }
// }
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