Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
0fcf9ed5
Commit
0fcf9ed5
authored
Sep 04, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documenting more
parent
c99de817
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
181 additions
and
227 deletions
+181
-227
.gitignore
+3
-1
docs/conf.py
+0
-66
docs/conf.py.in
+1
-1
include/cif++/atom_type.hpp
+175
-155
src/atom_type.cpp
+2
-4
No files found.
.gitignore
View file @
0fcf9ed5
...
@@ -8,5 +8,6 @@ msvc/
...
@@ -8,5 +8,6 @@ msvc/
src/revision.hpp
src/revision.hpp
test/test-create_sugar_?.cif
test/test-create_sugar_?.cif
Testing/
Testing/
include/cif++/exports.hpp
docs/api
docs/api
docs/conf.py
\ No newline at end of file
docs/conf.py
deleted
100644 → 0
View file @
c99de817
project
=
'libmcfp'
copyright
=
'2023, Maarten L. Hekkelman'
author
=
'Maarten L. Hekkelman'
release
=
'5.1.3'
# -- General configuration ---------------------------------------------------
extensions
=
[
"breathe"
,
"exhale"
,
"myst_parser"
]
breathe_projects
=
{
"libcifpp"
:
"../build/docs/xml"
}
myst_enable_extensions
=
[
"colon_fence"
]
breathe_default_project
=
"libcifpp"
# Setup the exhale extension
exhale_args
=
{
# These arguments are required
"containmentFolder"
:
"./api"
,
"rootFileName"
:
"library_root.rst"
,
"doxygenStripFromPath"
:
"../include/"
,
# Heavily encouraged optional argument (see docs)
"rootFileTitle"
:
"API Reference"
,
# Suggested optional arguments
# "createTreeView": True,
# TIP: if using the sphinx-bootstrap-theme, you need
# "treeViewIsBootstrap": True,
"exhaleExecutesDoxygen"
:
False
,
"contentsDirectives"
:
False
,
"verboseBuild"
:
False
}
# Tell sphinx what the primary language being documented is.
primary_domain
=
'cpp'
# Tell sphinx what the pygments highlight language should be.
highlight_language
=
'cpp'
templates_path
=
[
'_templates'
]
exclude_patterns
=
[
'_build'
,
'Thumbs.db'
,
'.DS_Store'
]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme
=
'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path
=
[
'_static'
]
html_theme_options
=
{
}
cpp_index_common_prefix
=
[
'cif::'
]
docs/conf.py.in
View file @
0fcf9ed5
project = '
libmcfp
'
project = '
@PROJECT_NAME@
'
copyright = '2023, Maarten L. Hekkelman'
copyright = '2023, Maarten L. Hekkelman'
author = 'Maarten L. Hekkelman'
author = 'Maarten L. Hekkelman'
release = '@PROJECT_VERSION@'
release = '@PROJECT_VERSION@'
...
...
include/cif++/atom_type.hpp
View file @
0fcf9ed5
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "cif++/exports.hpp"
#include "cif++/exports.hpp"
#include <cstdint>
#include <cstdint>
#include <limits>
#include <stdexcept>
#include <stdexcept>
#include <string>
#include <string>
...
@@ -43,166 +44,175 @@ namespace cif
...
@@ -43,166 +44,175 @@ namespace cif
enum
atom_type
:
uint8_t
enum
atom_type
:
uint8_t
{
{
Nn
=
0
,
//< Unknown
Nn
=
0
,
//
/
< Unknown
H
=
1
,
//< Hydrogen
H
=
1
,
//
/
< Hydrogen
He
=
2
,
//< Helium
He
=
2
,
//
/
< Helium
Li
=
3
,
//< Lithium
Li
=
3
,
//
/
< Lithium
Be
=
4
,
//< Beryllium
Be
=
4
,
//
/
< Beryllium
B
=
5
,
//< Boron
B
=
5
,
//
/
< Boron
C
=
6
,
//< Carbon
C
=
6
,
//
/
< Carbon
N
=
7
,
//< Nitrogen
N
=
7
,
//
/
< Nitrogen
O
=
8
,
//< Oxygen
O
=
8
,
//
/
< Oxygen
F
=
9
,
//< Fluorine
F
=
9
,
//
/
< Fluorine
Ne
=
10
,
//< Neon
Ne
=
10
,
//
/
< Neon
Na
=
11
,
//< Sodium
Na
=
11
,
//
/
< Sodium
Mg
=
12
,
//< Magnesium
Mg
=
12
,
//
/
< Magnesium
Al
=
13
,
//< Aluminium
Al
=
13
,
//
/
< Aluminium
Si
=
14
,
//< Silicon
Si
=
14
,
//
/
< Silicon
P
=
15
,
//< Phosphorus
P
=
15
,
//
/
< Phosphorus
S
=
16
,
//< Sulfur
S
=
16
,
//
/
< Sulfur
Cl
=
17
,
//< Chlorine
Cl
=
17
,
//
/
< Chlorine
Ar
=
18
,
//< Argon
Ar
=
18
,
//
/
< Argon
K
=
19
,
//< Potassium
K
=
19
,
//
/
< Potassium
Ca
=
20
,
//< Calcium
Ca
=
20
,
//
/
< Calcium
Sc
=
21
,
//< Scandium
Sc
=
21
,
//
/
< Scandium
Ti
=
22
,
//< Titanium
Ti
=
22
,
//
/
< Titanium
V
=
23
,
//< Vanadium
V
=
23
,
//
/
< Vanadium
Cr
=
24
,
//< Chromium
Cr
=
24
,
//
/
< Chromium
Mn
=
25
,
//< Manganese
Mn
=
25
,
//
/
< Manganese
Fe
=
26
,
//< Iron
Fe
=
26
,
//
/
< Iron
Co
=
27
,
//< Cobalt
Co
=
27
,
//
/
< Cobalt
Ni
=
28
,
//< Nickel
Ni
=
28
,
//
/
< Nickel
Cu
=
29
,
//< Copper
Cu
=
29
,
//
/
< Copper
Zn
=
30
,
//< Zinc
Zn
=
30
,
//
/
< Zinc
Ga
=
31
,
//< Gallium
Ga
=
31
,
//
/
< Gallium
Ge
=
32
,
//< Germanium
Ge
=
32
,
//
/
< Germanium
As
=
33
,
//< Arsenic
As
=
33
,
//
/
< Arsenic
Se
=
34
,
//< Selenium
Se
=
34
,
//
/
< Selenium
Br
=
35
,
//< Bromine
Br
=
35
,
//
/
< Bromine
Kr
=
36
,
//< Krypton
Kr
=
36
,
//
/
< Krypton
Rb
=
37
,
//< Rubidium
Rb
=
37
,
//
/
< Rubidium
Sr
=
38
,
//< Strontium
Sr
=
38
,
//
/
< Strontium
Y
=
39
,
//< Yttrium
Y
=
39
,
//
/
< Yttrium
Zr
=
40
,
//< Zirconium
Zr
=
40
,
//
/
< Zirconium
Nb
=
41
,
//< Niobium
Nb
=
41
,
//
/
< Niobium
Mo
=
42
,
//< Molybdenum
Mo
=
42
,
//
/
< Molybdenum
Tc
=
43
,
//< Technetium
Tc
=
43
,
//
/
< Technetium
Ru
=
44
,
//< Ruthenium
Ru
=
44
,
//
/
< Ruthenium
Rh
=
45
,
//< Rhodium
Rh
=
45
,
//
/
< Rhodium
Pd
=
46
,
//< Palladium
Pd
=
46
,
//
/
< Palladium
Ag
=
47
,
//< Silver
Ag
=
47
,
//
/
< Silver
Cd
=
48
,
//< Cadmium
Cd
=
48
,
//
/
< Cadmium
In
=
49
,
//< Indium
In
=
49
,
//
/
< Indium
Sn
=
50
,
//< Tin
Sn
=
50
,
//
/
< Tin
Sb
=
51
,
//< Antimony
Sb
=
51
,
//
/
< Antimony
Te
=
52
,
//< Tellurium
Te
=
52
,
//
/
< Tellurium
I
=
53
,
//< Iodine
I
=
53
,
//
/
< Iodine
Xe
=
54
,
//< Xenon
Xe
=
54
,
//
/
< Xenon
Cs
=
55
,
//< Caesium
Cs
=
55
,
//
/
< Caesium
Ba
=
56
,
//< Barium
Ba
=
56
,
//
/
< Barium
La
=
57
,
//< Lanthanum
La
=
57
,
//
/
< Lanthanum
Hf
=
72
,
//< Hafnium
Hf
=
72
,
//
/
< Hafnium
Ta
=
73
,
//< Tantalum
Ta
=
73
,
//
/
< Tantalum
W
=
74
,
//< Tungsten
W
=
74
,
//
/
< Tungsten
Re
=
75
,
//< Rhenium
Re
=
75
,
//
/
< Rhenium
Os
=
76
,
//< Osmium
Os
=
76
,
//
/
< Osmium
Ir
=
77
,
//< Iridium
Ir
=
77
,
//
/
< Iridium
Pt
=
78
,
//< Platinum
Pt
=
78
,
//
/
< Platinum
Au
=
79
,
//< Gold
Au
=
79
,
//
/
< Gold
Hg
=
80
,
//< Mercury
Hg
=
80
,
//
/
< Mercury
Tl
=
81
,
//< Thallium
Tl
=
81
,
//
/
< Thallium
Pb
=
82
,
//< Lead
Pb
=
82
,
//
/
< Lead
Bi
=
83
,
//< Bismuth
Bi
=
83
,
//
/
< Bismuth
Po
=
84
,
//< Polonium
Po
=
84
,
//
/
< Polonium
At
=
85
,
//< Astatine
At
=
85
,
//
/
< Astatine
Rn
=
86
,
//< Radon
Rn
=
86
,
//
/
< Radon
Fr
=
87
,
//< Francium
Fr
=
87
,
//
/
< Francium
Ra
=
88
,
//< Radium
Ra
=
88
,
//
/
< Radium
Ac
=
89
,
//< Actinium
Ac
=
89
,
//
/
< Actinium
Rf
=
104
,
//< Rutherfordium
Rf
=
104
,
//
/
< Rutherfordium
Db
=
105
,
//< Dubnium
Db
=
105
,
//
/
< Dubnium
Sg
=
106
,
//< Seaborgium
Sg
=
106
,
//
/
< Seaborgium
Bh
=
107
,
//< Bohrium
Bh
=
107
,
//
/
< Bohrium
Hs
=
108
,
//< Hassium
Hs
=
108
,
//
/
< Hassium
Mt
=
109
,
//< Meitnerium
Mt
=
109
,
//
/
< Meitnerium
Ds
=
110
,
//< Darmstadtium
Ds
=
110
,
//
/
< Darmstadtium
Rg
=
111
,
//< Roentgenium
Rg
=
111
,
//
/
< Roentgenium
Cn
=
112
,
//< Copernicium
Cn
=
112
,
//
/
< Copernicium
Nh
=
113
,
//< Nihonium
Nh
=
113
,
//
/
< Nihonium
Fl
=
114
,
//< Flerovium
Fl
=
114
,
//
/
< Flerovium
Mc
=
115
,
//< Moscovium
Mc
=
115
,
//
/
< Moscovium
Lv
=
116
,
//< Livermorium
Lv
=
116
,
//
/
< Livermorium
Ts
=
117
,
//< Tennessine
Ts
=
117
,
//
/
< Tennessine
Og
=
118
,
//< Oganesson
Og
=
118
,
//
/
< Oganesson
Ce
=
58
,
//< Cerium
Ce
=
58
,
//
/
< Cerium
Pr
=
59
,
//< Praseodymium
Pr
=
59
,
//
/
< Praseodymium
Nd
=
60
,
//< Neodymium
Nd
=
60
,
//
/
< Neodymium
Pm
=
61
,
//< Promethium
Pm
=
61
,
//
/
< Promethium
Sm
=
62
,
//< Samarium
Sm
=
62
,
//
/
< Samarium
Eu
=
63
,
//< Europium
Eu
=
63
,
//
/
< Europium
Gd
=
64
,
//< Gadolinium
Gd
=
64
,
//
/
< Gadolinium
Tb
=
65
,
//< Terbium
Tb
=
65
,
//
/
< Terbium
Dy
=
66
,
//< Dysprosium
Dy
=
66
,
//
/
< Dysprosium
Ho
=
67
,
//< Holmium
Ho
=
67
,
//
/
< Holmium
Er
=
68
,
//< Erbium
Er
=
68
,
//
/
< Erbium
Tm
=
69
,
//< Thulium
Tm
=
69
,
//
/
< Thulium
Yb
=
70
,
//< Ytterbium
Yb
=
70
,
//
/
< Ytterbium
Lu
=
71
,
//< Lutetium
Lu
=
71
,
//
/
< Lutetium
Th
=
90
,
//< Thorium
Th
=
90
,
//
/
< Thorium
Pa
=
91
,
//< Protactinium
Pa
=
91
,
//
/
< Protactinium
U
=
92
,
//< Uranium
U
=
92
,
//
/
< Uranium
Np
=
93
,
//< Neptunium
Np
=
93
,
//
/
< Neptunium
Pu
=
94
,
//< Plutonium
Pu
=
94
,
//
/
< Plutonium
Am
=
95
,
//< Americium
Am
=
95
,
//
/
< Americium
Cm
=
96
,
//< Curium
Cm
=
96
,
//
/
< Curium
Bk
=
97
,
//< Berkelium
Bk
=
97
,
//
/
< Berkelium
Cf
=
98
,
//< Californium
Cf
=
98
,
//
/
< Californium
Es
=
99
,
//< Einsteinium
Es
=
99
,
//
/
< Einsteinium
Fm
=
100
,
//< Fermium
Fm
=
100
,
//
/
< Fermium
Md
=
101
,
//< Mendelevium
Md
=
101
,
//
/
< Mendelevium
No
=
102
,
//< Nobelium
No
=
102
,
//
/
< Nobelium
Lr
=
103
,
//< Lawrencium
Lr
=
103
,
//
/
< Lawrencium
D
=
119
,
//< Deuterium
D
=
119
,
//
/
< Deuterium
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
/// An enum used to select the desired radius for an atom
/// An enum used to select the desired radius for an atom.
/// All values are collected from the wikipedia pages on atom radii
enum
class
radius_type
enum
class
radius_type
{
{
calculated
,
calculated
,
///< Calculated radius from theoretical models
empirical
,
empirical
,
///< Empirically measured covalent radii
/// @deprecated It is a bit unclear where these values came from. So, better not use them
covalent_empirical
,
covalent_empirical
,
single_bond
,
single_bond
,
///< Bond length for a single covalent bond calculated using statistically analysis
double_bond
,
double_bond
,
///< Bond length for a double covalent bond calculated using statistically analysis
triple_bond
,
triple_bond
,
///< Bond length for a triple covalent bond calculated using statistically analysis
van_der_waals
,
van_der_waals
,
///< Radius of an imaginary hard sphere representing the distance of closest approach for another atom
type_count
type_count
///< Number of radii
};
};
/// @brief The number of radii per element which can be requested from @ref atom_type_info
constexpr
size_t
kRadiusTypeCount
=
static_cast
<
size_t
>
(
radius_type
::
type_count
);
constexpr
size_t
kRadiusTypeCount
=
static_cast
<
size_t
>
(
radius_type
::
type_count
);
/// An enum used to select either the effective or the crystal radius of an ion
/// An enum used to select either the effective or the crystal radius of an ion.
/// See explanation on Wikipedia: https://en.wikipedia.org/wiki/Ionic_radius
enum
class
ionic_radius_type
enum
class
ionic_radius_type
{
{
effective
,
crystal
effective
,
///< Based on distance between ions in a crystal structure as determined by X-ray crystallography
crystal
///< Calculated ion radius based on a function of ionic charge and spin
};
};
/// Requests for an unknown radius value return kNA
constexpr
float
kNA
=
std
::
numeric_limits
<
float
>::
quiet_NaN
();
/// A struct holding the known information for all elements defined in @ref atom_type
/// A struct holding the known information for all elements defined in @ref atom_type
struct
atom_type_info
struct
atom_type_info
...
@@ -222,7 +232,7 @@ struct atom_type_info
...
@@ -222,7 +232,7 @@ struct atom_type_info
/// A flag indicating whether the element is a metal
/// A flag indicating whether the element is a metal
bool
metal
;
bool
metal
;
/// Array containing all known radii for this element. A value of
std::nanf("1") is
/// Array containing all known radii for this element. A value of
@ref cif::kNA is
/// stored for unknown values
/// stored for unknown values
float
radii
[
kRadiusTypeCount
];
float
radii
[
kRadiusTypeCount
];
};
};
...
@@ -234,7 +244,7 @@ extern CIFPP_EXPORT const atom_type_info kKnownAtoms[];
...
@@ -234,7 +244,7 @@ extern CIFPP_EXPORT const atom_type_info kKnownAtoms[];
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// AtomTypeTraits
// AtomTypeTraits
/// A traits class to access information
on
known elements
/// A traits class to access information
for
known elements
class
atom_type_traits
class
atom_type_traits
{
{
...
@@ -245,12 +255,12 @@ class atom_type_traits
...
@@ -245,12 +255,12 @@ class atom_type_traits
/// Constructor based on the element as a string in \a symbol
/// Constructor based on the element as a string in \a symbol
atom_type_traits
(
const
std
::
string
&
symbol
);
atom_type_traits
(
const
std
::
string
&
symbol
);
atom_type
type
()
const
{
return
m_info
->
type
;
}
atom_type
type
()
const
{
return
m_info
->
type
;
}
///< Returns the @ref atom_type
std
::
string
name
()
const
{
return
m_info
->
name
;
}
std
::
string
name
()
const
{
return
m_info
->
name
;
}
///< Returns the name of the element
std
::
string
symbol
()
const
{
return
m_info
->
symbol
;
}
std
::
string
symbol
()
const
{
return
m_info
->
symbol
;
}
///< Returns the symbol of the element
float
weight
()
const
{
return
m_info
->
weight
;
}
float
weight
()
const
{
return
m_info
->
weight
;
}
///< Returns the average weight of the element
bool
is_metal
()
const
{
return
m_info
->
metal
;
}
bool
is_metal
()
const
{
return
m_info
->
metal
;
}
///< Returns true if the element is a metal
/// Return true if the symbol in \a symbol actually exists in the list of known elements in @ref atom_type
/// Return true if the symbol in \a symbol actually exists in the list of known elements in @ref atom_type
static
bool
is_element
(
const
std
::
string
&
symbol
);
static
bool
is_element
(
const
std
::
string
&
symbol
);
...
@@ -258,6 +268,9 @@ class atom_type_traits
...
@@ -258,6 +268,9 @@ class atom_type_traits
/// Return true if the symbol in \a symbol exists and is a metal
/// Return true if the symbol in \a symbol exists and is a metal
static
bool
is_metal
(
const
std
::
string
&
symbol
);
static
bool
is_metal
(
const
std
::
string
&
symbol
);
/// @brief Return the radius for the element, use \a type to select which radius to return
/// @param type The selector for which radius to return
/// @return The requested radius or @ref cif::kNA if not known (or applicable)
float
radius
(
radius_type
type
=
radius_type
::
single_bond
)
const
float
radius
(
radius_type
type
=
radius_type
::
single_bond
)
const
{
{
if
(
type
>=
radius_type
::
type_count
)
if
(
type
>=
radius_type
::
type_count
)
...
@@ -294,21 +307,28 @@ class atom_type_traits
...
@@ -294,21 +307,28 @@ class atom_type_traits
double
a
[
6
],
b
[
6
];
double
a
[
6
],
b
[
6
];
};
};
// to get the Cval and Siva values, use this constant as charge:
// to get the Cval and Siva scattering factor values, use this constant as charge:
enum
static
constexpr
int
kWKSFVal
=
-
99
;
{
kWKSFVal
=
-
99
};
/// @brief Return the Waasmaier & Kirfel scattering factor values for the element
///
/// The coefficients from Waasmaier & Kirfel (1995), Acta Cryst. A51, 416-431.
///
/// @param charge The charge for which the structure values should be returned, use @ref kWSKFVal to return the Cval and Siva values
/// @return The scattering factors as a @ref SFData struct
const
SFData
&
wksf
(
int
charge
=
0
)
const
;
const
SFData
&
wksf
(
int
charge
=
0
)
const
;
/// @brief Return the electron scattering factor values for the element
///
/// @return The scattering factors as a @ref SFData struct
const
SFData
&
elsf
()
const
;
const
SFData
&
elsf
()
const
;
// Clipper doesn't like atoms with charges that do not have a scattering factor. And
//
/
Clipper doesn't like atoms with charges that do not have a scattering factor. And
// rightly so, but we need to know in advance if this is the case
//
/
rightly so, but we need to know in advance if this is the case
bool
has_sf
(
int
charge
)
const
;
bool
has_sf
(
int
charge
)
const
;
private
:
private
:
const
struct
atom_type_info
*
m_info
;
const
struct
atom_type_info
*
m_info
;
};
};
}
// namespace
pdbx
}
// namespace
cif
src/atom_type.cpp
View file @
0fcf9ed5
...
@@ -34,8 +34,6 @@ namespace cif
...
@@ -34,8 +34,6 @@ namespace cif
namespace
data
namespace
data
{
{
const
float
kNA
=
std
::
nanf
(
"1"
);
const
atom_type_info
kKnownAtoms
[]
=
const
atom_type_info
kKnownAtoms
[]
=
{
{
{
Nn
,
"Unknown"
,
"Nn"
,
0
,
false
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// 0 Nn Unknown
{
Nn
,
"Unknown"
,
"Nn"
,
0
,
false
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// 0 Nn Unknown
...
@@ -1145,7 +1143,7 @@ auto atom_type_traits::elsf() const -> const SFData&
...
@@ -1145,7 +1143,7 @@ auto atom_type_traits::elsf() const -> const SFData&
float
atom_type_traits
::
crystal_ionic_radius
(
int
charge
)
const
float
atom_type_traits
::
crystal_ionic_radius
(
int
charge
)
const
{
{
float
result
=
data
::
kNA
;
float
result
=
kNA
;
if
(
charge
>=
-
3
and
charge
<=
8
)
if
(
charge
>=
-
3
and
charge
<=
8
)
{
{
...
@@ -1164,7 +1162,7 @@ float atom_type_traits::crystal_ionic_radius(int charge) const
...
@@ -1164,7 +1162,7 @@ float atom_type_traits::crystal_ionic_radius(int charge) const
float
atom_type_traits
::
effective_ionic_radius
(
int
charge
)
const
float
atom_type_traits
::
effective_ionic_radius
(
int
charge
)
const
{
{
float
result
=
data
::
kNA
;
float
result
=
kNA
;
if
(
charge
>=
-
3
and
charge
<=
8
)
if
(
charge
>=
-
3
and
charge
<=
8
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment