NuriKit v0.1.0b2
Loading...
Searching...
No Matches
nuri Namespace Reference

Namespaces

namespace  constants

Classes

class  AtomData
class  Bfgs
 BFGS minimizer. More...
struct  BfgsResult
class  BondData
class  BoolMatrix
class  BoolMatrixKey
struct  BoostEdgeDesc
class  CifParser
class  CyclicIndex
 Cyclic indexer for Eigen types with a given offset. More...
class  CyclicIndex< 0, 0 >
class  CyclicIndex< O, 0 >
class  DefaultReaderFactoryImpl
class  DefaultReaderImpl
class  Element
 The class for element data. More...
struct  GAlignResult
struct  GAMinimizeArgs
class  GARigidMolInfo
struct  GASamplingArgs
class  Graph
 Class for very sparse graphs, especially designed for the molecular graphs. More...
struct  Isotope
class  LBfgs
 L-BFGS(-B) minimizer. More...
struct  LbfgsResult
class  MmcifReader
class  MmcifReaderFactory
struct  MmResult
class  Mol2Reader
class  Mol2ReaderFactory
class  Molecule
 Read-only molecule class. More...
class  MoleculeMutator
 A class to mutate a molecule. More...
class  MoleculeReader
class  MoleculeReaderFactory
class  MoleculeReaderWrapper
class  MoleculeReaderWrapper< std::ifstream, Reader >
class  MoleculeSanitizer
class  MoleculeStream
class  NelderMead
 Nelder-Mead simplex algorithm for function minimization. More...
struct  NMResult
class  OCTree
 An octree implementation for 3D point clouds. More...
class  PDBAtom
 Represents a PDB atom with (possibly) multiple alternate locations. More...
class  PDBAtomSite
 Represents a single site with position and properties. More...
class  PDBChain
 Represents a PDB chain containing residues. More...
class  PDBModel
 Represents a PDB model containing chains. More...
class  PDBReader
class  PDBReaderFactory
class  PDBResidue
 Represents a PDB residue containing atoms. More...
struct  PDBResidueId
class  PeriodicTable
 The periodic table of elements. More...
class  ReversedStream
class  RingSetsFinder
 Wrapper class of the common routines of find_sssr() and find_relevant_rings(). More...
class  SDFReader
class  SDFReaderFactory
class  SmilesReader
class  SmilesReaderFactory
class  Subgraph
 A subgraph of a graph. More...
class  TMAlign
 TM-align algorithm. More...
struct  TMAlignResult
 Result of TM-align algorithm. More...
class  VF2pp
 An implementation of VF2++ algorithm for (sub)graph isomorphism. More...
struct  VF2ppResult
class  VoxelGrid
 A uniform voxel-grid (cell list) index for 3D point clouds with a fixed neighbor cutoff. More...
class  ZippedIterator

Typedefs

using Rings = std::vector<std::vector<int>>
using NodesErased
template<class GT>
using SubgraphOf = typename internal::SubgraphTypeHelper<GT>::type
using Substructure = internal::Substructure<false>
using ConstSubstructure = internal::Substructure<true>
template<class Reader = MoleculeReader>
using FileMoleculeReader = MoleculeReaderWrapper<std::ifstream, Reader>
template<class Reader = MoleculeReader>
using StringMoleculeReader = MoleculeReaderWrapper<std::istringstream, Reader>

Enumerations

enum class  OptimResultCode { kSuccess , kMaxIterReached , kInvalidInput , kAbnormalTerm }
enum class  AlignMode : std::uint8_t { kMsdOnly = 0x1 , kXformOnly = 0x2 , kBoth = kMsdOnly | kXformOnly }
enum class  IsoMapType : int { kSubgraph , kInduced , kGraph }
 The type of isomorphic map to find. More...
enum class  AtomFlags : std::uint32_t {
  kAromatic = 0x1 , kConjugated = 0x2 , kRing = 0x4 , kChiral = 0x8 ,
  kClockWise = 0x10
}
enum class  BondFlags : std::uint32_t {
  kRing = 0x1 , kAromatic = 0x2 , kConjugated = 0x4 , kConfigSpecified = 0x8 ,
  kTransConfig = 0x10
}
enum class  SubstructCategory { kUnknown , kResidue , kChain }
enum class  SDFVersion { kAutomatic , kV2000 , kV3000 }

Functions

bool generate_coords (const Molecule &mol, Matrix3Xd &conf, int max_trial=10)
 Generate 3D coordinates for the molecule.
bool generate_coords (Molecule &mol, int max_trial=10)
 Generate 3D coordinates for the molecule.
ABSL_MUST_USE_RESULT bool guess_everything (MoleculeMutator &mut, int conf=0, double threshold=kDefaultThreshold)
 Guess bonds, types of atoms, and number of hydrogens of a molecule.
void guess_connectivity (MoleculeMutator &mut, int conf=0, double threshold=kDefaultThreshold)
 Guess connectivity information of a molecule.
ABSL_MUST_USE_RESULT bool guess_all_types (Molecule &mol, int conf=0)
 Guess types of atoms and bonds, and number of hydrogens of a molecule.
void guess_fcharge_2d (Molecule &mol)
 Guess formal charges of a molecule.
void guess_hydrogens_2d (Molecule &mol)
 Guess hydrogens of a molecule.
void guess_fcharge_hydrogens_2d (Molecule &mol)
 Guess formal charges and implicit hydrogens of a molecule.
template<class FuncGrad>
LbfgsResult l_bfgs_b (FuncGrad &&fg, MutRef< ArrayXd > x, const ArrayXi &nbd, const Array2Xd &bounds, const int m=10, const double factr=1e+7, const double pgtol=1e-5, const int maxiter=15000, const int maxls=20)
 Minimize a function using L-BFGS-B algorithm.
template<class FuncGrad>
LbfgsResult l_bfgs (FuncGrad &&fg, MutRef< ArrayXd > x, const int m=10, const double factr=1e+7, const double pgtol=1e-5, const int maxiter=15000, const int maxls=20)
 Minimize a function using L-BFGS algorithm.
template<class FuncGrad>
BfgsResult bfgs (FuncGrad &&fg, MutRef< ArrayXd > x, const double pgtol=1e-5, const double xrtol=0, int maxiter=-1, const int maxls=100, const double ftol=1e-4, const double gtol=0.9, const double xtol=1e-14)
 Minimize a function using BFGS algorithm.
template<class Func>
NMResult nelder_mead (Func &&f, MutRef< ArrayXXd > data, int maxiter=-1, const double ftol=1e-6, const double alpha=1, const double gamma=2, const double rho=0.5, const double sigma=0.5)
 Minimize a function using Nelder-Mead simplex algorithm.
ArrayXXd nm_prepare_simplex (ConstRef< ArrayXd > x0, double eps=1e-6)
 Prepare the initial simplex for Nelder-Mead algorithm.
std::pair< Rings, bool > find_all_rings (const Molecule &mol, int max_size=-1)
 Find all elementary cycles in the molecular graph.
std::pair< Rings, bool > find_all_rings (const Substructure &sub, int max_size=-1)
 Find all elementary cycles in the substructure.
std::pair< Rings, bool > find_all_rings (const ConstSubstructure &sub, int max_size=-1)
 Find all elementary cycles in the substructure.
template<class MoleculeLike>
 RingSetsFinder (const MoleculeLike &, int) -> RingSetsFinder< MoleculeLike >
Rings find_relevant_rings (const Molecule &mol, int max_size=-1)
 Find union of the all SSSRs in the molecular graph.
Rings find_relevant_rings (const Substructure &sub, int max_size=-1)
 Find union of the all SSSRs in the substructure.
Rings find_relevant_rings (const ConstSubstructure &sub, int max_size=-1)
 Find union of the all SSSRs in the substructure.
Rings find_sssr (const Molecule &mol, int max_size=-1)
 Find a smallest set of smallest rings (SSSR) of the molecular graph.
Rings find_sssr (const Substructure &sub, int max_size=-1)
 Find a smallest set of smallest rings (SSSR) of the substructure.
Rings find_sssr (const ConstSubstructure &sub, int max_size=-1)
 Find a smallest set of smallest rings (SSSR) of the substructure.
template<class T, class Alloc, class U>
std::vector< T, Alloc >::size_type erase (std::vector< T, Alloc > &c, const U &value)
template<class T, class Alloc, class Pred>
std::vector< T, Alloc >::size_type erase_if (std::vector< T, Alloc > &c, Pred &&pred)
template<class T, class Alloc, class Pred>
std::vector< T, Alloc >::iterator erase_first (std::vector< T, Alloc > &c, Pred &&pred)
template<class T, size_t N>
constexpr size_t array_size (T(&)[N])
constexpr bool operator== (const Isotope &lhs, const Isotope &rhs) noexcept
constexpr bool operator!= (const Isotope &lhs, const Isotope &rhs) noexcept
constexpr bool operator== (const Element &lhs, const Element &rhs) noexcept
constexpr bool operator!= (const Element &lhs, const Element &rhs) noexcept
template<class DT, std::enable_if_t< std::is_floating_point_v< DT >, int > = 0>
constexpr DT deg2rad (DT deg)
template<class DT, std::enable_if_t< std::is_integral_v< DT >, int > = 0>
constexpr double deg2rad (DT deg)
template<class DT, std::enable_if_t< std::is_floating_point_v< DT >, int > = 0>
constexpr DT rad2deg (DT rad)
template<class DT, std::enable_if_t< std::is_integral_v< DT >, int > = 0>
constexpr double rad2deg (DT rad)
template<class MatrixLike, class ArrayLike>
void pdistsq (ArrayLike &&distsq, const MatrixLike &m)
template<class MatrixLike>
auto pdistsq (const MatrixLike &m)
template<class MatrixLike, class ArrayLike>
void pdist (ArrayLike &&dist, const MatrixLike &m)
template<class MatrixLike>
auto pdist (const MatrixLike &m)
template<class AL, class DAL>
void to_square_form (DAL &&dists, const AL &pdists, Eigen::Index n)
template<class ArrayLike>
auto to_square_form (const ArrayLike &pdists, Eigen::Index n)
template<class ML1, class ML2, class DML, std::enable_if_t< internal::extract_if_enum_v(ML1::RowsAtCompileTime)==internal::extract_if_enum_v(ML2::RowsAtCompileTime), int > = 0>
void cdistsq (DML &&distsq, const ML1 &a, const ML2 &b)
template<class ML1, class ML2>
auto cdistsq (const ML1 &a, const ML2 &b)
template<class ML1, class ML2, class DML>
void cdist (DML &&dist, const ML1 &a, const ML2 &b)
template<class ML1, class ML2>
auto cdist (const ML1 &a, const ML2 &b)
template<class ML1, class ML2>
auto msd (const ML1 &a, const ML2 &b)
double cos_angle (const Vector3d &oa, const Vector3d &ob)
 Calculate the cosine of the angle between two vectors.
double cos_angle (const Vector3d &o, const Vector3d &a, const Vector3d &b)
 Calculate the cosine of the angle between two vectors.
template<class Scalar, class Indexer, int N, auto... Extra>
std::pair< Scalar, Scalar > sum_tan2_half (const Matrix< Scalar, 3, N, 0, Extra... > &m, const Indexer &idxs)
 Calculate sin and cos of half an average angle between vectors, (0 - idxs[0]), (1 - idxs[1]), ..., (n-1 - idxs[n-1]).
template<class Scalar, int N, auto... Extra>
std::pair< Scalar, Scalar > sum_tan2_half (const Matrix< Scalar, 3, N, 0, Extra... > &m)
 Calculate sin and cos of half an average angle between consecutive vectors, i.e., (0, 1), (1, 2), ..., (n-1, 0).
double cos_dihedral (const Vector3d &axis, Vector3d v, Vector3d w)
 Calculate A - (v) - B - (axis) - C - (w) - D dihedral angle along the axis. Axis should be normalized.
double cos_dihedral (const Vector3d &a, const Vector3d &b, const Vector3d &c, const Vector3d &d)
 Calculate A -> - B -> C -> D dihedral angle.
template<class MatrixLike>
Vector4d fit_plane (const MatrixLike &pts, bool normalize=true)
 Perform a least-squares fit of a plane to a set of points.
template<class VectorLike>
Vector3d any_perpendicular (const VectorLike &v, bool normalize=true)
 Find a vector perpendicular to the given vector.
std::pair< Isometry3d, double > kabsch (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ, AlignMode mode=AlignMode::kBoth, bool reflection=false)
 An implementation of the Kabsch algorithm for aligning two sets of points. This algorithm is based on the implementation in TM-align.
std::pair< Isometry3d, double > qcp (const Eigen::Ref< const Matrix3Xd > &query, const Eigen::Ref< const Matrix3Xd > &templ, AlignMode mode=AlignMode::kBoth, bool reflection=false, double evalprec=1e-11, double evecprec=1e-6, int maxiter=50)
 Perform quaternion-based superposition of two sets of points.
std::pair< Isometry3d, double > qcp_inplace (MutRef< Matrix3Xd > query, MutRef< Matrix3Xd > templ, AlignMode mode=AlignMode::kBoth, bool reflection=false, double evalprec=1e-11, double evecprec=1e-6, int maxiter=50)
 In-place version of qcp().
bool embed_distances_3d (Eigen::Ref< Matrix3Xd > pts, MatrixXd &dsqs)
 A routine for converting squared pairwise distances to cartesian coordinates.
bool embed_distances_4d (Eigen::Ref< Matrix4Xd > pts, MatrixXd &dsqs)
 A routine for converting squared pairwise distances to cartesian coordinates.
Matrix3Xd canonical_fibonacci_lattice (int npts)
 Generate points on a unit sphere using the "canonical" Fibonacci lattice method.
template<class NT, class ET>
auto out_edges (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
boost::graph_traits< Graph< NT, ET > >::vertex_descriptor source (typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e, const Graph< NT, ET > &)
template<class NT, class ET>
boost::graph_traits< Graph< NT, ET > >::vertex_descriptor target (typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e, const Graph< NT, ET > &)
template<class NT, class ET>
auto out_degree (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
auto in_edges (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
auto in_degree (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
auto degree (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
auto adjacent_vertices (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, const Graph< NT, ET > &g)
template<class NT, class ET>
auto vertices (const Graph< NT, ET > &g)
template<class NT, class ET>
auto num_vertices (const Graph< NT, ET > &g)
template<class NT, class ET>
auto edges (const Graph< NT, ET > &g)
template<class NT, class ET>
auto num_edges (const Graph< NT, ET > &g)
template<class NT, class ET>
auto add_vertex (Graph< NT, ET > &g)
template<class NT, class ET>
void clear_vertex (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, Graph< NT, ET > &g)
template<class NT, class ET>
void remove_vertex (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, Graph< NT, ET > &g)
template<class NT, class ET>
auto add_edge (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor u, typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, Graph< NT, ET > &g)
template<class NT, class ET>
void remove_edge (typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor u, typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v, Graph< NT, ET > &g)
template<class NT, class ET>
void remove_edge (typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e, Graph< NT, ET > &g)
template<class NT, class ET>
void remove_edge (typename boost::graph_traits< Graph< NT, ET > >::edge_iterator it, Graph< NT, ET > &g)
template<class NT, class ET>
auto get (boost::vertex_index_t, const Graph< NT, ET > &)
template<class NT, class ET>
auto get (boost::vertex_index_t, const Graph< NT, ET > &, typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v)
template<class NT, class ET>
auto get (boost::edge_index_t, const Graph< NT, ET > &)
template<class NT, class ET>
auto get (boost::edge_index_t, const Graph< NT, ET > &, typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e)
template<class NT, class ET, bool is_const>
auto out_edges (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor source (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e, const Subgraph< NT, ET, is_const > &)
template<class NT, class ET, bool is_const>
boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor target (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e, const Subgraph< NT, ET, is_const > &)
template<class NT, class ET, bool is_const>
auto out_degree (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto in_edges (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto in_degree (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto degree (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto adjacent_vertices (typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v, const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto vertices (const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto num_vertices (const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto edges (const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto num_edges (const Subgraph< NT, ET, is_const > &g)
template<class NT, class ET, bool is_const>
auto get (boost::vertex_index_t, const Subgraph< NT, ET, is_const > &)
template<class NT, class ET, bool is_const>
auto get (boost::vertex_index_t, const Subgraph< NT, ET, is_const > &, typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v)
template<class NT, class ET, bool is_const>
auto get (boost::edge_index_t, const Subgraph< NT, ET, is_const > &)
template<class NT, class ET, bool is_const>
auto get (boost::edge_index_t, const Subgraph< NT, ET, is_const > &, typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e)
template<class GT, bool is_const>
internal::EigenNeighborIndexer< GT, is_const > as_index (internal::NodeWrapper< GT, is_const > node)
template<class NT, class ET>
absl::flat_hash_set< int > connected_components (const Graph< NT, ET > &g, int begin)
 Find connected components of a graph starting from a node.
template<class NT, class ET>
absl::flat_hash_set< int > connected_components (const Graph< NT, ET > &g, int begin, int exclude)
 Find connected components of a graph starting from a node, excluding an edge between the starting node and the excluded node (if present).
template<class NT, class ET>
 Subgraph (Graph< NT, ET > &graph) -> Subgraph< NT, ET, false >
template<class NT, class ET>
 Subgraph (Graph< NT, ET > &graph, const std::vector< int > &nodes) -> Subgraph< NT, ET, false >
template<class NT, class ET>
 Subgraph (Graph< NT, ET > &graph, std::vector< int > &&nodes) noexcept -> Subgraph< NT, ET, false >
template<class NT, class ET>
 Subgraph (const Graph< NT, ET > &graph) -> Subgraph< NT, ET, true >
template<class NT, class ET>
 Subgraph (const Graph< NT, ET > &graph, const std::vector< int > &nodes) -> Subgraph< NT, ET, true >
template<class NT, class ET>
 Subgraph (const Graph< NT, ET > &graph, std::vector< int > &&nodes) noexcept -> Subgraph< NT, ET, true >
template<class GT>
SubgraphOf< GT > make_subgraph (GT &&graph)
 Make an empty subgraph from a graph.
template<class GT>
SubgraphOf< GT > make_subgraph (GT &&graph, internal::IndexSet &&nodes, internal::IndexSet &&edges)
 Make a subgraph from list of nodes and edges.
template<class GT>
SubgraphOf< GT > subgraph_from_nodes (GT &&graph, internal::IndexSet &&nodes)
 Make a subgraph from list of nodes.
template<class GT>
SubgraphOf< GT > subgraph_from_edges (GT &&graph, internal::IndexSet &&edges)
 Make a subgraph from list of edges.
template<IsoMapType kMt, class GT, class GU, class AL1, class AL2>
VF2pp< kMt, GT, GU > make_vf2pp (const GT &query, const GU &target, AL1 &&qlbl, AL2 &&tlbl)
 Prepare VF2++ algorithm.
template<IsoMapType kMt, class GT, class GU, class AL1, class AL2, class NodeMatch, class EdgeMatch>
VF2ppResult vf2pp (const GT &query, const GU &target, AL1 &&qlbl, AL2 &&tlbl, const NodeMatch &node_match, const EdgeMatch &edge_match)
 Find a query-to-target subgraph mapping.
template<class GT, class GU, class NodeMatch, class EdgeMatch, class AL1, class AL2>
VF2ppResult vf2pp (const GT &query, const GU &target, AL1 &&qlbl, AL2 &&tlbl, const NodeMatch &node_match, const EdgeMatch &edge_match, IsoMapType mt)
 Find a query-to-target subgraph mapping.
template<IsoMapType kMt, class GT, class GU, class NodeMatch, class EdgeMatch>
VF2ppResult vf2pp (const GT &query, const GU &target, const NodeMatch &node_match, const EdgeMatch &edge_match)
 Find a query-to-target subgraph mapping assuming all node labels are equal.
template<class GT, class GU, class NodeMatch, class EdgeMatch>
VF2ppResult vf2pp (const GT &query, const GU &target, const NodeMatch &node_match, const EdgeMatch &edge_match, IsoMapType mt)
 Find a query-to-target subgraph mapping assuming all node labels are equal.
constants::Hybridization clamp_hyb (int hyb)
constants::BondOrder clamp_ord (int ord)
bool operator== (const AtomData &lhs, const AtomData &rhs)
int all_neighbors (Molecule::Atom atom)
 Get the number of all neighbors of an atom.
int count_heavy (Molecule::Atom atom)
 Get the number of heavy atoms bonded to an atom.
int count_hydrogens (Molecule::Atom atom)
 Count the number of hydrogens of the atom.
int sum_bond_order (Molecule::Atom atom)
 Get the approximate total bond order of the atom.
int nonbonding_electrons (Molecule::Atom atom)
 Get the predicted non-bonding electron count of the atom.
int steric_number (Molecule::Atom atom)
 Get the predicted steric number of the atom.
const Elementeffective_element (const AtomData &data)
 Get "effective" element of the atom.
const Elementeffective_element (Molecule::Atom atom)
 Get "effective" element of the atom.
std::vector< std::vector< int > > fragments (const Molecule &mol)
 Get fragments of the molecule.
ABSL_MUST_USE_RESULT bool assign_charges_gasteiger (Molecule &mol, int relaxation_steps=12)
 Assign Marsili-Gasteiger charges to the molecule.
ArrayXd shrake_rupley_sasa (const Molecule &mol, const Matrix3Xd &conf, int nprobe=92, double rprobe=1.4, internal::SrSasaMethod method=internal::SrSasaMethod::kAuto)
 Calculate the Solvent-Accessible Surface Area (SASA) of a molecule conformation using the Shrake-Rupley algorithm.
template<class Stream>
Stream & operator>> (Stream &stream, Molecule &mol)
template<class ReaderFactoryImpl>
bool register_reader_factory (const std::vector< std::string > &names)
internal::CifValue cif_value (std::string_view value)
 Create a string CIF value from text.
template<class T, std::enable_if_t< std::is_same_v< T, bool >, int > = 0>
internal::CifValue cif_value (T value, bool short_form=false)
 Create a boolean CIF value.
template<class T, std::enable_if_t< std::is_integral_v< T > &&!std::is_same_v< T, bool >, int > = 0>
internal::CifValue cif_value (T value, int width=0)
 Create an integral CIF value.
template<class T, std::enable_if_t< std::is_floating_point_v< T >, int > = 0>
internal::CifValue cif_value (T value, int precision=-1, bool coerce_nonfinite=false, bool is_unk=true)
 Create a floating-point CIF value.
template<class T, std::enable_if_t<!std::is_arithmetic_v< std::decay_t< T > > &&!std::is_convertible_v< T, std::string_view >, int > = 0>
internal::CifValue cif_value (T &&value)
 Create a string CIF value from any absl::StrCat-able type.
bool write_cif_table (std::string &out, const internal::CifTable &table, bool align=false)
 Serialize a CIF table (key-value pairs or a loop_), appending to out.
bool write_cif_frame (std::string &out, const internal::CifFrame &frame, internal::CifFrame::Type type=internal::CifFrame::Type::kData, bool align=false)
 Serialize a CIF frame, appending to out.
bool write_cif_block (std::string &out, const internal::CifBlock &block, bool align=false)
 Serialize a CIF block (a data or global block plus its save frames), appending to out.
std::vector< Moleculemmcif_load_frame (const internal::CifFrame &frame)
std::vector< Moleculemmcif_read_next_block (CifParser &parser)
Molecule read_mol2 (const std::vector< std::string > &mol2)
 Read a single Mol2 string and return a molecule.
bool write_mol2 (std::string &out, const Molecule &mol, int conf=-1, bool write_sub=true)
Molecule read_pdb (const std::vector< std::string > &pdb)
 Read a single PDB string and return a molecule.
int write_pdb (std::string &out, const Molecule &mol, int model=-1, int conf=-1)
std::ostream & operator<< (std::ostream &os, const PDBResidueId &id)
template<class Hash>
Hash AbslHashValue (Hash h, PDBResidueId id)
bool operator== (PDBResidueId lhs, PDBResidueId rhs)
PDBModel read_pdb_model (const std::vector< std::string > &pdb)
Molecule read_sdf (const std::vector< std::string > &sdf)
 Read a single sdf string and return a molecule.
bool write_sdf (std::string &out, const Molecule &mol, int conf=-1, SDFVersion ver=SDFVersion::kAutomatic)
 Write a molecule to an SDF stream.
Molecule read_smiles (const std::vector< std::string > &smi_block)
 Read a single SMILES string and return a molecule.
bool write_smiles (std::string &out, const Molecule &mol, bool canonical=false)
template<class... Iters>
constexpr auto make_zipped_iterator (Iters... iters)
MmResult match_maker (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ, double cutoff=2.0, double global_ratio=0.1, double viol_ratio=0.5)
 Match-Maker algorithm for structural alignment of two 3D point clouds.
std::vector< GAlignResultgalign (const Molecule &mol, const Matrix3Xd &seed, const GARigidMolInfo &templ, bool flexible=true, int max_conf=1, const GASamplingArgs &sampling={}, const GAMinimizeArgs &minimize={})
TMAlignResult tm_align (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ, TMAlign::InitFlags flags=TMAlign::InitFlags::kDefault, int l_norm=-1, double d0=-1)
 Align two structures using TM-align algorithm.
TMAlignResult tm_align (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ, ConstRef< ArrayXc > secx, ConstRef< ArrayXc > secy, TMAlign::InitFlags flags=TMAlign::InitFlags::kDefault, int l_norm=-1, double d0=-1)
 Align two structures using TM-align algorithm.
TMAlignResult tm_align (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ, ConstRef< ArrayXi > y2x, int l_norm=-1, double d0=-1, bool keep_alignment=true)
 Align two structures using TM-align algorithm, with the given alignment. This is also known as the "TM-score" program in the TM-tools suite.
template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
constexpr T min (T a, T b)
template<class L, class R, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
constexpr const std::remove_reference_t< L > & min (L &&a, R &&b)
template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
constexpr T max (T a, T b)
template<class L, class R, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
constexpr const std::remove_reference_t< L > & max (L &&a, R &&b)
template<class T, class Comp = std::less<>, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
constexpr std::pair< T, T > minmax (T a, T b, Comp &&comp={})
template<class L, class R, class Comp = std::less<>, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
constexpr std::pair< const std::remove_reference_t< L > &, const std::remove_reference_t< L > & > minmax (L &&a, R &&b, Comp &&comp={})
template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
constexpr T clamp (T v, T l, T h)
template<class T, class L, class H, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< T >, internal::remove_cvref_t< L > > &&std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< H > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< T > > &&std::is_lvalue_reference_v< T > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< H >, int > = 0>
constexpr const std::remove_reference_t< T > & clamp (T &&v, L &&l, H &&h)

Variables

constexpr double kDefaultThreshold = 0.5

Typedef Documentation

◆ ConstSubstructure

using nuri::ConstSubstructure = internal::Substructure<true>

◆ FileMoleculeReader

template<class Reader = MoleculeReader>
using nuri::FileMoleculeReader = MoleculeReaderWrapper<std::ifstream, Reader>

◆ NodesErased

Initial value:
std::pair<std::pair<int, std::vector<int>>,
std::pair<int, std::vector<int>>>

◆ Rings

using nuri::Rings = std::vector<std::vector<int>>

◆ StringMoleculeReader

template<class Reader = MoleculeReader>
using nuri::StringMoleculeReader = MoleculeReaderWrapper<std::istringstream, Reader>

◆ SubgraphOf

template<class GT>
using nuri::SubgraphOf = typename internal::SubgraphTypeHelper<GT>::type

◆ Substructure

using nuri::Substructure = internal::Substructure<false>

Enumeration Type Documentation

◆ AlignMode

enum class nuri::AlignMode : std::uint8_t
strong
Enumerator
kMsdOnly 
kXformOnly 
kBoth 

◆ AtomFlags

enum class nuri::AtomFlags : std::uint32_t
strong
Enumerator
kAromatic 
kConjugated 
kRing 
kChiral 
kClockWise 

◆ BondFlags

enum class nuri::BondFlags : std::uint32_t
strong
Enumerator
kRing 
kAromatic 
kConjugated 
kConfigSpecified 
kTransConfig 

◆ IsoMapType

enum class nuri::IsoMapType : int
strong

The type of isomorphic map to find.

Enumerator
kSubgraph 

Subgraph isomorphism.

kInduced 

Induced subgraph isomorphism.

kGraph 

Graph isomorphism.

◆ OptimResultCode

enum class nuri::OptimResultCode
strong
Enumerator
kSuccess 
kMaxIterReached 
kInvalidInput 
kAbnormalTerm 

◆ SDFVersion

enum class nuri::SDFVersion
strong
Enumerator
kAutomatic 
kV2000 
kV3000 

◆ SubstructCategory

enum class nuri::SubstructCategory
strong
Enumerator
kUnknown 
kResidue 
kChain 

Function Documentation

◆ AbslHashValue()

template<class Hash>
Hash nuri::AbslHashValue ( Hash h,
PDBResidueId id )

◆ add_edge()

template<class NT, class ET>
auto nuri::add_edge ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor u,
typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
Graph< NT, ET > & g )

◆ add_vertex()

template<class NT, class ET>
auto nuri::add_vertex ( Graph< NT, ET > & g)

concept requirements

◆ adjacent_vertices() [1/2]

template<class NT, class ET>
auto nuri::adjacent_vertices ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

concept requirements

◆ adjacent_vertices() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::adjacent_vertices ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

concept requirements

◆ all_neighbors()

int nuri::all_neighbors ( Molecule::Atom atom)
inline

Get the number of all neighbors of an atom.

Parameters
atomAn atom.
Returns
Number of all neighbors of the atom, including implicit hydrogens.

◆ any_perpendicular()

template<class VectorLike>
Vector3d nuri::any_perpendicular ( const VectorLike & v,
bool normalize = true )

Find a vector perpendicular to the given vector.

Template Parameters
VectorLikeThe type of the vector-like object.
Parameters
vA vector-like object to generate a perpendicular vector.
normalizeWhether to normalize the perpendicular vector. Defaults to true.
Returns
A vector perpendicular to the given vector.

This function is based on the algorithm proposed by K Whatmough on Mathematics Stack Exchange. [4]

◆ array_size()

template<class T, size_t N>
size_t nuri::array_size ( T(&) [N])
constexpr

◆ as_index()

template<class GT, bool is_const>
internal::EigenNeighborIndexer< GT, is_const > nuri::as_index ( internal::NodeWrapper< GT, is_const > node)

◆ assign_charges_gasteiger()

ABSL_MUST_USE_RESULT bool nuri::assign_charges_gasteiger ( Molecule & mol,
int relaxation_steps = 12 )
extern

Assign Marsili-Gasteiger charges to the molecule.

Parameters
molThe molecule to assign charges to.
relaxation_stepsThe number of relaxation steps to perform after the initial charge assignment (default: 12). When set to 0, no relaxation is performed.
Returns
Whether the charge assignment was successful.

This implements the original Gasteiger charge assignment algorithm [2], which is based on the charge distribution over the sigma bonds. This is the only version that is implemented in most other cheminformatics libraries, including RDKit and OpenBabel.

The Gasteiger parameters are taken from RDKit and support most hybridization states of H, Be, B, C, N, O, F, Mg, Al, Si, P, S, Cl, Br, I, and dummy atoms. Unsupported elements and/or hybridization states will be reported as a warning and the algorithm will abort without any charge assignment.

The Gasteiger algorithm requires initial "seed" charges to be assigned to atoms. In this implementation, the initial charges are assigned from the (localized) formal charges of the atoms, then a charge delocalization algorithm is applied to the terminal atoms of a conjugated system with the same Gasteiger type (e.g., oxygens of a carboxylate group will be assigned -0.5 charge each).

Sets mol2_charge_type to GASTEIGER in the molecule properties when successful.

◆ bfgs()

template<class FuncGrad>
BfgsResult nuri::bfgs ( FuncGrad && fg,
MutRef< ArrayXd > x,
const double pgtol = 1e-5,
const double xrtol = 0,
int maxiter = -1,
const int maxls = 100,
const double ftol = 1e-4,
const double gtol = 0.9,
const double xtol = 1e-14 )
inline

Minimize a function using BFGS algorithm.

Template Parameters
FuncGradFunction object that computes the function value and gradient. Function value should be returned and gradient should be updated in the input gradient vector.
Parameters
fgFunction object.
xInitial guess. Will be modified in-place.
pgtolStop when the projected gradient is less than this value.
xrtolStop when the relative change in x is less than this value.
maxiterMaximum number of iterations. If negative, it will be set to 200 times the number of variables.
maxlsMaximum number of line search steps.
ftolTolerance for the relative change in the function value.
gtolGradient tolerance for the line search step.
xtolTolerance for the relative change in x.
Returns
A struct with the result code, number of iterations, final function value, and final gradient.
Note
The input x will be modified in-place.
See also
Bfgs

References:

  • "Broyden-Fletcher-Goldfarb-Shanno algorithm", Wikipedia (Accessed 2024-10-25).

This implementation is based on the Python implementation of BFGS in the SciPy library, with optimized Hessian update step suggested by the linked Wikipedia page. The original implementation is released under the BSD 3-Clause License (included below).

Copyright (c) 2001-2002 Enthought, Inc. 2003-2024, SciPy Developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ canonical_fibonacci_lattice()

Matrix3Xd nuri::canonical_fibonacci_lattice ( int npts)
extern

Generate points on a unit sphere using the "canonical" Fibonacci lattice method.

Parameters
nptsThe number of points to generate.
Returns
N points on a unit sphere.

The points are placed on the sphere as the following equation:

\[t_i (\theta, \phi) = \left(\frac{i}{\varphi^2}, \frac{i + 0.5}{N} \right) \]

Where \(\varphi\) is the golden ratio, \(N\) is the number of points, and \(0 \leq i < N \). Note, for compatibility with other implementations, step size along \(\theta\) is defined as \(1 / \varphi^2\) instead of the complementary \(1 / \varphi\) used in some literature.

This implementation is based on the following references:

  • M Roberts. How to evenly distribute points on a sphere more effectively than the canonical Fibonacci Lattice (2020-06-07). (Accessed 2025-11-25). [6]
  • G Alvaro. Math. Geosci. 2010, 42, 49-64. [3]

◆ cdist() [1/2]

template<class ML1, class ML2>
auto nuri::cdist ( const ML1 & a,
const ML2 & b )

◆ cdist() [2/2]

template<class ML1, class ML2, class DML>
void nuri::cdist ( DML && dist,
const ML1 & a,
const ML2 & b )

◆ cdistsq() [1/2]

template<class ML1, class ML2>
auto nuri::cdistsq ( const ML1 & a,
const ML2 & b )

◆ cdistsq() [2/2]

template<class ML1, class ML2, class DML, std::enable_if_t< internal::extract_if_enum_v(ML1::RowsAtCompileTime)==internal::extract_if_enum_v(ML2::RowsAtCompileTime), int > = 0>
void nuri::cdistsq ( DML && distsq,
const ML1 & a,
const ML2 & b )

◆ cif_value() [1/5]

internal::CifValue nuri::cif_value ( std::string_view value)
inline

Create a string CIF value from text.

Parameters
valuethe string to store.
Returns
A string CifValue (quoted on write only if its content requires it).

◆ cif_value() [2/5]

template<class T, std::enable_if_t<!std::is_arithmetic_v< std::decay_t< T > > &&!std::is_convertible_v< T, std::string_view >, int > = 0>
internal::CifValue nuri::cif_value ( T && value)

Create a string CIF value from any absl::StrCat-able type.

Parameters
valuethe object to stringify and store.
Returns
A string CifValue holding the stringified object.

Participates in overload resolution only for non-arithmetic types that are not convertible to std::string_view.

◆ cif_value() [3/5]

template<class T, std::enable_if_t< std::is_same_v< T, bool >, int > = 0>
internal::CifValue nuri::cif_value ( T value,
bool short_form = false )

Create a boolean CIF value.

Parameters
valuethe boolean to store.
short_formif true, use y / n instead of yes / no.
Returns
An unquoted CifValue holding the boolean literal.
Note
Implemented as a template (not a plain bool overload) so that pointers do not implicitly convert to bool and steal the std::string_view overload.

◆ cif_value() [4/5]

template<class T, std::enable_if_t< std::is_floating_point_v< T >, int > = 0>
internal::CifValue nuri::cif_value ( T value,
int precision = -1,
bool coerce_nonfinite = false,
bool is_unk = true )

Create a floating-point CIF value.

Parameters
valuethe number to store.
precisionif non-negative, format with this many digits after the decimal point; otherwise yields at most 6 significant digits.
coerce_nonfiniteif true, coerce non-finite values to a CIF-representable form that reparses faithfully:
  • NaN -> ? or . depending on is_unk
  • +Inf -> 8e+88888888
  • -Inf -> -8e+88888888 The infinity sentinel overflows on reparse, so any IEEE-conformant parser (up to binary256) reads it back as the original infinity.
is_unkif true (the default), NaN is coerced to ? (unknown); otherwise it is coerced to . (inapplicable).
Returns
An unquoted CifValue holding the formatted number.

◆ cif_value() [5/5]

template<class T, std::enable_if_t< std::is_integral_v< T > &&!std::is_same_v< T, bool >, int > = 0>
internal::CifValue nuri::cif_value ( T value,
int width = 0 )

Create an integral CIF value.

Parameters
valuethe integer to store.
widthif positive, zero-pad the number to at least this many digits.
Returns
An unquoted CifValue holding the formatted integer.

◆ clamp() [1/2]

template<class T, class L, class H, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< T >, internal::remove_cvref_t< L > > &&std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< H > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< T > > &&std::is_lvalue_reference_v< T > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< H >, int > = 0>
const std::remove_reference_t< T > & nuri::clamp ( T && v,
L && l,
H && h )
constexpr

◆ clamp() [2/2]

template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
T nuri::clamp ( T v,
T l,
T h )
constexpr

◆ clamp_hyb()

constants::Hybridization nuri::clamp_hyb ( int hyb)
inline

◆ clamp_ord()

constants::BondOrder nuri::clamp_ord ( int ord)
inline

◆ clear_vertex()

template<class NT, class ET>
void nuri::clear_vertex ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
Graph< NT, ET > & g )

◆ connected_components() [1/2]

template<class NT, class ET>
absl::flat_hash_set< int > nuri::connected_components ( const Graph< NT, ET > & g,
int begin )

Find connected components of a graph starting from a node.

Template Parameters
NTThe type of the node data
ETThe type of the edge data
Parameters
gThe graph to find connected components of
beginThe node to start from
Returns
A set of node ids that are in the same connected component as the starting node.
Note
Time complexity: \(O(V + E)\).

◆ connected_components() [2/2]

template<class NT, class ET>
absl::flat_hash_set< int > nuri::connected_components ( const Graph< NT, ET > & g,
int begin,
int exclude )

Find connected components of a graph starting from a node, excluding an edge between the starting node and the excluded node (if present).

Template Parameters
NTThe type of the node data
ETThe type of the edge data
Parameters
gThe graph to find connected components of
beginThe node to start from
excludeThe node to exclude
Returns
A set of node ids that are in the same connected component as the starting node, when the edge between the starting node and the excluded node is removed. If the excluded node is in the same connected component as the starting node even after removing the edge, an empty set is returned.
Note
Time complexity: \(O(V + E)\).

◆ cos_angle() [1/2]

double nuri::cos_angle ( const Vector3d & o,
const Vector3d & a,
const Vector3d & b )
inline

Calculate the cosine of the angle between two vectors.

Parameters
oThe origin of the angle.
aThe first point.
bThe second point.
Returns
The cosine of the angle between the two vectors o -> a and o -> b.

◆ cos_angle() [2/2]

double nuri::cos_angle ( const Vector3d & oa,
const Vector3d & ob )
inline

Calculate the cosine of the angle between two vectors.

Parameters
oaThe first vector.
obThe second vector.
Returns
The cosine of the angle between the two vectors.

◆ cos_dihedral() [1/2]

double nuri::cos_dihedral ( const Vector3d & a,
const Vector3d & b,
const Vector3d & c,
const Vector3d & d )
inline

Calculate A -> - B -> C -> D dihedral angle.

Parameters
aThe position of point A.
bThe position of point B.
cThe position of point C.
dThe position of point D.
Returns
The cosine of the dihedral angle.

See https://stackoverflow.com/a/34245697 for the implementation(s) in python.

◆ cos_dihedral() [2/2]

double nuri::cos_dihedral ( const Vector3d & axis,
Vector3d v,
Vector3d w )
inline

Calculate A - (v) - B - (axis) - C - (w) - D dihedral angle along the axis. Axis should be normalized.

Parameters
axisThe normalized axis of the dihedral angle.
vThe vector from A to B.
wThe vector from C to D.
Returns
The cosine of the dihedral angle.

See https://stackoverflow.com/a/34245697 for the implementation(s) in python.

◆ count_heavy()

int nuri::count_heavy ( Molecule::Atom atom)
extern

Get the number of heavy atoms bonded to an atom.

Parameters
atomAn atom.
Returns
Number of heavy atoms bonded to the atom.
Note
Dummy atom counts as a heavy atom.

◆ count_hydrogens()

int nuri::count_hydrogens ( Molecule::Atom atom)
extern

Count the number of hydrogens of the atom.

Parameters
atomAn atom.
Returns
Number of hydrogens of the atom (including implicit hydrogens)
Note
If the atom index is out of range, the behavior is undefined.

◆ deg2rad() [1/2]

template<class DT, std::enable_if_t< std::is_integral_v< DT >, int > = 0>
double nuri::deg2rad ( DT deg)
constexpr

◆ deg2rad() [2/2]

template<class DT, std::enable_if_t< std::is_floating_point_v< DT >, int > = 0>
DT nuri::deg2rad ( DT deg)
constexpr

◆ degree() [1/2]

template<class NT, class ET>
auto nuri::degree ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

◆ degree() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::degree ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

◆ edges() [1/2]

template<class NT, class ET>
auto nuri::edges ( const Graph< NT, ET > & g)

concept requirements

◆ edges() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::edges ( const Subgraph< NT, ET, is_const > & g)

concept requirements

◆ effective_element() [1/2]

const Element * nuri::effective_element ( const AtomData & data)
inline

Get "effective" element of the atom.

Parameters
dataData of the atom.
Returns
"Effective" element of the atom: the returned element has atomic number of (original atomic number) - (formal charge). If the resulting atomic number is out of range, returns nullptr.

◆ effective_element() [2/2]

const Element * nuri::effective_element ( Molecule::Atom atom)
inline

Get "effective" element of the atom.

Parameters
atomAn atom.
Returns
"Effective" element of the atom: the returned element has atomic number of (original atomic number) - (formal charge). If the resulting atomic number is out of range, returns nullptr.

◆ embed_distances_3d()

bool nuri::embed_distances_3d ( Eigen::Ref< Matrix3Xd > pts,
MatrixXd & dsqs )
extern

A routine for converting squared pairwise distances to cartesian coordinates.

Parameters
ptsDestination to which save the generated coordinates (3d).
dsqsThe squared distances between points. Will be modified in-place.
Returns
Whether the embedding was successful.
Note
The squared distance matrix must be a N x N symmetric pairwise squared-distance matrix, where N is the number of points.

This implementation is based on the following reference: TF Havel, ID Kuntz, and GM Crippen. Bull. Math. Biol. 1983, 45 (5), 665-720. DOI:10.1007/BF02460044

◆ embed_distances_4d()

bool nuri::embed_distances_4d ( Eigen::Ref< Matrix4Xd > pts,
MatrixXd & dsqs )
extern

A routine for converting squared pairwise distances to cartesian coordinates.

Parameters
ptsDestination to which save the generated coordinates (4d).
dsqsThe squared distances between points. Will be modified in-place.
Returns
Whether the embedding was successful.
Note
The squared distance matrix must be a N x N symmetric pairwise squared-distance matrix, where N is the number of points.

This implementation is based on the following reference: TF Havel, ID Kuntz, and GM Crippen. Bull. Math. Biol. 1983, 45 (5), 665-720. DOI:10.1007/BF02460044

◆ erase()

template<class T, class Alloc, class U>
std::vector< T, Alloc >::size_type nuri::erase ( std::vector< T, Alloc > & c,
const U & value )

◆ erase_first()

template<class T, class Alloc, class Pred>
std::vector< T, Alloc >::iterator nuri::erase_first ( std::vector< T, Alloc > & c,
Pred && pred )

◆ erase_if()

template<class T, class Alloc, class Pred>
std::vector< T, Alloc >::size_type nuri::erase_if ( std::vector< T, Alloc > & c,
Pred && pred )

◆ find_all_rings() [1/3]

std::pair< Rings, bool > nuri::find_all_rings ( const ConstSubstructure & sub,
int max_size = -1 )
extern

Find all elementary cycles in the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A pair of (all elementary cycles, success). If success is false, the vector is in an unspecified state. This will fail if and only if any atom is a member of more than 100 elementary cycles.

This is based on the algorithm described in the following paper: Hanser, Th. et al. J. Chem. Inf. Comput. Sci. 1996, 36 (6), 1146-1152. DOI: 10.1021/ci960322f

The time complexity of this function is inherently exponential, but it is expected to run in a reasonable time ( \(\sim\mathcal{O}(V^2)\)) for most molecules in practice.

◆ find_all_rings() [2/3]

std::pair< Rings, bool > nuri::find_all_rings ( const Molecule & mol,
int max_size = -1 )
extern

Find all elementary cycles in the molecular graph.

Parameters
molA molecule.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A pair of (all elementary cycles, success). If success is false, the vector is in an unspecified state. This will fail if and only if any atom is a member of more than 100 elementary cycles.

This is based on the algorithm described in the following paper: Hanser, Th. et al. J. Chem. Inf. Comput. Sci. 1996, 36 (6), 1146-1152. DOI: 10.1021/ci960322f

The time complexity of this function is inherently exponential, but it is expected to run in a reasonable time ( \(\sim\mathcal{O}(V^2)\)) for most molecules in practice.

◆ find_all_rings() [3/3]

std::pair< Rings, bool > nuri::find_all_rings ( const Substructure & sub,
int max_size = -1 )
extern

Find all elementary cycles in the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A pair of (all elementary cycles, success). If success is false, the vector is in an unspecified state. This will fail if and only if any atom is a member of more than 100 elementary cycles.

This is based on the algorithm described in the following paper: Hanser, Th. et al. J. Chem. Inf. Comput. Sci. 1996, 36 (6), 1146-1152. DOI: 10.1021/ci960322f

The time complexity of this function is inherently exponential, but it is expected to run in a reasonable time ( \(\sim\mathcal{O}(V^2)\)) for most molecules in practice.

◆ find_relevant_rings() [1/3]

Rings nuri::find_relevant_rings ( const ConstSubstructure & sub,
int max_size = -1 )
inline

Find union of the all SSSRs in the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
Union of the all SSSRs in the substructure.
See also
find_sssr(), nuri::RingSetsFinder::find_relevant_rings()

This is a convenience wrapper of the nuri::RingSetsFinder::find_relevant_rings() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ find_relevant_rings() [2/3]

Rings nuri::find_relevant_rings ( const Molecule & mol,
int max_size = -1 )
inline

Find union of the all SSSRs in the molecular graph.

Parameters
molA molecule.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
Union of the all SSSRs in the molecular graph.
See also
find_sssr(), nuri::RingSetsFinder::find_relevant_rings()

This is a convenience wrapper of the nuri::RingSetsFinder::find_relevant_rings() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ find_relevant_rings() [3/3]

Rings nuri::find_relevant_rings ( const Substructure & sub,
int max_size = -1 )
inline

Find union of the all SSSRs in the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
Union of the all SSSRs in the substructure.
See also
find_sssr(), nuri::RingSetsFinder::find_relevant_rings()

This is a convenience wrapper of the nuri::RingSetsFinder::find_relevant_rings() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ find_sssr() [1/3]

Rings nuri::find_sssr ( const ConstSubstructure & sub,
int max_size = -1 )
inline

Find a smallest set of smallest rings (SSSR) of the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A smallest set of smallest rings (SSSR) of the substructure.
See also
find_relevant_rings(), nuri::RingSetsFinder::find_sssr()
Note
This function does not guarantee that the returned set is unique, nor that the result is reproducible even for the same molecule.

This is a convenience wrapper of the nuri::RingSetsFinder::find_sssr() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ find_sssr() [2/3]

Rings nuri::find_sssr ( const Molecule & mol,
int max_size = -1 )
inline

Find a smallest set of smallest rings (SSSR) of the molecular graph.

Parameters
molA molecule.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A smallest set of smallest rings (SSSR) of the molecular graph.
See also
find_relevant_rings(), nuri::RingSetsFinder::find_sssr()
Note
This function does not guarantee that the returned set is unique, nor that the result is reproducible even for the same molecule.

This is a convenience wrapper of the nuri::RingSetsFinder::find_sssr() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ find_sssr() [3/3]

Rings nuri::find_sssr ( const Substructure & sub,
int max_size = -1 )
inline

Find a smallest set of smallest rings (SSSR) of the substructure.

Parameters
subA substructure.
max_sizeMaximum size of the rings to be found. If negative, all rings are found.
Returns
A smallest set of smallest rings (SSSR) of the substructure.
See also
find_relevant_rings(), nuri::RingSetsFinder::find_sssr()
Note
This function does not guarantee that the returned set is unique, nor that the result is reproducible even for the same molecule.

This is a convenience wrapper of the nuri::RingSetsFinder::find_sssr() member function.

Note
If both relevant rings and SSSR are needed, it is recommended to use the nuri::RingSetsFinder class instead of the free functions.

◆ fit_plane()

template<class MatrixLike>
Vector4d nuri::fit_plane ( const MatrixLike & pts,
bool normalize = true )

Perform a least-squares fit of a plane to a set of points.

Template Parameters
MatrixLikeThe type of the matrix-like object.
Parameters
ptsThe matrix-like object containing the points. Should be in a N x 3 shape, where N >= 3.
normalizeWhether to normalize the normal vector. Defaults to true.
Returns
The best-fit plane defined by a 4-vector (a, b, c, d), such that ax + by + cz + d = 0.

◆ fragments()

std::vector< std::vector< int > > nuri::fragments ( const Molecule & mol)
extern

Get fragments of the molecule.

Parameters
molThe molecule.
Returns
A list of fragments. Each fragment is a list of atom indices.

◆ galign()

std::vector< GAlignResult > nuri::galign ( const Molecule & mol,
const Matrix3Xd & seed,
const GARigidMolInfo & templ,
bool flexible = true,
int max_conf = 1,
const GASamplingArgs & sampling = {},
const GAMinimizeArgs & minimize = {} )
extern

◆ generate_coords() [1/2]

bool nuri::generate_coords ( const Molecule & mol,
Matrix3Xd & conf,
int max_trial = 10 )
extern

Generate 3D coordinates for the molecule.

Parameters
molThe molecule to generate coordinates.
confA matrix to store the generated coordinates.
max_trialThe maximum number of trials to generate trial distances.
Returns
Whether the coordinates is successfully generated.

◆ generate_coords() [2/2]

bool nuri::generate_coords ( Molecule & mol,
int max_trial = 10 )
inline

Generate 3D coordinates for the molecule.

Parameters
molThe molecule to generate coordinates.
max_trialThe maximum number of trials to generate trial distances.
Returns
Whether the coordinates is successfully generated.
Note
The generated coordinates is stored as the last conformer of the molecule, if and only if the coordinates is successfully generated. The molecule is not modified otherwise.

◆ get() [1/8]

template<class NT, class ET>
auto nuri::get ( boost::edge_index_t ,
const Graph< NT, ET > &  )

◆ get() [2/8]

template<class NT, class ET>
auto nuri::get ( boost::edge_index_t ,
const Graph< NT, ET > & ,
typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e )

◆ get() [3/8]

template<class NT, class ET, bool is_const>
auto nuri::get ( boost::edge_index_t ,
const Subgraph< NT, ET, is_const > &  )

◆ get() [4/8]

template<class NT, class ET, bool is_const>
auto nuri::get ( boost::edge_index_t ,
const Subgraph< NT, ET, is_const > & ,
typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e )

◆ get() [5/8]

template<class NT, class ET>
auto nuri::get ( boost::vertex_index_t ,
const Graph< NT, ET > &  )

concept requirements (partial)

◆ get() [6/8]

template<class NT, class ET>
auto nuri::get ( boost::vertex_index_t ,
const Graph< NT, ET > & ,
typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v )

◆ get() [7/8]

template<class NT, class ET, bool is_const>
auto nuri::get ( boost::vertex_index_t ,
const Subgraph< NT, ET, is_const > &  )

concept requirements (partial)

◆ get() [8/8]

template<class NT, class ET, bool is_const>
auto nuri::get ( boost::vertex_index_t ,
const Subgraph< NT, ET, is_const > & ,
typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v )

◆ guess_all_types()

ABSL_MUST_USE_RESULT bool nuri::guess_all_types ( Molecule & mol,
int conf = 0 )
extern

Guess types of atoms and bonds, and number of hydrogens of a molecule.

Parameters
molThe molecule to be guessed.
confThe index of the conformation used for guessing.
Returns
true if the guessing is successful.
Note
The behavior is undefined if the conformer index is out of range.

This function assumes all connectivity information is present and correct, and all atom/bond types and implicit hydrogen counts are incorrect. The information present in the molecule could be overwritten by this function.

◆ guess_connectivity()

void nuri::guess_connectivity ( MoleculeMutator & mut,
int conf = 0,
double threshold = kDefaultThreshold )
extern

Guess connectivity information of a molecule.

Parameters
mutThe mutator of the molecule to be guessed.
confThe index of the conformation used for guessing.
thresholdThe threshold for guessing bonds.
Note
The behavior is undefined if the conformer index is out of range.

This function assumes all connectivity information is missing. The information present in the molecule could be overwritten by this function.

◆ guess_everything()

ABSL_MUST_USE_RESULT bool nuri::guess_everything ( MoleculeMutator & mut,
int conf = 0,
double threshold = kDefaultThreshold )
extern

Guess bonds, types of atoms, and number of hydrogens of a molecule.

Parameters
mutThe mutator of the molecule to be guessed.
confThe index of the conformation used for guessing.
thresholdThe threshold for guessing bonds.
Returns
true if the guessing is successful.
Note
The behavior is undefined if the conformer index is out of range.

This function find extra bonds that are not in the input molecule, and add them to the molecule. The information present in the molecule will be preserved, except the newly added bonds and atoms that are connected to them.

If connectivity information is already present and is correct, consider using guess_all_types().

◆ guess_fcharge_2d()

void nuri::guess_fcharge_2d ( Molecule & mol)
extern

Guess formal charges of a molecule.

Parameters
molThe molecule to be guessed.
Precondition
The molecule must have correct number of hydrogens.

This function assumses that all atoms >= group 15 satisfy octet rule, and <= group 13 has no non-bonding electrons. Skip charge calculation on group 3-12 & 14 atoms, dummy atom, and atoms with explicit formal charge.

◆ guess_fcharge_hydrogens_2d()

void nuri::guess_fcharge_hydrogens_2d ( Molecule & mol)
extern

Guess formal charges and implicit hydrogens of a molecule.

Parameters
molThe molecule to be guessed.

This function is equivalent to calling guess_fcharge() and guess_hydrogens() in sequence.

◆ guess_hydrogens_2d()

void nuri::guess_hydrogens_2d ( Molecule & mol)
extern

Guess hydrogens of a molecule.

Parameters
molThe molecule to be guessed.
Precondition
The molecule must have correct formal charges.

Assumses that all (appropriate) atoms satisfy octet rule. Add hydrogens only to the main group elements.

◆ in_degree() [1/2]

template<class NT, class ET>
auto nuri::in_degree ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

◆ in_degree() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::in_degree ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

◆ in_edges() [1/2]

template<class NT, class ET>
auto nuri::in_edges ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

concept requirements

◆ in_edges() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::in_edges ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

concept requirements

◆ kabsch()

std::pair< Isometry3d, double > nuri::kabsch ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ,
AlignMode mode = AlignMode::kBoth,
bool reflection = false )
extern

An implementation of the Kabsch algorithm for aligning two sets of points. This algorithm is based on the implementation in TM-align.

Parameters
queryThe query points.
templThe template points.
modeSelects the return value. Defaults to AlignMode::kBoth. Note that even if AlignMode::kXformOnly is selected, the MSD value will report a negative value if the calculation fails.
reflectionWhether to allow reflection. Defaults to false.
Returns
A pair of (transformation matrix, MSD). When this function fails, MSD is set to a negative value (-1), and the state of the transformation matrix is left unspecified. This never fails when mode is AlignMode::kMsdOnly.

This implementation has improved stability compared to the TM-align code by integrating a slightly modified version of the A Robust Eigensover for 3 x 3 Symmetric Matrices algorithm proposed by D Eberly (see more details in the following references) and by improving the pivot selection strategy in the B matrix calculation step.

References:

The following is the full license text for the TM-align code:

TM-align: sequence-independent structure alignment of monomer proteins by
TM-score superposition. Please report issues to yangzhanglab@umich.edu
References to cite:
Y Zhang, J Skolnick. Nucl Acids Res 33, 2302-9 (2005)
DISCLAIMER:
Permission to use, copy, modify, and distribute the Software for any
purpose, with or without fee, is hereby granted, provided that the
notices on the head, the reference information, and this copyright
notice appear in all copies or substantial portions of the Software.
It is provided "as is" without express or implied warranty.

This is the copyright text of D Eberly's algorithm:

David Eberly, Geometric Tools, Redmond WA 98052
Copyright (c) 1998-2024
Distributed under the Boost Software License, Version 1.0.
https://www.boost.org/LICENSE_1_0.txt
https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
Version: 6.0.2023.08.08

◆ l_bfgs()

template<class FuncGrad>
LbfgsResult nuri::l_bfgs ( FuncGrad && fg,
MutRef< ArrayXd > x,
const int m = 10,
const double factr = 1e+7,
const double pgtol = 1e-5,
const int maxiter = 15000,
const int maxls = 20 )

Minimize a function using L-BFGS algorithm.

Template Parameters
FuncGradFunction object that computes the function value and gradient. Function value should be returned and gradient should be updated in the input gradient vector.
Parameters
fgFunction object.
xInitial guess. Will be modified in-place.
mThe maximum number of variable metric corrections used to define the limited memory matrix.
factrStop when function value changes by less than this factor times the machine precision.
pgtolStop when the projected gradient is less than this value.
maxiterMaximum number of iterations.
maxlsMaximum number of line search steps.
Returns
A struct with the result code, number of iterations, final function value, and final gradient.
Note
The input x will be modified in-place.
See also
LBfgs

References:

  • RH Byrd, P Lu, J Nocedal and C Zhu. SIAM J. Sci. Stat. Comput. 1995, 16 (5), 1190-1208. DOI:10.1137/0916069
  • C Zhu, RH Byrd, J Nocedal. ACM Trans. Math. Softw. 1997, 23 (4), 550-560. DOI:10.1145/279232.279236
  • JL Morales, J Nocedal. ACM Trans. Math. Softw. 2011, 38 (1), 7. DOI:10.1145/2049662.2049669

This implementation is based on the C implementation of L-BFGS-B in the SciPy library, which is a translation of the original Fortran code by Ciyou Zhu, Richard Byrd, and Jorge Noceda. Both are released under the BSD 3-Clause License and the original license is included below.

Copyright (c) 2011 Ciyou Zhu, Richard Byrd, Jorge Nocedal and Jose Luis
Morales.
Copyright (c) 2001-2002 Enthought, Inc. 2003-2024, SciPy Developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ l_bfgs_b()

template<class FuncGrad>
LbfgsResult nuri::l_bfgs_b ( FuncGrad && fg,
MutRef< ArrayXd > x,
const ArrayXi & nbd,
const Array2Xd & bounds,
const int m = 10,
const double factr = 1e+7,
const double pgtol = 1e-5,
const int maxiter = 15000,
const int maxls = 20 )

Minimize a function using L-BFGS-B algorithm.

Template Parameters
FuncGradFunction object that computes the function value and gradient. Function value should be returned and gradient should be updated in the input gradient vector.
Parameters
fgFunction object.
xInitial guess. Will be modified in-place.
nbdBound type for each variable. 0x1 if has lower bound, 0x2 if has upper bound, 0x1 | 0x2 if both.
boundsBounds for each variable. First row is lower bound and second row is upper bound.
mThe maximum number of variable metric corrections used to define the limited memory matrix.
factrStop when function value changes by less than this factor times the machine precision.
pgtolStop when the projected gradient is less than this value.
maxiterMaximum number of iterations.
maxlsMaximum number of line search steps.
Returns
A struct with the result code, number of iterations, final function value, and final gradient.
Note
The input x will be modified in-place.
See also
LBfgs

References:

  • RH Byrd, P Lu, J Nocedal and C Zhu. SIAM J. Sci. Stat. Comput. 1995, 16 (5), 1190-1208. DOI:10.1137/0916069
  • C Zhu, RH Byrd, J Nocedal. ACM Trans. Math. Softw. 1997, 23 (4), 550-560. DOI:10.1145/279232.279236
  • JL Morales, J Nocedal. ACM Trans. Math. Softw. 2011, 38 (1), 7. DOI:10.1145/2049662.2049669

This implementation is based on the C implementation of L-BFGS-B in the SciPy library, which is a translation of the original Fortran code by Ciyou Zhu, Richard Byrd, and Jorge Noceda. Both are released under the BSD 3-Clause License and the original license is included below.

Copyright (c) 2011 Ciyou Zhu, Richard Byrd, Jorge Nocedal and Jose Luis
Morales.
Copyright (c) 2001-2002 Enthought, Inc. 2003-2024, SciPy Developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ make_subgraph() [1/2]

template<class GT>
SubgraphOf< GT > nuri::make_subgraph ( GT && graph)

Make an empty subgraph from a graph.

Template Parameters
GTThe type of the graph
Parameters
graphThe graph to make a subgraph of
Returns
A subgraph of the graph.

◆ make_subgraph() [2/2]

template<class GT>
SubgraphOf< GT > nuri::make_subgraph ( GT && graph,
internal::IndexSet && nodes,
internal::IndexSet && edges )

Make a subgraph from list of nodes and edges.

Template Parameters
GTThe type of the graph
Parameters
graphThe graph to make a subgraph of
nodesThe nodes to include in the subgraph
edgesThe edges to include in the subgraph
Returns
A subgraph of the graph. All nodes connected by the edges will be included in the subgraph even if they are not explicitly listed in nodes.
Note
Time complexity: same as Subgraph::from_indices().

◆ make_vf2pp()

template<IsoMapType kMt, class GT, class GU, class AL1, class AL2>
VF2pp< kMt, GT, GU > nuri::make_vf2pp ( const GT & query,
const GU & target,
AL1 && qlbl,
AL2 && tlbl )

Prepare VF2++ algorithm.

Parameters
queryThe query graph ("needle").
targetThe target graph ("haystack").
qlblThe query node labels.
tlblThe target node labels.
Returns
The constructed VF2++ algorithm object.
Note
Both graphs must not be empty, the query graph must be smaller or equal to the target graph, and each node labels must not contain non-negative labels and have same size as the corresponding graph. The behavior is undefined if any of the conditions are not met.
See also
VF2pp::VF2pp()

◆ make_zipped_iterator()

template<class... Iters>
auto nuri::make_zipped_iterator ( Iters... iters)
constexpr

◆ match_maker()

MmResult nuri::match_maker ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ,
double cutoff = 2.0,
double global_ratio = 0.1,
double viol_ratio = 0.5 )
extern

Match-Maker algorithm for structural alignment of two 3D point clouds.

Iteratively estimates a rigid transform by least-squares fitting and rejects outliers ("violations") whose post-fit pairwise distance exceeds a cutoff. In each iteration, the number of points rejected is capped by both ratio limits (the effective cap is the smaller of the two). The process repeats until no violations remain.

Parameters
queryThe query points.
templThe template points.
cutoffDistance cutoff in angstroms. A point pair is counted as a violation if its post-fit distance exceeds this threshold.
global_ratioMaximum fraction of currently considered aligned points that may be excluded as outliers in a single iteration.
viol_ratioMaximum fraction of currently violating points that may be excluded in a single iteration.
Returns
Alignment result: a rigid-body transform that maps query into template coordinates, the indices of inlier points, and the mean squared deviation (msd) of inliers after alignment. If least-squares fitting fails, msd is set to a negative value and the remaining fields are in a valid but unspecified state.
Note
The two point clouds must have the same number of points, and are assumed to be in correspondence by index.

◆ max() [1/2]

template<class L, class R, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
const std::remove_reference_t< L > & nuri::max ( L && a,
R && b )
constexpr

◆ max() [2/2]

template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
T nuri::max ( T a,
T b )
constexpr

◆ min() [1/2]

template<class L, class R, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
const std::remove_reference_t< L > & nuri::min ( L && a,
R && b )
constexpr

◆ min() [2/2]

template<class T, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
T nuri::min ( T a,
T b )
constexpr

◆ minmax() [1/2]

template<class L, class R, class Comp = std::less<>, std::enable_if_t< std::is_same_v< internal::remove_cvref_t< L >, internal::remove_cvref_t< R > > &&!std::is_trivially_copyable_v< internal::remove_cvref_t< L > > &&std::is_lvalue_reference_v< L > &&std::is_lvalue_reference_v< R >, int > = 0>
std::pair< const std::remove_reference_t< L > &, const std::remove_reference_t< L > & > nuri::minmax ( L && a,
R && b,
Comp && comp = {} )
constexpr

◆ minmax() [2/2]

template<class T, class Comp = std::less<>, std::enable_if_t< std::is_trivially_copyable_v< T >, int > = 0>
std::pair< T, T > nuri::minmax ( T a,
T b,
Comp && comp = {} )
constexpr

◆ mmcif_load_frame()

std::vector< Molecule > nuri::mmcif_load_frame ( const internal::CifFrame & frame)

◆ mmcif_read_next_block()

std::vector< Molecule > nuri::mmcif_read_next_block ( CifParser & parser)

◆ msd()

template<class ML1, class ML2>
auto nuri::msd ( const ML1 & a,
const ML2 & b )

◆ nelder_mead()

template<class Func>
NMResult nuri::nelder_mead ( Func && f,
MutRef< ArrayXXd > data,
int maxiter = -1,
const double ftol = 1e-6,
const double alpha = 1,
const double gamma = 2,
const double rho = 0.5,
const double sigma = 0.5 )
inline

Minimize a function using Nelder-Mead simplex algorithm.

Template Parameters
FuncFunction object that computes the function value. The function value should be returned.
Parameters
fFunction object.
dataInitial simplex data. When the problem is N-dimensional, the data should be (N + 1, N + 1) matrix, where the first N rows form the N + 1 simplex vertices of dimension N. The last row need not be initialized, but will be populated with the function value of each vertex if the optimization is successful.
maxiterMaximum number of iterations. If negative or zero, it will be set to N * 200, where N is the number of dimensions.
ftolTolerance for the absolute change in the function value.
alphaReflection coefficient. Must be > 0.
gammaExpansion coefficient. Must be > 1.
rhoContraction coefficient. Must be in range (0, 1).
sigmaShrink coefficient. Must be in range (0, 1).
Returns
The result of the optimization, including the result code and the index of the best vertex.
Note
The data matrix will be modified in-place, and the last row will be populated with the function values of each vertex.
See also
NelderMead

References:

◆ nm_prepare_simplex()

ArrayXXd nuri::nm_prepare_simplex ( ConstRef< ArrayXd > x0,
double eps = 1e-6 )
extern

Prepare the initial simplex for Nelder-Mead algorithm.

Parameters
x0Initial guess of size N.
epsMax absolute value to consider an element of x0 as zero.
Returns
A (N + 1, N + 1) matrix, where the first N rows form the N + 1 simplex vertices of dimension N. The last row is left uninitialized. The first column corresponds to the unmodified x0, and the remaining columns will form the initial guesses.

This function will follow the Matlab implementation of the simplex initialization. See G Fuchang and H Lixing [1] for details.

◆ nonbonding_electrons()

int nuri::nonbonding_electrons ( Molecule::Atom atom)
inline

Get the predicted non-bonding electron count of the atom.

Parameters
atomAn atom.
Returns
Predicted non-bonding electron count of the atom.
Note
This function might return a negative value if the atom is not chemically valid.

◆ num_edges() [1/2]

template<class NT, class ET>
auto nuri::num_edges ( const Graph< NT, ET > & g)

◆ num_edges() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::num_edges ( const Subgraph< NT, ET, is_const > & g)

◆ num_vertices() [1/2]

template<class NT, class ET>
auto nuri::num_vertices ( const Graph< NT, ET > & g)

◆ num_vertices() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::num_vertices ( const Subgraph< NT, ET, is_const > & g)

◆ operator!=() [1/2]

bool nuri::operator!= ( const Element & lhs,
const Element & rhs )
constexprnoexcept

◆ operator!=() [2/2]

bool nuri::operator!= ( const Isotope & lhs,
const Isotope & rhs )
constexprnoexcept

◆ operator<<()

std::ostream & nuri::operator<< ( std::ostream & os,
const PDBResidueId & id )
extern

◆ operator==() [1/4]

bool nuri::operator== ( const AtomData & lhs,
const AtomData & rhs )
inlinenoexcept

◆ operator==() [2/4]

bool nuri::operator== ( const Element & lhs,
const Element & rhs )
constexprnoexcept

◆ operator==() [3/4]

bool nuri::operator== ( const Isotope & lhs,
const Isotope & rhs )
constexprnoexcept

◆ operator==() [4/4]

bool nuri::operator== ( PDBResidueId lhs,
PDBResidueId rhs )
inline

◆ operator>>()

template<class Stream>
Stream & nuri::operator>> ( Stream & stream,
Molecule & mol )

◆ out_degree() [1/2]

template<class NT, class ET>
auto nuri::out_degree ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

◆ out_degree() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::out_degree ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

◆ out_edges() [1/2]

template<class NT, class ET>
auto nuri::out_edges ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
const Graph< NT, ET > & g )

requirements for nuri::Graph

concept requirements

◆ out_edges() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::out_edges ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor v,
const Subgraph< NT, ET, is_const > & g )

requirements for nuri::Graph

concept requirements

◆ pdist() [1/2]

template<class MatrixLike, class ArrayLike>
void nuri::pdist ( ArrayLike && dist,
const MatrixLike & m )

◆ pdist() [2/2]

template<class MatrixLike>
auto nuri::pdist ( const MatrixLike & m)

◆ pdistsq() [1/2]

template<class MatrixLike, class ArrayLike>
void nuri::pdistsq ( ArrayLike && distsq,
const MatrixLike & m )

◆ pdistsq() [2/2]

template<class MatrixLike>
auto nuri::pdistsq ( const MatrixLike & m)

◆ qcp()

std::pair< Isometry3d, double > nuri::qcp ( const Eigen::Ref< const Matrix3Xd > & query,
const Eigen::Ref< const Matrix3Xd > & templ,
AlignMode mode = AlignMode::kBoth,
bool reflection = false,
double evalprec = 1e-11,
double evecprec = 1e-6,
int maxiter = 50 )
extern

Perform quaternion-based superposition of two sets of points.

Parameters
queryThe query points.
templThe template points.
modeSelects the return value. Defaults to AlignMode::kBoth. Note that even if AlignMode::kXformOnly is selected, the MSD value will report a negative value if the calculation fails.
reflectionWhether to allow reflection. Defaults to false.
evalprecThe precision of eigenvalue calculation. Defaults to 1e-11.
evecprecThe precision of eigenvector calculation. Defaults to 1e-6.
maxiterThe maximum number of Newton-Raphson iterations. Defaults to 50.
Returns
A pair of (transformation matrix, MSD). When this function fails, MSD is set to a negative value (-1), and the state of the transformation matrix is left unspecified. Unlike kabsch(), this function may fail even when mode is AlignMode::kMsdOnly due to the iterative root-finding process. Any sufficiently large value of maxiter will guarantee convergence.

This implementation is based on the reference implementation by P Liu and DL Theobald, but modified for better stability and error handling. Also, an option to allow reflection is added based on observations of EA Coutsias, C Seok, and KA Dill (see more details in the following references).

References:

  • EA Coutsias, C Seok, and KA Dill. J. Comput. Chem. 2004, 25 (15), 1849-1857. DOI:10.1002/jcc.20110
  • P Liu, DK Agrafiotis, and DL Theobald. J. Comput. Chem. 2011, 32 (1), 185-186. DOI:10.1002/jcc.21607
  • P Liu, DK Agrafiotis, and DL Theobald. J. Comput. Chem. 2010, 31 (7), 1561-1563. DOI:10.1002/jcc.21439
  • DL Theobald. Acta Crystallogr. A 2005, 61 (4), 478-480. DOI:10.1107/S0108767305015266

The following is the full license text for the reference implementation:

Copyright (c) 2009-2016 Pu Liu and Douglas L. Theobald
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ qcp_inplace()

std::pair< Isometry3d, double > nuri::qcp_inplace ( MutRef< Matrix3Xd > query,
MutRef< Matrix3Xd > templ,
AlignMode mode = AlignMode::kBoth,
bool reflection = false,
double evalprec = 1e-11,
double evecprec = 1e-6,
int maxiter = 50 )
extern

In-place version of qcp().

Parameters
queryThe query points. On return, the points will be centered at the origin (unless only single point is given).
templThe template points. On return, the points will be centered at the origin (unless only single point is given).
modeSelects the return value. Defaults to AlignMode::kBoth. Note that even if AlignMode::kXformOnly is selected, the MSD value will report a negative value if the calculation fails.
reflectionWhether to allow reflection. Defaults to false.
evalprecThe precision of eigenvalue calculation. Defaults to 1e-11.
evecprecThe precision of eigenvector calculation. Defaults to 1e-6.
maxiterThe maximum number of Newton-Raphson iterations. Defaults to 50.
Returns
A pair of (transformation matrix, MSD). When this function fails, MSD is set to a negative value (-1), and the state of the transformation matrix is left unspecified. Unlike kabsch(), this function may fail even when mode is AlignMode::kMsdOnly due to the iterative root-finding process. Any sufficiently large value of maxiter will guarantee convergence.

This implementation is based on the reference implementation by P Liu and DL Theobald, but modified for better stability and error handling. Also, an option to allow reflection is added based on observations of EA Coutsias, C Seok, and KA Dill (see more details in the following references).

References:

  • EA Coutsias, C Seok, and KA Dill. J. Comput. Chem. 2004, 25 (15), 1849-1857. DOI:10.1002/jcc.20110
  • P Liu, DK Agrafiotis, and DL Theobald. J. Comput. Chem. 2011, 32 (1), 185-186. DOI:10.1002/jcc.21607
  • P Liu, DK Agrafiotis, and DL Theobald. J. Comput. Chem. 2010, 31 (7), 1561-1563. DOI:10.1002/jcc.21439
  • DL Theobald. Acta Crystallogr. A 2005, 61 (4), 478-480. DOI:10.1107/S0108767305015266

The following is the full license text for the reference implementation:

Copyright (c) 2009-2016 Pu Liu and Douglas L. Theobald
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ rad2deg() [1/2]

template<class DT, std::enable_if_t< std::is_integral_v< DT >, int > = 0>
double nuri::rad2deg ( DT rad)
constexpr

◆ rad2deg() [2/2]

template<class DT, std::enable_if_t< std::is_floating_point_v< DT >, int > = 0>
DT nuri::rad2deg ( DT rad)
constexpr

◆ read_mol2()

Molecule nuri::read_mol2 ( const std::vector< std::string > & mol2)
extern

Read a single Mol2 string and return a molecule.

Parameters
mol2the Mol2 string to read.
Returns
A molecule. On failure, the returned molecule is empty.

◆ read_pdb()

Molecule nuri::read_pdb ( const std::vector< std::string > & pdb)
extern

Read a single PDB string and return a molecule.

Parameters
pdbthe PDB string to read.
Returns
A molecule. On failure, the returned molecule is empty.

◆ read_pdb_model()

PDBModel nuri::read_pdb_model ( const std::vector< std::string > & pdb)
extern

◆ read_sdf()

Molecule nuri::read_sdf ( const std::vector< std::string > & sdf)
extern

Read a single sdf string and return a molecule.

Parameters
sdfthe sdf string to read.
Returns
A molecule. On failure, the returned molecule is empty.

◆ read_smiles()

Molecule nuri::read_smiles ( const std::vector< std::string > & smi_block)
extern

Read a single SMILES string and return a molecule.

Parameters
smi_blockthe SMILES block to read. Only the first string is used; the rest are ignored. This is to support the interface of the reader.
Returns
A molecule. On failure, the returned molecule is empty.

◆ register_reader_factory()

template<class ReaderFactoryImpl>
bool nuri::register_reader_factory ( const std::vector< std::string > & names)

◆ remove_edge() [1/3]

template<class NT, class ET>
void nuri::remove_edge ( typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e,
Graph< NT, ET > & g )

◆ remove_edge() [2/3]

template<class NT, class ET>
void nuri::remove_edge ( typename boost::graph_traits< Graph< NT, ET > >::edge_iterator it,
Graph< NT, ET > & g )

◆ remove_edge() [3/3]

template<class NT, class ET>
void nuri::remove_edge ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor u,
typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
Graph< NT, ET > & g )

◆ remove_vertex()

template<class NT, class ET>
void nuri::remove_vertex ( typename boost::graph_traits< Graph< NT, ET > >::vertex_descriptor v,
Graph< NT, ET > & g )

◆ RingSetsFinder()

template<class MoleculeLike>
nuri::RingSetsFinder ( const MoleculeLike & ,
int  ) -> RingSetsFinder< MoleculeLike >

◆ shrake_rupley_sasa()

ArrayXd nuri::shrake_rupley_sasa ( const Molecule & mol,
const Matrix3Xd & conf,
int nprobe = 92,
double rprobe = 1.4,
internal::SrSasaMethod method = internal::SrSasaMethod::kAuto )
extern

Calculate the Solvent-Accessible Surface Area (SASA) of a molecule conformation using the Shrake-Rupley algorithm.

Parameters
molThe input molecule.
confThe conformation matrix.
nprobeThe number of probe spheres. Default is 92.
rprobeThe radius of the probe spheres. Default is 1.4 angstroms.
methodWhether prefer direct or octree method. Default is auto. This is mainly for testing purpose; in most cases, the auto method will choose the optimal method.
Returns
The calculated SASA values per atom (in angstroms squared).

◆ source() [1/2]

template<class NT, class ET>
boost::graph_traits< Graph< NT, ET > >::vertex_descriptor nuri::source ( typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e,
const Graph< NT, ET > &  )

◆ source() [2/2]

template<class NT, class ET, bool is_const>
boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor nuri::source ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e,
const Subgraph< NT, ET, is_const > &  )

◆ steric_number()

int nuri::steric_number ( Molecule::Atom atom)
inline

Get the predicted steric number of the atom.

Parameters
atomAn atom.
Returns
Predicted steric number of the atom.
Note
This function might return a negative value if the atom is not chemically valid.
Radicals don't count as lone pairs.

◆ Subgraph() [1/6]

template<class NT, class ET>
nuri::Subgraph ( const Graph< NT, ET > & graph) -> Subgraph< NT, ET, true >

◆ Subgraph() [2/6]

template<class NT, class ET>
nuri::Subgraph ( const Graph< NT, ET > & graph,
const std::vector< int > & nodes ) -> Subgraph< NT, ET, true >

◆ Subgraph() [3/6]

template<class NT, class ET>
nuri::Subgraph ( const Graph< NT, ET > & graph,
std::vector< int > && nodes ) -> Subgraph< NT, ET, true >
noexcept

◆ Subgraph() [4/6]

template<class NT, class ET>
nuri::Subgraph ( Graph< NT, ET > & graph) -> Subgraph< NT, ET, false >

◆ Subgraph() [5/6]

template<class NT, class ET>
nuri::Subgraph ( Graph< NT, ET > & graph,
const std::vector< int > & nodes ) -> Subgraph< NT, ET, false >

◆ Subgraph() [6/6]

template<class NT, class ET>
nuri::Subgraph ( Graph< NT, ET > & graph,
std::vector< int > && nodes ) -> Subgraph< NT, ET, false >
noexcept

◆ subgraph_from_edges()

template<class GT>
SubgraphOf< GT > nuri::subgraph_from_edges ( GT && graph,
internal::IndexSet && edges )

Make a subgraph from list of edges.

Template Parameters
GTThe type of the graph
Parameters
graphThe graph to make a subgraph of
edgesThe edges to include in the subgraph
Returns
A subgraph of the graph. All nodes connected by the edges will be included in the subgraph.
Note
Time complexity: same as Subgraph::from_edges().

◆ subgraph_from_nodes()

template<class GT>
SubgraphOf< GT > nuri::subgraph_from_nodes ( GT && graph,
internal::IndexSet && nodes )

Make a subgraph from list of nodes.

Template Parameters
GTThe type of the graph
Parameters
graphThe graph to make a subgraph of
nodesThe nodes to include in the subgraph
Returns
A subgraph of the graph. All edges between the nodes will be included in the subgraph.
Note
Time complexity: same as Subgraph::from_nodes().

◆ sum_bond_order()

int nuri::sum_bond_order ( Molecule::Atom atom)
inline

Get the approximate total bond order of the atom.

Parameters
atomAn atom.
Returns
Total bond order of the atom.
Note
"Other bond" count as single bond.

◆ sum_tan2_half() [1/2]

template<class Scalar, int N, auto... Extra>
std::pair< Scalar, Scalar > nuri::sum_tan2_half ( const Matrix< Scalar, 3, N, 0, Extra... > & m)
inline

Calculate sin and cos of half an average angle between consecutive vectors, i.e., (0, 1), (1, 2), ..., (n-1, 0).

Parameters
mThe vectors.
Returns
Pair of (sum of sines, sum of cosines) of half an average angle. The average angle itself can be directly calculated by 2 * std::atan2(sum_sin, sum_cos).
Warning
The vectors must be of the same length.
Note
The returned sums are always non-negative. Thus, the result could be interpreted as if they are calculated from the angles in [0, 90] degrees. That is, the average angle is always in [0, 180] degrees.

◆ sum_tan2_half() [2/2]

template<class Scalar, class Indexer, int N, auto... Extra>
std::pair< Scalar, Scalar > nuri::sum_tan2_half ( const Matrix< Scalar, 3, N, 0, Extra... > & m,
const Indexer & idxs )
inline

Calculate sin and cos of half an average angle between vectors, (0 - idxs[0]), (1 - idxs[1]), ..., (n-1 - idxs[n-1]).

Parameters
mThe vectors.
idxsThe indices of the vectors to calculate the angle with.
Returns
Pair of (sum of sines, sum of cosines) of half an average angle. The average angle itself can be directly calculated by 2 * std::atan2(sum_sin, sum_cos).
Warning
The vectors must be of the same length.
Note
The behavior is undefined if idxs contains out-of-range indices, or size of idxs is not equal to the number of vectors.
The returned sums are always non-negative. Thus, the result could be interpreted as if they are calculated from the angles in [0, 90] degrees. That is, the average angle is always in [0, 180] degrees.

◆ target() [1/2]

template<class NT, class ET>
boost::graph_traits< Graph< NT, ET > >::vertex_descriptor nuri::target ( typename boost::graph_traits< Graph< NT, ET > >::edge_descriptor e,
const Graph< NT, ET > &  )

◆ target() [2/2]

template<class NT, class ET, bool is_const>
boost::graph_traits< Subgraph< NT, ET, is_const > >::vertex_descriptor nuri::target ( typename boost::graph_traits< Subgraph< NT, ET, is_const > >::edge_descriptor e,
const Subgraph< NT, ET, is_const > &  )

◆ tm_align() [1/3]

TMAlignResult nuri::tm_align ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ,
ConstRef< ArrayXc > secx,
ConstRef< ArrayXc > secy,
TMAlign::InitFlags flags = TMAlign::InitFlags::kDefault,
int l_norm = -1,
double d0 = -1 )
extern

Align two structures using TM-align algorithm.

Parameters
queryThe query structure.
templThe template structure.
secxSecondary structure of the query structure.
secySecondary structure of the template structure.
flagsInitialization flags.
l_normLength normalization factor. If negative, the length of the template structure is used.
d0Distance scale factor. If negative, the default value is calculated based on the length normalization factor.
Returns
The result of the alignment. If the alignment failed for any reason, the TM-score is set to a negative value.
Note
If none of kSecStr or kLocalPlusSecStr flags are set, the secondary structures will be ignored.

◆ tm_align() [2/3]

TMAlignResult nuri::tm_align ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ,
ConstRef< ArrayXi > y2x,
int l_norm = -1,
double d0 = -1,
bool keep_alignment = true )
extern

Align two structures using TM-align algorithm, with the given alignment. This is also known as the "TM-score" program in the TM-tools suite.

Parameters
queryThe query structure.
templThe template structure.
y2xA map of the template structure to the query structure. Negative values indicate that the corresponding residue in the template structure is not aligned to any residue in the query structure.
l_normLength normalization factor. If negative, the length of the template structure is used.
d0Distance scale factor. If negative, the default value is calculated based on the length normalization factor.
keep_alignmentWhether to keep the given alignment without pruning during realignment step (-i vs -I in the original TM-align program).
Returns
The result of the alignment. If the alignment failed for any reason, the TM-score is set to a negative value.
Note
If size of y2x is not equal to the length of the template structure or any value of y2x is larger than or equal to the length of the query structure, the behavior is undefined.

◆ tm_align() [3/3]

TMAlignResult nuri::tm_align ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ,
TMAlign::InitFlags flags = TMAlign::InitFlags::kDefault,
int l_norm = -1,
double d0 = -1 )
extern

Align two structures using TM-align algorithm.

Parameters
queryThe query structure.
templThe template structure.
flagsInitialization flags.
l_normLength normalization factor. If negative, the length of the template structure is used.
d0Distance scale factor. If negative, the default value is calculated based on the length normalization factor.
Returns
The result of the alignment. If the alignment failed for any reason, the TM-score is set to a negative value.
Note
If any of kSecStr or kLocalPlusSecStr flags are set, the secondary structures of the input structures will be assigned using the approximate secondary structure assignment algorithm in the TM-align code.

◆ to_square_form() [1/2]

template<class ArrayLike>
auto nuri::to_square_form ( const ArrayLike & pdists,
Eigen::Index n )

◆ to_square_form() [2/2]

template<class AL, class DAL>
void nuri::to_square_form ( DAL && dists,
const AL & pdists,
Eigen::Index n )

◆ vertices() [1/2]

template<class NT, class ET>
auto nuri::vertices ( const Graph< NT, ET > & g)

concept requirements

◆ vertices() [2/2]

template<class NT, class ET, bool is_const>
auto nuri::vertices ( const Subgraph< NT, ET, is_const > & g)

concept requirements

◆ vf2pp() [1/4]

template<IsoMapType kMt, class GT, class GU, class AL1, class AL2, class NodeMatch, class EdgeMatch>
VF2ppResult nuri::vf2pp ( const GT & query,
const GU & target,
AL1 && qlbl,
AL2 && tlbl,
const NodeMatch & node_match,
const EdgeMatch & edge_match )

Find a query-to-target subgraph mapping.

Parameters
queryThe query graph ("needle").
targetThe target graph ("haystack").
qlblThe query node labels.
tlblThe target node labels.
node_matchThe node matching function. Must return true if the (query, target) node pair is matched. Is guaranteed to be called with topologically feasible and label-matching nodes.
edge_matchThe edge matching function. Must return true if the (query, target) edge pair is matched. Each ends of the edge are guaranteed to be already-matched nodes. Note that depending on the query and target graphs, the edge may be matched in reverse order, i.e., target edge might have source and target nodes swapped compared to the query edge.
Returns
The node and edge mapping, and whether the mapping is found. Mappings are valid only if the last element is true.
Note
Both graphs must not be empty, the query graph must be smaller or equal to the target graph, and each node labels must not contain non-negative labels and have same size as the corresponding graph. The behavior is undefined if any of the conditions are not met.
See also
VF2pp::next()

◆ vf2pp() [2/4]

template<class GT, class GU, class NodeMatch, class EdgeMatch, class AL1, class AL2>
VF2ppResult nuri::vf2pp ( const GT & query,
const GU & target,
AL1 && qlbl,
AL2 && tlbl,
const NodeMatch & node_match,
const EdgeMatch & edge_match,
IsoMapType mt )

Find a query-to-target subgraph mapping.

Parameters
queryThe query graph ("needle").
targetThe target graph ("haystack").
qlblThe query node labels.
tlblThe target node labels.
node_matchThe node matching function. Must return true if the (query, target) node pair is matched. Is guaranteed to be called with topologically feasible and label-matching nodes.
edge_matchThe edge matching function. Must return true if the (query, target) edge pair is matched. Each ends of the edge are guaranteed to be already-matched nodes. Note that depending on the query and target graphs, the edge may be matched in reverse order, i.e., target edge might have source and target nodes swapped compared to the query edge.
mtThe type of subgraph mapping.
Returns
The node and edge mapping, and whether the mapping is found. Mappings are valid only if the last element is true.
Note
Both graphs must not be empty, the query graph must be smaller or equal to the target graph, and each node labels must not contain non-negative labels and have same size as the corresponding graph. The behavior is undefined if any of the conditions are not met.
See also
VF2pp::next()

◆ vf2pp() [3/4]

template<IsoMapType kMt, class GT, class GU, class NodeMatch, class EdgeMatch>
VF2ppResult nuri::vf2pp ( const GT & query,
const GU & target,
const NodeMatch & node_match,
const EdgeMatch & edge_match )

Find a query-to-target subgraph mapping assuming all node labels are equal.

Parameters
queryThe query graph ("needle").
targetThe target graph ("haystack").
node_matchThe node matching function. Must return true if the (query, target) node pair is matched. Is guaranteed to be called with topologically feasible and label-matching nodes.
edge_matchThe edge matching function. Must return true if the (query, target) edge pair is matched. Each ends of the edge are guaranteed to be already-matched nodes. Note that depending on the query and target graphs, the edge may be matched in reverse order, i.e., target edge might have source and target nodes swapped compared to the query edge.
Returns
The node and edge mapping, and whether the mapping is found. Mappings are valid only if the last element is true.
Note
Both graphs must not be empty, the query graph must be smaller or equal to the target graph, and each node labels must not contain non-negative labels and have same size as the corresponding graph. The behavior is undefined if any of the conditions are not met.
See also
VF2pp::next()

◆ vf2pp() [4/4]

template<class GT, class GU, class NodeMatch, class EdgeMatch>
VF2ppResult nuri::vf2pp ( const GT & query,
const GU & target,
const NodeMatch & node_match,
const EdgeMatch & edge_match,
IsoMapType mt )

Find a query-to-target subgraph mapping assuming all node labels are equal.

Parameters
queryThe query graph ("needle").
targetThe target graph ("haystack").
node_matchThe node matching function. Must return true if the (query, target) node pair is matched. Is guaranteed to be called with topologically feasible and label-matching nodes.
edge_matchThe edge matching function. Must return true if the (query, target) edge pair is matched. Each ends of the edge are guaranteed to be already-matched nodes. Note that depending on the query and target graphs, the edge may be matched in reverse order, i.e., target edge might have source and target nodes swapped compared to the query edge.
mtThe type of subgraph mapping.
Returns
The node and edge mapping, and whether the mapping is found. Mappings are valid only if the last element is true.
Note
Both graphs must not be empty, the query graph must be smaller or equal to the target graph, and each node labels must not contain non-negative labels and have same size as the corresponding graph. The behavior is undefined if any of the conditions are not met.
See also
VF2pp::next()

◆ write_cif_block()

bool nuri::write_cif_block ( std::string & out,
const internal::CifBlock & block,
bool align = false )
extern

Serialize a CIF block (a data or global block plus its save frames), appending to out.

The block is not validated; pass a block that satisfies internal::CifBlock::validate (e.g. one built through the public API).

Parameters
outthe buffer to append to. On error, it is overwritten with the error message.
blockthe block to serialize. EOF and error blocks cannot be serialized.
alignif true, pad columns/keys for readability.
Returns
true on success; false if the block is EOF/error or any value could not be serialized.

◆ write_cif_frame()

bool nuri::write_cif_frame ( std::string & out,
const internal::CifFrame & frame,
internal::CifFrame::Type type = internal::CifFrame::Type::kData,
bool align = false )
extern

Serialize a CIF frame, appending to out.

Emits a data_, save_, or global_ heading followed by each table. The frame is not validated; pass a frame that satisfies internal::CifFrame::validate (e.g. one built through the public API).

Parameters
outthe buffer to append to. On error, it is overwritten with the error message.
framethe frame to serialize.
typethe type of block to write: data_ (default), save_, or global_.
alignif true, pad columns/keys for readability.
Returns
true on success; false if any value could not be serialized.

◆ write_cif_table()

bool nuri::write_cif_table ( std::string & out,
const internal::CifTable & table,
bool align = false )
extern

Serialize a CIF table (key-value pairs or a loop_), appending to out.

A single-row table is written as key-value pairs; otherwise a loop_ is emitted.

Parameters
outthe buffer to append to. On error, it is overwritten with the error message.
tablethe table to serialize.
alignif true, pad columns/keys for readability.
Returns
true on success; false if any value could not be serialized.

◆ write_mol2()

bool nuri::write_mol2 ( std::string & out,
const Molecule & mol,
int conf = -1,
bool write_sub = true )
extern

◆ write_pdb()

int nuri::write_pdb ( std::string & out,
const Molecule & mol,
int model = -1,
int conf = -1 )
extern

◆ write_sdf()

bool nuri::write_sdf ( std::string & out,
const Molecule & mol,
int conf = -1,
SDFVersion ver = SDFVersion::kAutomatic )
extern

Write a molecule to an SDF stream.

Parameters
outThe string to write to.
molThe molecule to write.
confThe index of the conformation to write. If negative, all conformers are written in separate blocks.
verThe SDF version to write. When set to kAutomatic, the version is determined by the molecule size.
Returns
Whether the write was successful.

◆ write_smiles()

bool nuri::write_smiles ( std::string & out,
const Molecule & mol,
bool canonical = false )
extern

Variable Documentation

◆ kDefaultThreshold

double nuri::kDefaultThreshold = 0.5
constexpr