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
15db026e
Unverified
Commit
15db026e
authored
Jan 31, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:PDB-REDO/libcifpp into develop
parents
19f2fd75
627d3b9d
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
440 additions
and
511 deletions
+440
-511
.gitignore
+1
-0
CMakeLists.txt
+11
-2
changelog
+1
-0
include/cif++/atom_type.hpp
+1
-1
include/cif++/category.hpp
+2
-2
include/cif++/compound.hpp
+6
-6
include/cif++/condition.hpp
+2
-2
include/cif++/datablock.hpp
+1
-2
include/cif++/file.hpp
+1
-0
include/cif++/forward_decl.hpp
+2
-0
include/cif++/item.hpp
+7
-6
include/cif++/list.hpp
+0
-79
include/cif++/model.hpp
+2
-2
include/cif++/parser.hpp
+3
-3
include/cif++/pdb/tls.hpp
+2
-6
include/cif++/point.hpp
+2
-0
include/cif++/symmetry.hpp
+6
-4
include/cif++/text.hpp
+5
-4
include/cif++/utilities.hpp
+3
-1
include/cif++/validate.hpp
+2
-2
src/atom_type.cpp
+68
-68
src/category.cpp
+6
-6
src/compound.cpp
+4
-5
src/item.cpp
+2
-2
src/model.cpp
+156
-158
src/parser.cpp
+5
-11
src/pdb/cif2pdb.cpp
+4
-3
src/pdb/pdb2cif.cpp
+5
-6
src/pdb/pdb2cif_remark_3.cpp
+1
-2
src/pdb/tls.cpp
+3
-3
src/point.cpp
+3
-3
src/symmetry.cpp
+2
-2
src/text.cpp
+2
-2
src/utilities.cpp
+6
-7
src/validate.cpp
+5
-6
test/sugar-test.cpp
+53
-53
test/unit-3d-test.cpp
+25
-25
test/unit-v2-test.cpp
+26
-26
tools/update-libcifpp-data.in
+4
-1
No files found.
.gitignore
View file @
15db026e
...
...
@@ -7,3 +7,4 @@ CMakeSettings.json
msvc/
src/revision.hpp
test/test-create_sugar_?.cif
Testing/
CMakeLists.txt
View file @
15db026e
...
...
@@ -35,10 +35,13 @@ include(CheckIncludeFiles)
include
(
CheckLibraryExists
)
include
(
CMakePackageConfigHelpers
)
include
(
CheckCXXSourceCompiles
)
include
(
GenerateExportHeader
)
set
(
CXX_EXTENSIONS OFF
)
set
(
CMAKE_CXX_STANDARD 20
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers"
)
...
...
@@ -224,7 +227,6 @@ set(project_headers
${
PROJECT_SOURCE_DIR
}
/include/cif++/datablock.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/file.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/validate.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/list.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/iterator.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/parser.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/forward_decl.hpp
...
...
@@ -249,6 +251,7 @@ set(project_headers
add_library
(
cifpp
${
project_sources
}
${
project_headers
}
${
PROJECT_SOURCE_DIR
}
/src/symop_table_data.hpp
)
add_library
(
cifpp::cifpp ALIAS cifpp
)
generate_export_header
(
cifpp EXPORT_FILE_NAME cif++/exports.hpp
)
if
(
BOOST_REGEX
)
target_compile_definitions
(
cifpp PRIVATE USE_BOOST_REGEX=1 BOOST_REGEX_STANDALONE=1
)
...
...
@@ -263,7 +266,7 @@ set_target_properties(cifpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories
(
cifpp
PUBLIC
"$<BUILD_INTERFACE:
${
PROJECT_SOURCE_DIR
}
/include>"
"$<BUILD_INTERFACE:
${
PROJECT_SOURCE_DIR
}
/include
;
${
PROJECT_BINARY_DIR
}
>"
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
...
...
@@ -343,6 +346,12 @@ install(
COMPONENT Devel
)
install
(
FILES
${
PROJECT_BINARY_DIR
}
/cif++/exports.hpp
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/cif++
COMPONENT Devel
)
install
(
FILES
${
PROJECT_SOURCE_DIR
}
/rsrc/mmcif_ddl.dic
${
PROJECT_SOURCE_DIR
}
/rsrc/mmcif_pdbx.dic
...
...
changelog
View file @
15db026e
Version
5.0.6
-
Fix
file
::
contains
,
using
iequals
-
Fix
is_cis
Version
5.0.5
-
Fix
code
to
work
on
32
bit
machines
...
...
include/cif++/atom_type.hpp
View file @
15db026e
...
...
@@ -204,7 +204,7 @@ struct atom_type_info
float
radii
[
kRadiusTypeCount
];
};
extern
const
atom_type_info
kKnownAtoms
[];
extern
CIFPP_EXPORT
const
atom_type_info
kKnownAtoms
[];
// --------------------------------------------------------------------
// AtomTypeTraits
...
...
include/cif++/category.hpp
View file @
15db026e
...
...
@@ -26,8 +26,6 @@
#pragma once
#include <array>
#include <cif++/forward_decl.hpp>
#include <cif++/condition.hpp>
...
...
@@ -35,6 +33,8 @@
#include <cif++/row.hpp>
#include <cif++/validate.hpp>
#include <array>
// TODO: implement all of:
// https://en.cppreference.com/w/cpp/named_req/Container
// https://en.cppreference.com/w/cpp/named_req/SequenceContainer
...
...
include/cif++/compound.hpp
View file @
15db026e
...
...
@@ -29,15 +29,15 @@
/// \file This file contains the definition for the class compound, encapsulating
/// the information found for compounds in the CCD.
#include <cif++.hpp>
#include <cif++/atom_type.hpp>
#include <cif++/point.hpp>
#include <map>
#include <set>
#include <tuple>
#include <vector>
#include <cif++.hpp>
#include <cif++/atom_type.hpp>
#include <cif++/point.hpp>
namespace
cif
{
...
...
@@ -180,7 +180,7 @@ class compound_factory
~
compound_factory
();
static
const
std
::
map
<
std
::
string
,
char
>
kAAMap
,
kBaseMap
;
static
CIFPP_EXPORT
const
std
::
map
<
std
::
string
,
char
>
kAAMap
,
kBaseMap
;
private
:
compound_factory
();
...
...
@@ -195,4 +195,4 @@ class compound_factory
std
::
shared_ptr
<
compound_factory_impl
>
m_impl
;
};
}
// namespace
pdbx
}
// namespace
cif
include/cif++/condition.hpp
View file @
15db026e
...
...
@@ -26,14 +26,14 @@
#pragma once
#include <cif++/row.hpp>
#include <cassert>
#include <functional>
#include <iostream>
#include <regex>
#include <utility>
#include <cif++/row.hpp>
namespace
cif
{
...
...
include/cif++/datablock.hpp
View file @
15db026e
...
...
@@ -26,9 +26,8 @@
#pragma once
#include <cif++/forward_decl.hpp>
#include <cif++/category.hpp>
#include <cif++/forward_decl.hpp>
namespace
cif
{
...
...
include/cif++/file.hpp
View file @
15db026e
...
...
@@ -28,6 +28,7 @@
#include <list>
#include <cif++/exports.hpp>
#include <cif++/datablock.hpp>
#include <cif++/parser.hpp>
...
...
include/cif++/forward_decl.hpp
View file @
15db026e
...
...
@@ -26,6 +26,8 @@
#pragma once
#include <cif++/exports.hpp>
#include <string>
#include <vector>
...
...
include/cif++/item.hpp
View file @
15db026e
...
...
@@ -26,6 +26,12 @@
#pragma once
#include <cif++/exports.hpp>
#include <cif++/forward_decl.hpp>
#include <cif++/text.hpp>
#include <cif++/utilities.hpp>
#include <cassert>
#include <charconv>
#include <cstring>
#include <iomanip>
...
...
@@ -35,9 +41,6 @@
#include <optional>
#include <utility>
#include <cif++/forward_decl.hpp>
#include <cif++/text.hpp>
/// \file item.hpp
/// This file contains the declaration of item but also the item_value and item_handle
/// These handle the storage of and access to the data for a single data field.
...
...
@@ -45,8 +48,6 @@
namespace
cif
{
extern
int
VERBOSE
;
// --------------------------------------------------------------------
/// \brief item is a transient class that is used to pass data into rows
/// but it also takes care of formatting data.
...
...
@@ -353,7 +354,7 @@ struct item_handle
{
}
static
const
item_handle
s_null_item
;
static
CIFPP_EXPORT
const
item_handle
s_null_item
;
friend
void
swap
(
item_handle
a
,
item_handle
b
)
{
...
...
include/cif++/list.hpp
deleted
100644 → 0
View file @
19f2fd75
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 NKI/AVL, Netherlands Cancer Institute
*
* 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.
*
* 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.
*/
#pragma once
#include <memory>
namespace
cif
{
// --------------------------------------------------------------------
template
<
typename
Allocator
=
std
::
allocator
<
void
>>
class
list
{
public
:
protected
:
struct
list_item
{
list_item
*
m_next
=
nullptr
;
};
using
list_item_allocator_type
=
typename
std
::
allocator_traits
<
Alloc
>::
template
rebind_alloc
<
list_item
>
;
using
list_item_allocator_traits
=
std
::
allocator_traits
<
item_allocator_type
>
;
list_item_allocator_traits
::
pointer
get_item
()
{
list_item_allocator_type
ia
(
get_allocator
());
return
list_item_allocator_traits
::
allocate
(
ia
,
1
);
}
template
<
typename
...
Arguments
>
list_item
*
create_list_item
(
uint16_t
column_ix
,
Arguments
...
args
)
{
auto
p
=
this
->
get_item
();
list_item_allocator_type
ia
(
get_allocator
());
list_item_allocator_traits
::
construct
(
ia
,
p
,
std
::
forward
<
Arguments
>
(
args
)...);
return
p
;
}
void
delete_list_item
(
list_item
*
iv
)
{
list_item_allocator_type
ia
(
get_allocator
());
list_item_allocator_traits
::
destroy
(
ia
,
iv
);
list_item_allocator_traits
::
deallocate
(
ia
,
iv
,
1
);
}
list_item
*
m_head
=
nullptr
,
*
m_tail
=
nullptr
;
};
}
// namespace cif
include/cif++/model.hpp
View file @
15db026e
...
...
@@ -26,10 +26,10 @@
#pragma once
#include <numeric>
#include <cif++/atom_type.hpp>
#include <numeric>
#if __cpp_lib_format
#include <format>
#endif
...
...
include/cif++/parser.hpp
View file @
15db026e
...
...
@@ -26,11 +26,11 @@
#pragma once
#include <cif++/row.hpp>
#include <map>
#include <regex>
#include <cif++/row.hpp>
namespace
cif
{
...
...
@@ -94,7 +94,7 @@ class sac_parser
static
bool
is_unquoted_string
(
std
::
string_view
text
)
{
bool
result
=
is_ordinary
(
text
.
front
());
bool
result
=
text
.
empty
()
or
is_ordinary
(
text
.
front
());
if
(
result
)
{
...
...
include/cif++/pdb/tls.hpp
View file @
15db026e
...
...
@@ -26,19 +26,15 @@
#pragma once
#include <cif++.hpp>
#include <string>
#include <tuple>
#include <vector>
#include <cif++.hpp>
namespace
cif
{
extern
const
int
kResidueNrWildcard
,
kNoSeqNum
;
struct
tls_selection
;
struct
tls_residue
;
...
...
include/cif++/point.hpp
View file @
15db026e
...
...
@@ -26,6 +26,8 @@
#pragma once
#include <cif++/exports.hpp>
#include <cmath>
#include <complex>
#include <functional>
...
...
include/cif++/symmetry.hpp
View file @
15db026e
...
...
@@ -26,6 +26,8 @@
#pragma once
#include <cif++/exports.hpp>
#include <array>
#include <cstdint>
#include <string>
...
...
@@ -50,8 +52,8 @@ struct space_group
int
nr
;
};
extern
const
space_group
kSpaceGroups
[];
extern
const
std
::
size_t
kNrOfSpaceGroups
;
extern
CIFPP_EXPORT
const
space_group
kSpaceGroups
[];
extern
CIFPP_EXPORT
const
std
::
size_t
kNrOfSpaceGroups
;
// --------------------------------------------------------------------
...
...
@@ -139,8 +141,8 @@ struct symop_datablock
static_assert
(
sizeof
(
symop_datablock
)
==
sizeof
(
uint64_t
),
"Size of symop_data is wrong"
);
extern
const
symop_datablock
kSymopNrTable
[];
extern
const
std
::
size_t
kSymopNrTableSize
;
extern
CIFPP_EXPORT
const
symop_datablock
kSymopNrTable
[];
extern
CIFPP_EXPORT
const
std
::
size_t
kSymopNrTableSize
;
// --------------------------------------------------------------------
...
...
include/cif++/text.hpp
View file @
15db026e
...
...
@@ -26,6 +26,8 @@
#pragma once
#include <cif++/exports.hpp>
#include <charconv>
#include <cmath>
#include <limits>
...
...
@@ -34,7 +36,6 @@
#include <tuple>
#include <vector>
#if __has_include(<experimental/type_traits>)
#include <experimental/type_traits>
#else
...
...
@@ -249,7 +250,7 @@ typedef std::set<std::string, iless> iset;
// --------------------------------------------------------------------
// This really makes a difference, having our own tolower routines
extern
const
uint8_t
kCharToLowerMap
[
256
];
extern
CIFPP_EXPORT
const
uint8_t
kCharToLowerMap
[
256
];
inline
char
tolower
(
int
ch
)
{
...
...
@@ -448,8 +449,8 @@ std::to_chars_result to_chars(char *first, char *last, FloatType &value, chars_f
template
<
typename
FloatType
,
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatType
>
,
int
>
=
0
>
std
::
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
FloatType
&
value
,
chars_format
fmt
,
int
precision
)
{
int
size
=
last
-
first
;
int
r
;
int
size
=
static_cast
<
int
>
(
last
-
first
)
;
int
r
=
0
;
switch
(
fmt
)
{
...
...
include/cif++/utilities.hpp
View file @
15db026e
...
...
@@ -26,6 +26,8 @@
#pragma once
#include <cif++/exports.hpp>
#include <filesystem>
#ifndef STDOUT_FILENO
...
...
@@ -50,7 +52,7 @@
namespace
cif
{
extern
int
VERBOSE
;
extern
CIFPP_EXPORT
int
VERBOSE
;
// the git 'build' number
std
::
string
get_version_nr
();
...
...
include/cif++/validate.hpp
View file @
15db026e
...
...
@@ -26,13 +26,13 @@
#pragma once
#include <cif++/text.hpp>
#include <filesystem>
#include <list>
#include <mutex>
#include <utility>
#include <cif++/text.hpp>
namespace
cif
{
...
...
src/atom_type.cpp
View file @
15db026e
...
...
@@ -182,24 +182,24 @@ const struct ionic_radii
{
F
,
{
kNA
,
kNA
,
119
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
22
,
kNA
}
},
// Fluorine
{
Na
,
{
kNA
,
kNA
,
kNA
,
116
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Sodium
{
Mg
,
{
kNA
,
kNA
,
kNA
,
kNA
,
86
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Magnesium
{
Al
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
67.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Aluminium
{
Al
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
67.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Aluminium
{
Si
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
54
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Silicon
{
P
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
58
,
kNA
,
52
,
kNA
,
kNA
,
kNA
}
},
// Phosphorus
{
S
,
{
kNA
,
170
,
kNA
,
kNA
,
kNA
,
kNA
,
51
,
kNA
,
43
,
kNA
,
kNA
}
},
// Sulfur
{
Cl
,
{
kNA
,
kNA
,
181
,
kNA
,
kNA
,
kNA
,
kNA
,
26
,
kNA
,
41
,
kNA
}
},
// Chlorine
{
K
,
{
kNA
,
kNA
,
kNA
,
152
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Potassium
{
Ca
,
{
kNA
,
kNA
,
kNA
,
kNA
,
114
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Calcium
{
Sc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
88.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Scandium
{
Ti
,
{
kNA
,
kNA
,
kNA
,
kNA
,
100
,
81
,
74.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Titanium
{
Sc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
88.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Scandium
{
Ti
,
{
kNA
,
kNA
,
kNA
,
kNA
,
100
,
81
,
74.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Titanium
{
V
,
{
kNA
,
kNA
,
kNA
,
kNA
,
93
,
78
,
72
,
68
,
kNA
,
kNA
,
kNA
}
},
// Vanadium
{
Cr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
87
,
75.5
,
69
,
63
,
58
,
kNA
,
kNA
}
},
// Chromium ls
{
Cr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
87
,
75.5
f
,
69
,
63
,
58
,
kNA
,
kNA
}
},
// Chromium ls
// { Cr,{ kNA, kNA, kNA, kNA, 94, kNA, kNA, kNA, kNA, kNA, kNA } }, // Chromium hs
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
81
,
72
,
67
,
47
,
39.5
,
60
,
kNA
}
},
// Manganese ls
// { Mn,{ kNA, kNA, kNA, kNA, 97, 78.5, kNA, kNA, kNA, kNA, kNA } }, // Manganese hs
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
75
,
69
,
72.5
,
kNA
,
39
,
kNA
,
kNA
}
},
// Iron ls
// { Fe,{ kNA, kNA, kNA, kNA, 92, 78.5, kNA, kNA, kNA, kNA, kNA } }, // Iron hs
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
79
,
68.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt ls
// { Co,{ kNA, kNA, kNA, kNA, 88.5, 75, 67, kNA, kNA, kNA, kNA } }, // Cobalt hs
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
81
,
72
,
67
,
47
,
39.5
f
,
60
,
kNA
}
},
// Manganese ls
// { Mn,{ kNA, kNA, kNA, kNA, 97, 78.5
f
, kNA, kNA, kNA, kNA, kNA } }, // Manganese hs
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
75
,
69
,
72.5
f
,
kNA
,
39
,
kNA
,
kNA
}
},
// Iron ls
// { Fe,{ kNA, kNA, kNA, kNA, 92, 78.5
f
, kNA, kNA, kNA, kNA, kNA } }, // Iron hs
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
79
,
68.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt ls
// { Co,{ kNA, kNA, kNA, kNA, 88.5
f
, 75, 67, kNA, kNA, kNA, kNA } }, // Cobalt hs
{
Ni
,
{
kNA
,
kNA
,
kNA
,
kNA
,
83
,
70
,
62
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Nickel ls
// { Ni,{ kNA, kNA, kNA, kNA, kNA, 74, kNA, kNA, kNA, kNA, kNA } }, // Nickel hs
{
Cu
,
{
kNA
,
kNA
,
kNA
,
91
,
87
,
68
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Copper
...
...
@@ -215,10 +215,10 @@ const struct ionic_radii
{
Zr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
86
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Zirconium
{
Nb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
86
,
82
,
78
,
kNA
,
kNA
,
kNA
}
},
// Niobium
{
Mo
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
83
,
79
,
75
,
73
,
kNA
,
kNA
}
},
// Molybdenum
{
Tc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
78.5
,
74
,
kNA
,
70
,
kNA
}
},
// Technetium
{
Ru
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
82
,
76
,
70.5
,
kNA
,
52
,
150
}
},
// Ruthenium
{
Rh
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
80.5
,
74
,
69
,
kNA
,
kNA
,
kNA
}
},
// Rhodium
{
Pd
,
{
kNA
,
kNA
,
kNA
,
73
,
100
,
90
,
75.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Palladium
{
Tc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
78.5
f
,
74
,
kNA
,
70
,
kNA
}
},
// Technetium
{
Ru
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
82
,
76
,
70.5
f
,
kNA
,
52
,
150
}
},
// Ruthenium
{
Rh
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
80.5
f
,
74
,
69
,
kNA
,
kNA
,
kNA
}
},
// Rhodium
{
Pd
,
{
kNA
,
kNA
,
kNA
,
73
,
100
,
90
,
75.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Palladium
{
Ag
,
{
kNA
,
kNA
,
kNA
,
129
,
108
,
89
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Silver
{
Cd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
109
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cadmium
{
In
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
94
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Indium
...
...
@@ -229,32 +229,32 @@ const struct ionic_radii
{
Xe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
62
}
},
// Xenon
{
Cs
,
{
kNA
,
kNA
,
kNA
,
167
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Caesium
{
Ba
,
{
kNA
,
kNA
,
kNA
,
kNA
,
149
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Barium
{
La
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
117.2
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lanthanum
{
La
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
117.2
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lanthanum
{
Ce
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
115
,
101
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cerium
{
Pr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
113
,
99
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Praseodymium
{
Nd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
143
,
112.3
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Neodymium
{
Nd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
143
,
112.3
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Neodymium
{
Pm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
111
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Promethium
{
Sm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
136
,
109.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Samarium
{
Eu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
131
,
108.7
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Europium
{
Gd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
107.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Gadolinium
{
Tb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
106.3
,
90
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Terbium
{
Dy
,
{
kNA
,
kNA
,
kNA
,
kNA
,
121
,
105.2
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Dysprosium
{
Ho
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
104.1
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Holmium
{
Sm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
136
,
109.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Samarium
{
Eu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
131
,
108.7
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Europium
{
Gd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
107.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Gadolinium
{
Tb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
106.3
f
,
90
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Terbium
{
Dy
,
{
kNA
,
kNA
,
kNA
,
kNA
,
121
,
105.2
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Dysprosium
{
Ho
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
104.1
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Holmium
{
Er
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
103
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Erbium
{
Tm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
117
,
102
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thulium
{
Yb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
116
,
100.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Ytterbium
{
Lu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
100.1
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lutetium
{
Yb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
116
,
100.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Ytterbium
{
Lu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
100.1
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lutetium
{
Hf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
85
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Hafnium
{
Ta
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
86
,
82
,
78
,
kNA
,
kNA
,
kNA
}
},
// Tantalum
{
W
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
80
,
76
,
74
,
kNA
,
kNA
}
},
// Tungsten
{
Re
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
77
,
72
,
69
,
67
,
kNA
}
},
// Rhenium
{
Os
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
77
,
71.5
,
68.5
,
66.5
,
53
}
},
// Osmium
{
Ir
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
82
,
76.5
,
71
,
kNA
,
kNA
,
kNA
}
},
// Iridium
{
Pt
,
{
kNA
,
kNA
,
kNA
,
kNA
,
94
,
kNA
,
76.5
,
71
,
kNA
,
kNA
,
kNA
}
},
// Platinum
{
Os
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
77
,
71.5
f
,
68.5
f
,
66.5
f
,
53
}
},
// Osmium
{
Ir
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
82
,
76.5
f
,
71
,
kNA
,
kNA
,
kNA
}
},
// Iridium
{
Pt
,
{
kNA
,
kNA
,
kNA
,
kNA
,
94
,
kNA
,
76.5
f
,
71
,
kNA
,
kNA
,
kNA
}
},
// Platinum
{
Au
,
{
kNA
,
kNA
,
kNA
,
151
,
kNA
,
99
,
kNA
,
71
,
kNA
,
kNA
,
kNA
}
},
// Gold
{
Hg
,
{
kNA
,
kNA
,
kNA
,
133
,
116
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Mercury
{
Tl
,
{
kNA
,
kNA
,
kNA
,
164
,
kNA
,
102.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thallium
{
Pb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
133
,
kNA
,
91.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lead
{
Tl
,
{
kNA
,
kNA
,
kNA
,
164
,
kNA
,
102.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thallium
{
Pb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
133
,
kNA
,
91.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lead
{
Bi
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
117
,
kNA
,
90
,
kNA
,
kNA
,
kNA
}
},
// Bismuth
{
Po
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
108
,
kNA
,
81
,
kNA
,
kNA
}
},
// Polonium
{
At
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
76
,
kNA
}
},
// Astatine
...
...
@@ -263,16 +263,16 @@ const struct ionic_radii
{
Ac
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
126
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Actinium
{
Th
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
108
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thorium
{
Pa
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
116
,
104
,
92
,
kNA
,
kNA
,
kNA
}
},
// Protactinium
{
U
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
116.5
,
103
,
90
,
87
,
kNA
,
kNA
}
},
// Uranium
{
U
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
116.5
f
,
103
,
90
,
87
,
kNA
,
kNA
}
},
// Uranium
{
Np
,
{
kNA
,
kNA
,
kNA
,
kNA
,
124
,
115
,
101
,
89
,
86
,
85
,
kNA
}
},
// Neptunium
{
Pu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
114
,
100
,
88
,
85
,
kNA
,
kNA
}
},
// Plutonium
{
Am
,
{
kNA
,
kNA
,
kNA
,
kNA
,
140
,
111.5
,
99
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Americium
{
Am
,
{
kNA
,
kNA
,
kNA
,
kNA
,
140
,
111.5
f
,
99
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Americium
{
Cm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
111
,
99
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Curium
{
Bk
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
110
,
97
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Berkelium
{
Cf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
109
,
96.1
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Californium
{
Es
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
92.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Einsteinium
{
Cf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
109
,
96.1
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Californium
{
Es
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
92.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Einsteinium
},
kEffectiveIonicRadii
[]
=
{
{
H
,
{
kNA
,
kNA
,
139.9
,
-
18
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Hydrogen
{
H
,
{
kNA
,
kNA
,
139.9
f
,
-
18
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Hydrogen
{
Li
,
{
kNA
,
kNA
,
kNA
,
76
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lithium
{
Be
,
{
kNA
,
kNA
,
kNA
,
kNA
,
45
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Beryllium
{
B
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
27
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Boron
...
...
@@ -282,24 +282,24 @@ const struct ionic_radii
{
F
,
{
kNA
,
kNA
,
133
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
8
,
kNA
}
},
// Fluorine
{
Na
,
{
kNA
,
kNA
,
kNA
,
102
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Sodium
{
Mg
,
{
kNA
,
kNA
,
kNA
,
kNA
,
72
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Magnesium
{
Al
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
53.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Aluminium
{
Al
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
53.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Aluminium
{
Si
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
40
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Silicon
{
P
,
{
212
,
kNA
,
kNA
,
kNA
,
kNA
,
44
,
kNA
,
38
,
kNA
,
kNA
,
kNA
}
},
// Phosphorus
{
S
,
{
kNA
,
184
,
kNA
,
kNA
,
kNA
,
kNA
,
37
,
kNA
,
29
,
kNA
,
kNA
}
},
// Sulfur
{
Cl
,
{
kNA
,
kNA
,
181
,
kNA
,
kNA
,
kNA
,
kNA
,
12
,
kNA
,
27
,
kNA
}
},
// Chlorine
{
K
,
{
kNA
,
kNA
,
kNA
,
138
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Potassium
{
Ca
,
{
kNA
,
kNA
,
kNA
,
kNA
,
100
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Calcium
{
Sc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
74.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Scandium
{
Ti
,
{
kNA
,
kNA
,
kNA
,
kNA
,
86
,
67
,
60.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Titanium
{
Sc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
74.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Scandium
{
Ti
,
{
kNA
,
kNA
,
kNA
,
kNA
,
86
,
67
,
60.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Titanium
{
V
,
{
kNA
,
kNA
,
kNA
,
kNA
,
79
,
64
,
58
,
54
,
kNA
,
kNA
,
kNA
}
},
// Vanadium
{
Cr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
73
,
61.5
,
55
,
49
,
44
,
kNA
,
kNA
}
},
// Chromium ls
{
Cr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
73
,
61.5
f
,
55
,
49
,
44
,
kNA
,
kNA
}
},
// Chromium ls
{
Cr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
80
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Chromium hs
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
67
,
58
,
53
,
33
,
25.5
,
46
,
kNA
}
},
// Manganese ls
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
83
,
64.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Manganese hs
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
61
,
55
,
58.5
,
kNA
,
25
,
kNA
,
kNA
}
},
// Iron ls
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
78
,
64.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Iron hs
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
65
,
54.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt ls
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
74.5
,
61
,
53
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt hs
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
67
,
58
,
53
,
33
,
25.5
f
,
46
,
kNA
}
},
// Manganese ls
{
Mn
,
{
kNA
,
kNA
,
kNA
,
kNA
,
83
,
64.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Manganese hs
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
61
,
55
,
58.5
f
,
kNA
,
25
,
kNA
,
kNA
}
},
// Iron ls
{
Fe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
78
,
64.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Iron hs
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
65
,
54.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt ls
{
Co
,
{
kNA
,
kNA
,
kNA
,
kNA
,
74.5
f
,
61
,
53
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cobalt hs
{
Ni
,
{
kNA
,
kNA
,
kNA
,
kNA
,
69
,
56
,
48
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Nickel ls
{
Ni
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
60
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Nickel hs
{
Cu
,
{
kNA
,
kNA
,
kNA
,
77
,
73
,
54
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Copper
...
...
@@ -315,10 +315,10 @@ const struct ionic_radii
{
Zr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
72
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Zirconium
{
Nb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
72
,
68
,
64
,
kNA
,
kNA
,
kNA
}
},
// Niobium
{
Mo
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
69
,
65
,
61
,
59
,
kNA
,
kNA
}
},
// Molybdenum
{
Tc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
64.5
,
60
,
kNA
,
56
,
kNA
}
},
// Technetium
{
Ru
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
68
,
62
,
56.5
,
kNA
,
38
,
36
}
},
// Ruthenium
{
Rh
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
66.5
,
60
,
55
,
kNA
,
kNA
,
kNA
}
},
// Rhodium
{
Pd
,
{
kNA
,
kNA
,
kNA
,
59
,
86
,
76
,
61.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Palladium
{
Tc
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
64.5
f
,
60
,
kNA
,
56
,
kNA
}
},
// Technetium
{
Ru
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
68
,
62
,
56.5
f
,
kNA
,
38
,
36
}
},
// Ruthenium
{
Rh
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
66.5
f
,
60
,
55
,
kNA
,
kNA
,
kNA
}
},
// Rhodium
{
Pd
,
{
kNA
,
kNA
,
kNA
,
59
,
86
,
76
,
61.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Palladium
{
Ag
,
{
kNA
,
kNA
,
kNA
,
115
,
94
,
75
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Silver
{
Cd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
95
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cadmium
{
In
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
80
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Indium
...
...
@@ -329,48 +329,48 @@ const struct ionic_radii
{
Xe
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
48
}
},
// Xenon
{
Cs
,
{
kNA
,
kNA
,
kNA
,
167
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Caesium
{
Ba
,
{
kNA
,
kNA
,
kNA
,
kNA
,
135
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Barium
{
La
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
103.2
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lanthanum
{
La
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
103.2
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lanthanum
{
Ce
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
101
,
87
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Cerium
{
Pr
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
99
,
85
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Praseodymium
{
Nd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
129
,
98.3
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Neodymium
{
Nd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
129
,
98.3
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Neodymium
{
Pm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
97
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Promethium
{
Sm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
122
,
95.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Samarium
{
Eu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
117
,
94.7
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Europium
{
Gd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
93.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Gadolinium
{
Tb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
92.3
,
76
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Terbium
{
Dy
,
{
kNA
,
kNA
,
kNA
,
kNA
,
107
,
91.2
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Dysprosium
{
Ho
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
90.1
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Holmium
{
Sm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
122
,
95.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Samarium
{
Eu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
117
,
94.7
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Europium
{
Gd
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
93.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Gadolinium
{
Tb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
92.3
f
,
76
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Terbium
{
Dy
,
{
kNA
,
kNA
,
kNA
,
kNA
,
107
,
91.2
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Dysprosium
{
Ho
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
90.1
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Holmium
{
Er
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
89
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Erbium
{
Tm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
103
,
88
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thulium
{
Yb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
102
,
86.8
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Ytterbium
{
Lu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
86.1
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lutetium
{
Yb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
102
,
86.8
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Ytterbium
{
Lu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
86.1
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lutetium
{
Hf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
71
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Hafnium
{
Ta
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
72
,
68
,
64
,
kNA
,
kNA
,
kNA
}
},
// Tantalum
{
W
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
66
,
62
,
60
,
kNA
,
kNA
}
},
// Tungsten
{
Re
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
63
,
58
,
55
,
53
,
kNA
}
},
// Rhenium
{
Os
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
63
,
57.5
,
54.5
,
52.5
,
39
}
},
// Osmium
{
Ir
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
68
,
62.5
,
57
,
kNA
,
kNA
,
kNA
}
},
// Iridium
{
Pt
,
{
kNA
,
kNA
,
kNA
,
kNA
,
80
,
kNA
,
62.5
,
57
,
kNA
,
kNA
,
kNA
}
},
// Platinum
{
Os
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
63
,
57.5
f
,
54.5
f
,
52.5
f
,
39
}
},
// Osmium
{
Ir
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
68
,
62.5
f
,
57
,
kNA
,
kNA
,
kNA
}
},
// Iridium
{
Pt
,
{
kNA
,
kNA
,
kNA
,
kNA
,
80
,
kNA
,
62.5
f
,
57
,
kNA
,
kNA
,
kNA
}
},
// Platinum
{
Au
,
{
kNA
,
kNA
,
kNA
,
137
,
kNA
,
85
,
kNA
,
57
,
kNA
,
kNA
,
kNA
}
},
// Gold
{
Hg
,
{
kNA
,
kNA
,
kNA
,
119
,
102
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Mercury
{
Tl
,
{
kNA
,
kNA
,
kNA
,
150
,
kNA
,
88.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thallium
{
Pb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
119
,
kNA
,
77.5
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lead
{
Tl
,
{
kNA
,
kNA
,
kNA
,
150
,
kNA
,
88.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thallium
{
Pb
,
{
kNA
,
kNA
,
kNA
,
kNA
,
119
,
kNA
,
77.5
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Lead
{
Bi
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
103
,
kNA
,
76
,
kNA
,
kNA
,
kNA
}
},
// Bismuth
{
Po
,
{
kNA
,
223
,
kNA
,
kNA
,
kNA
,
kNA
,
94
,
kNA
,
67
,
kNA
,
kNA
}
},
// Polonium
{
At
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
62
,
kNA
}
},
// Astatine
{
Fr
,
{
kNA
,
kNA
,
kNA
,
180
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Francium
{
Ra
,
{
kNA
,
kNA
,
kNA
,
kNA
,
148
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Radium
{
Ac
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
106.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Actinium
{
Ac
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
106.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Actinium
{
Th
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
94
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Thorium
{
Pa
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
104
,
90
,
78
,
kNA
,
kNA
,
kNA
}
},
// Protactinium
{
U
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
102.5
,
89
,
76
,
73
,
kNA
,
kNA
}
},
// Uranium
{
U
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
102.5
f
,
89
,
76
,
73
,
kNA
,
kNA
}
},
// Uranium
{
Np
,
{
kNA
,
kNA
,
kNA
,
kNA
,
110
,
101
,
87
,
75
,
72
,
71
,
kNA
}
},
// Neptunium
{
Pu
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
100
,
86
,
74
,
71
,
kNA
,
kNA
}
},
// Plutonium
{
Am
,
{
kNA
,
kNA
,
kNA
,
kNA
,
126
,
97.5
,
85
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Americium
{
Am
,
{
kNA
,
kNA
,
kNA
,
kNA
,
126
,
97.5
f
,
85
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Americium
{
Cm
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
97
,
85
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Curium
{
Bk
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
96
,
83
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Berkelium
{
Cf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
95
,
82.1
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Californium
{
Es
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
83.5
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Einsteinium
{
Cf
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
95
,
82.1
f
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Californium
{
Es
,
{
kNA
,
kNA
,
kNA
,
kNA
,
kNA
,
83.5
f
,
kNA
,
kNA
,
kNA
,
kNA
,
kNA
}
},
// Einsteinium
};
...
...
src/category.cpp
View file @
15db026e
...
...
@@ -24,14 +24,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <numeric>
#include <stack>
#include <cif++/category.hpp>
#include <cif++/datablock.hpp>
#include <cif++/parser.hpp>
#include <cif++/utilities.hpp>
#include <numeric>
#include <stack>
// TODO: Find out what the rules are exactly for linked items, the current implementation
// is inconsistent. It all depends whether a link is satified if a field taking part in the
// set of linked items is null at one side and not null in the other.
...
...
@@ -1241,10 +1241,10 @@ size_t category::erase(condition &&cond, std::function<void(row_handle)> &&visit
for
(
auto
&&
[
childCat
,
link
]
:
m_child_links
)
{
auto
cond
=
get_children_condition
(
*
ri
,
*
childCat
);
if
(
not
cond
)
auto
c
c
ond
=
get_children_condition
(
*
ri
,
*
childCat
);
if
(
not
c
c
ond
)
continue
;
potential_orphans
[
childCat
]
=
std
::
move
(
potential_orphans
[
childCat
])
or
std
::
move
(
cond
);
potential_orphans
[
childCat
]
=
std
::
move
(
potential_orphans
[
childCat
])
or
std
::
move
(
c
c
ond
);
}
save_value
sv
(
m_validator
);
...
...
src/compound.cpp
View file @
15db026e
...
...
@@ -24,16 +24,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++/compound.hpp>
#include <filesystem>
#include <fstream>
#include <map>
#include <mutex>
#include <numeric>
#include <shared_mutex>
#include <filesystem>
#include <fstream>
#include <cif++/compound.hpp>
namespace
fs
=
std
::
filesystem
;
namespace
cif
...
...
src/item.cpp
View file @
15db026e
...
...
@@ -24,10 +24,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cassert>
#include <cif++/row.hpp>
#include <cassert>
namespace
cif
{
...
...
src/model.cpp
View file @
15db026e
...
...
@@ -34,8 +34,6 @@
namespace
fs
=
std
::
filesystem
;
extern
int
VERBOSE
;
namespace
cif
::
mm
{
...
...
@@ -954,7 +952,7 @@ float monomer::omega(const monomer &a, const monomer &b)
bool
monomer
::
is_cis
(
const
monomer
&
a
,
const
monomer
&
b
)
{
return
omega
(
a
,
b
)
<
30.0
f
;
return
std
::
abs
(
omega
(
a
,
b
)
)
<
30.0
f
;
}
// --------------------------------------------------------------------
...
...
@@ -1155,7 +1153,7 @@ branch::branch(structure &structure, const std::string &asym_id, const std::stri
auto
&
branch_scheme
=
db
[
"pdbx_branch_scheme"
];
auto
&
branch_link
=
db
[
"pdbx_entity_branch_link"
];
for
(
const
auto
&
entity_id
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
for
(
const
auto
&
asym_
entity_id
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
{
for
(
const
auto
&
[
comp_id
,
num
]
:
branch_scheme
.
find
<
std
::
string
,
int
>
(
"asym_id"
_key
==
asym_id
,
"mon_id"
,
"pdb_seq_num"
))
...
...
@@ -1164,7 +1162,7 @@ branch::branch(structure &structure, const std::string &asym_id, const std::stri
}
for
(
const
auto
&
[
num1
,
num2
,
atom1
,
atom2
]
:
branch_link
.
find
<
size_t
,
size_t
,
std
::
string
,
std
::
string
>
(
"entity_id"
_key
==
entity_id
,
"entity_branch_list_num_1"
,
"entity_branch_list_num_2"
,
"atom_id_1"
,
"atom_id_2"
))
"entity_id"
_key
==
asym_
entity_id
,
"entity_branch_list_num_1"
,
"entity_branch_list_num_2"
,
"atom_id_1"
,
"atom_id_2"
))
{
// if (not iequals(atom1, "c1"))
// throw std::runtime_error("invalid pdbx_entity_branch_link");
...
...
@@ -1238,7 +1236,7 @@ sugar &branch::construct_sugar(const std::string &compound_id)
{
"type"
,
compound
->
type
()}});
}
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
s
ize
()
+
1
);
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
s
tatic_cast
<
int
>
(
size
()
+
1
)
);
db
[
"pdbx_branch_scheme"
].
emplace
({
{
"asym_id"
,
result
.
get_asym_id
()},
...
...
@@ -2388,181 +2386,181 @@ branch &structure::create_branch()
return
m_branches
.
emplace_back
(
*
this
,
asym_id
,
entity_id
);
}
branch
&
structure
::
create_branch
(
std
::
vector
<
row_initializer
>
atoms
)
{
// // sanity check
// for (auto &nag_atom : atoms)
// branch &structure::create_branch(std::vector<row_initializer> atoms)
// {
// for (const auto &[name, value] : nag_atom)
// {
// if (name == "label_comp_id" and value != "NAG")
// throw std::logic_error("The first sugar in a branch should be a NAG");
// }
// // // sanity check
// // for (auto &nag_atom : atoms)
// // {
// // for (const auto &[name, value] : nag_atom)
// // {
// // if (name == "label_comp_id" and value != "NAG")
// // throw std::logic_error("The first sugar in a branch should be a NAG");
// // }
// // }
// // using namespace literals;
// // auto &branch = create_branch();
// // auto asym_id = branch.get_asym_id();
// // auto entity_id = branch.get_entity_id();
// // auto &sugar = branch.emplace_back(branch, "NAG", asym_id, 1);
// // auto &atom_site = m_db["atom_site"];
// // for (auto &atom : atoms)
// // {
// // auto atom_id = atom_site.get_unique_id("");
// // atom.set_value("id", atom_id);
// // atom.set_value("label_asym_id", asym_id);
// // atom.set_value("auth_asym_id", asym_id);
// // atom.set_value("label_entity_id", entity_id);
// // atom.set_value({ "auth_seq_id", 1 });
// // atom.set_value_if_empty({"group_PDB", "HETATM"});
// // atom.set_value_if_empty({"label_comp_id", "NAG"});
// // atom.set_value_if_empty({"label_seq_id", "."});
// // atom.set_value_if_empty({"auth_comp_id", "NAG"});
// // atom.set_value_if_empty({"pdbx_PDB_model_num", 1});
// // atom.set_value_if_empty({"label_alt_id", ""});
// // auto row = atom_site.emplace(atom.begin(), atom.end());
// // auto &newAtom = emplace_atom(std::make_shared<atom::atom_impl>(m_db, atom_id));
// // sugar.add_atom(newAtom);
// // }
// // // // now we can create the entity and get the real ID
// // // auto entity_id = create_entity_for_branch(branch);
// // // assert(not entity_id.empty());
// // for (auto &a : sugar.atoms())
// // a.set_property("label_entity_id", entity_id);
// // m_db["pdbx_branch_scheme"].emplace({
// // {"asym_id", asym_id},
// // {"entity_id", entity_id},
// // {"num", 1},
// // {"mon_id", "NAG"},
// // {"pdb_asym_id", asym_id},
// // {"pdb_seq_num", 1},
// // {"pdb_mon_id", "NAG"},
// // // TODO: need fix, collect from nag_atoms?
// // {"auth_asym_id", asym_id},
// // {"auth_mon_id", "NAG"},
// // {"auth_seq_num", 1},
// // {"hetero", "n"}
// // });
// // return branch;
// }
// using namespace literals;
// auto &branch = create_branch();
// auto asym_id = branch.get_asym_id();
// auto entity_id = branch.get_entity_id();
// auto &sugar = branch.emplace_back(branch, "NAG", asym_id, 1);
// auto &atom_site = m_db["atom_site"];
// for (auto &atom : atoms)
// branch &structure::extend_branch(const std::string &asym_id, std::vector<row_initializer> atom_info,
// int link_sugar, const std::string &link_atom)
// {
// auto atom_id = atom_site.get_unique_id("");
// atom.set_value("id", atom_id);
// atom.set_value("label_asym_id", asym_id);
// atom.set_value("auth_asym_id", asym_id);
// atom.set_value("label_entity_id", entity_id);
// atom.set_value({ "auth_seq_id", 1 });
// // // sanity check
// // std::string compoundID;
//
atom.set_value_if_empty({"group_PDB", "HETATM"});
//
atom.set_value_if_empty({"label_comp_id", "NAG"});
//
atom.set_value_if_empty({"label_seq_id", "."});
//
atom.set_value_if_empty({"auth_comp_id", "NAG"});
//
atom.set_value_if_empty({"pdbx_PDB_model_num", 1});
//
atom.set_value_if_empty({"label_alt_id", ""})
;
//
// for (auto &atom : atom_info)
//
// {
//
// for (const auto &[name, value] : atom)
//
// {
//
// if (name != "label_comp_id")
//
// continue
;
// auto row = atom_site.emplace(atom.begin(), atom.end());
// // if (compoundID.empty())
// // compoundID = value;
// // else if (value != compoundID)
// // throw std::logic_error("All atoms should be of the same type");
// // }
// // }
// auto &newAtom = emplace_atom(std::make_shared<atom::atom_impl>(m_db, atom_id));
// sugar.add_atom(newAtom);
// }
// // using namespace literals;
// // // now we can create the entity and get the real ID
// // auto entity_id = create_entity_for_branch(branch);
// // assert(not entity_id.empty());
// // // auto &branch = m_branches.emplace_back(*this, asym_id);
// // auto tmp_entity_id = m_db["entity"].get_unique_id("");
// for (auto &a : sugar.atoms())
// a.set_property("label_entity_id", entity_id);
// // auto &atom_site = m_db["atom_site"];
// m_db["pdbx_branch_scheme"].emplace({
// {"asym_id", asym_id},
// {"entity_id", entity_id},
// {"num", 1},
// {"mon_id", "NAG"},
// // auto bi = std::find_if(m_branches.begin(), m_branches.end(), [asym_id](branch &b)
// // { return b.get_asym_id() == asym_id; });
// // if (bi == m_branches.end())
// // throw std::logic_error("Create a branch first!");
// {"pdb_asym_id", asym_id},
// {"pdb_seq_num", 1},
// {"pdb_mon_id", "NAG"},
// // branch &branch = *bi;
// // TODO: need fix, collect from nag_atoms?
// {"auth_asym_id", asym_id},
// {"auth_mon_id", "NAG"},
// {"auth_seq_num", 1},
// // int sugarNum = static_cast<int>(branch.size() + 1);
// {"hetero", "n"}
// });
// // auto &sugar = branch.emplace_back(branch, compoundID, asym_id, sugarNum);
// return branch;
}
// // for (auto &atom : atom_info)
// // {
// // auto atom_id = atom_site.get_unique_id("");
branch
&
structure
::
extend_branch
(
const
std
::
string
&
asym_id
,
std
::
vector
<
row_initializer
>
atom_info
,
int
link_sugar
,
const
std
::
string
&
link_atom
)
{
//
// sanity check
//
std::string compoundID
;
// // atom.set_value("id", atom_id);
// // atom.set_value("label_asym_id", asym_id);
// // atom.set_value("auth_asym_id", asym_id);
//
// atom.set_value("label_entity_id", tmp_entity_id);
//
// atom.set_value({"auth_seq_id", sugarNum })
;
// for (auto &atom : atom_info)
// {
// for (const auto &[name, value] : atom)
// {
// if (name != "label_comp_id")
// continue;
// // atom.set_value_if_empty({"group_PDB", "HETATM"});
// // atom.set_value_if_empty({"label_comp_id", compoundID});
// // atom.set_value_if_empty({"auth_comp_id", compoundID});
// // atom.set_value_if_empty({"pdbx_PDB_model_num", 1});
// // atom.set_value_if_empty({"label_alt_id", ""});
// if (compoundID.empty())
// compoundID = value;
// else if (value != compoundID)
// throw std::logic_error("All atoms should be of the same type");
// }
// }
// using namespace literals;
// // auto row = atom_site.emplace(atom.begin(), atom.end());
// // auto &branch = m_branches.emplace_back(*this, asym_id);
// auto tmp_entity_id = m_db["entity"].get_unique_id("");
// // auto &newAtom = emplace_atom(std::make_shared<atom::atom_impl>(m_db, atom_id));
// // sugar.add_atom(newAtom);
// // }
//
auto &atom_site = m_db["atom_site"]
;
//
// sugar.set_link(branch.at(link_sugar - 1).get_atom_by_atom_id(link_atom))
;
// auto bi = std::find_if(m_branches.begin(), m_branches.end(), [asym_id](branch &b)
// { return b.get_asym_id() == asym_id; });
// if (bi == m_branches.end())
// throw std::logic_error("Create a branch first!");
// branch &branch = *bi;
// int sugarNum = static_cast<int>(branch.size() + 1);
// auto &sugar = branch.emplace_back(branch, compoundID, asym_id, sugarNum);
// for (auto &atom : atom_info)
// {
// auto atom_id = atom_site.get_unique_id("");
// atom.set_value("id", atom_id);
// atom.set_value("label_asym_id", asym_id);
// atom.set_value("auth_asym_id", asym_id);
// atom.set_value("label_entity_id", tmp_entity_id);
// atom.set_value({"auth_seq_id", sugarNum });
// atom.set_value_if_empty({"group_PDB", "HETATM"});
// atom.set_value_if_empty({"label_comp_id", compoundID});
// atom.set_value_if_empty({"auth_comp_id", compoundID});
// atom.set_value_if_empty({"pdbx_PDB_model_num", 1});
// atom.set_value_if_empty({"label_alt_id", ""});
// auto row = atom_site.emplace(atom.begin(), atom.end());
// auto &newAtom = emplace_atom(std::make_shared<atom::atom_impl>(m_db, atom_id));
// sugar.add_atom(newAtom);
// }
// sugar.set_link(branch.at(link_sugar - 1).get_atom_by_atom_id(link_atom));
// auto entity_id = create_entity_for_branch(branch);
// // Update the entity id of the asym
// auto &struct_asym = m_db["struct_asym"];
// auto r = struct_asym.find1("id"_key == asym_id);
// r["entity_id"] = entity_id;
// for (auto &s2 : branch)
// {
// for (auto atom : s2.atoms())
// atom.set_property("label_entity_id", entity_id);
// }
// auto &pdbx_branch_scheme = m_db["pdbx_branch_scheme"];
// pdbx_branch_scheme.erase("asym_id"_key == asym_id);
// // auto entity_id = create_entity_for_branch(branch);
// for (auto &s2 : branch)
// {
// pdbx_branch_scheme.emplace({
// {"asym_id", asym_id},
// {"entity_id", entity_id},
// {"num", s2.num()},
// {"mon_id", s2.get_compound_id()},
// {"pdb_asym_id", asym_id},
// {"pdb_seq_num", s2.num()},
// {"pdb_mon_id", s2.get_compound_id()},
// // TODO: need fix, collect from nag_atoms?
// {"auth_asym_id", asym_id},
// {"auth_mon_id", s2.get_compound_id()},
// {"auth_seq_num", s2.get_auth_seq_id()},
// {"hetero", "n"}
// });
// // // Update the entity id of the asym
// // auto &struct_asym = m_db["struct_asym"];
// // auto r = struct_asym.find1("id"_key == asym_id);
// // r["entity_id"] = entity_id;
// // for (auto &s2 : branch)
// // {
// // for (auto atom : s2.atoms())
// // atom.set_property("label_entity_id", entity_id);
// // }
// // auto &pdbx_branch_scheme = m_db["pdbx_branch_scheme"];
// // pdbx_branch_scheme.erase("asym_id"_key == asym_id);
// // for (auto &s2 : branch)
// // {
// // pdbx_branch_scheme.emplace({
// // {"asym_id", asym_id},
// // {"entity_id", entity_id},
// // {"num", s2.num()},
// // {"mon_id", s2.get_compound_id()},
// // {"pdb_asym_id", asym_id},
// // {"pdb_seq_num", s2.num()},
// // {"pdb_mon_id", s2.get_compound_id()},
// // // TODO: need fix, collect from nag_atoms?
// // {"auth_asym_id", asym_id},
// // {"auth_mon_id", s2.get_compound_id()},
// // {"auth_seq_num", s2.get_auth_seq_id()},
// // {"hetero", "n"}
// // });
// // }
// // return branch;
// }
// return branch;
}
std
::
string
structure
::
create_entity_for_branch
(
branch
&
branch
)
{
using
namespace
literals
;
...
...
src/parser.cpp
View file @
15db026e
...
...
@@ -24,22 +24,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cassert>
#include <iostream>
#include <map>
#include <regex>
#include <stack>
#include <cif++/utilities.hpp>
#include <cif++/forward_decl.hpp>
#include <cif++/parser.hpp>
#include <cif++/file.hpp>
namespace
cif
{
extern
int
VERBOSE
;
}
#include <cassert>
#include <iostream>
#include <map>
#include <regex>
#include <stack>
namespace
cif
{
...
...
src/pdb/cif2pdb.cpp
View file @
15db026e
...
...
@@ -24,6 +24,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++.hpp>
#include <cif++/pdb/cif2pdb.hpp>
#include <cif++/gzio.hpp>
#include <cmath>
#include <deque>
#include <iomanip>
...
...
@@ -31,9 +35,6 @@
#include <regex>
#include <set>
#include <cif++.hpp>
#include <cif++/pdb/cif2pdb.hpp>
#include <cif++/gzio.hpp>
namespace
cif
::
pdb
{
...
...
src/pdb/pdb2cif.cpp
View file @
15db026e
...
...
@@ -24,17 +24,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iomanip>
#include <map>
#include <set>
#include <stack>
#include <cif++.hpp>
#include <cif++/pdb/pdb2cif.hpp>
#include <cif++/pdb/pdb2cif_remark_3.hpp>
#include <cif++/gzio.hpp>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
using
cif
::
category
;
using
cif
::
datablock
;
using
cif
::
iequals
;
...
...
src/pdb/pdb2cif_remark_3.cpp
View file @
15db026e
...
...
@@ -25,12 +25,11 @@
*/
#include <cif++.hpp>
#include <cif++/pdb/pdb2cif_remark_3.hpp>
#include <map>
#include <set>
#include <cif++/pdb/pdb2cif_remark_3.hpp>
namespace
cif
::
pdb
{
...
...
src/pdb/tls.cpp
View file @
15db026e
...
...
@@ -27,12 +27,12 @@
// #include <sys/ioctl.h>
// #include <termios.h>
#include <iomanip>
#include <iostream>
#include <cif++.hpp>
#include <cif++/pdb/tls.hpp>
#include <iomanip>
#include <iostream>
namespace
cif
{
...
...
src/point.cpp
View file @
15db026e
...
...
@@ -24,11 +24,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++/point.hpp>
#include <cassert>
#include <random>
#include <cif++/point.hpp>
namespace
cif
{
...
...
@@ -369,7 +369,7 @@ quaternion construct_for_dihedral_angle(point p1, point p2, point p3, point p4,
float
dh
=
dihedral_angle
(
p1
,
p2
,
p3
,
p4
);
for
(
int
iteration
=
0
;
iteration
<
100
;
++
iteration
)
{
float
delta
=
std
::
fmod
(
angle
-
dh
,
360
);
float
delta
=
std
::
fmod
(
angle
-
dh
,
360
.0
f
);
if
(
delta
<
-
180
)
delta
+=
360
;
...
...
src/symmetry.cpp
View file @
15db026e
...
...
@@ -24,10 +24,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdexcept>
#include <cif++/symmetry.hpp>
#include <stdexcept>
#include "./symop_table_data.hpp"
namespace
cif
...
...
src/text.cpp
View file @
15db026e
...
...
@@ -24,11 +24,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++/text.hpp>
#include <algorithm>
#include <cassert>
#include <cif++/text.hpp>
namespace
cif
{
...
...
src/utilities.cpp
View file @
15db026e
...
...
@@ -24,6 +24,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++/utilities.hpp>
#include "revision.hpp"
#include <atomic>
#include <cassert>
#include <cmath>
...
...
@@ -44,10 +47,6 @@
#include <termios.h>
#endif
#include <cif++/utilities.hpp>
#include "revision.hpp"
namespace
fs
=
std
::
filesystem
;
// --------------------------------------------------------------------
...
...
@@ -408,9 +407,9 @@ struct rsrc_imp
#if _MSC_VER
extern
"C"
const
mrsrc
::
rsrc_imp
*
gResourceIndexDefault
[
1
]
=
{};
extern
"C"
const
char
*
gResourceDataDefault
[
1
]
=
{};
extern
"C"
const
char
*
gResourceNameDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
mrsrc
::
rsrc_imp
*
gResourceIndexDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
char
*
gResourceDataDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
char
*
gResourceNameDefault
[
1
]
=
{};
extern
"C"
const
mrsrc
::
rsrc_imp
gResourceIndex
[];
extern
"C"
const
char
gResourceData
[];
...
...
src/validate.cpp
View file @
15db026e
...
...
@@ -24,6 +24,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cif++/dictionary_parser.hpp>
#include <cif++/validate.hpp>
#include <cif++/utilities.hpp>
#include <cif++/gzio.hpp>
#include <cassert>
#include <fstream>
#include <iostream>
...
...
@@ -41,12 +46,6 @@ using boost::regex;
using
std
::
regex
;
#endif
#include <cif++/dictionary_parser.hpp>
#include <cif++/validate.hpp>
#include <cif++/utilities.hpp>
#include <cif++/gzio.hpp>
namespace
cif
{
...
...
test/sugar-test.cpp
View file @
15db026e
...
...
@@ -96,87 +96,87 @@ BOOST_AUTO_TEST_CASE(sugar_name_1)
}
}
// --------------------------------------------------------------------
//
//
--------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
create_sugar_1
)
{
using
namespace
cif
::
literals
;
//
BOOST_AUTO_TEST_CASE(create_sugar_1)
//
{
//
using namespace cif::literals;
const
std
::
filesystem
::
path
example
(
gTestDir
/
"1juh.cif.gz"
);
cif
::
file
file
(
example
.
string
());
cif
::
mm
::
structure
s
(
file
);
//
const std::filesystem::path example(gTestDir / "1juh.cif.gz");
//
cif::file file(example.string());
//
cif::mm::structure s(file);
// collect atoms from asym L first
auto
&
NAG
=
s
.
get_residue
(
"L"
);
auto
nagAtoms
=
NAG
.
atoms
();
//
// collect atoms from asym L first
//
auto &NAG = s.get_residue("L");
//
auto nagAtoms = NAG.atoms();
std
::
vector
<
cif
::
row_initializer
>
ai
;
//
std::vector<cif::row_initializer> ai;
auto
&
db
=
s
.
get_datablock
();
auto
&
as
=
db
[
"atom_site"
];
//
auto &db = s.get_datablock();
//
auto &as = db["atom_site"];
// NOTE, row_initializer does not actually hold the data, so copy it first
// before it gets destroyed by remove_residue
//
// NOTE, row_initializer does not actually hold the data, so copy it first
//
// before it gets destroyed by remove_residue
for
(
auto
r
:
as
.
find
(
"label_asym_id"
_key
==
"L"
))
/*auto &ri = */
ai
.
emplace_back
(
r
);
//
for (auto r : as.find("label_asym_id"_key == "L"))
//
/*auto &ri = */ai.emplace_back(r);
s
.
remove_residue
(
NAG
);
//
s.remove_residue(NAG);
auto
&
branch
=
s
.
create_branch
(
ai
);
//
auto &branch = s.create_branch(ai);
BOOST_CHECK_EQUAL
(
branch
.
name
(),
"2-acetamido-2-deoxy-beta-D-glucopyranose"
);
BOOST_CHECK_EQUAL
(
branch
.
size
(),
1
);
//
BOOST_CHECK_EQUAL(branch.name(), "2-acetamido-2-deoxy-beta-D-glucopyranose");
//
BOOST_CHECK_EQUAL(branch.size(), 1);
BOOST_CHECK_EQUAL
(
branch
[
0
].
atoms
().
size
(),
nagAtoms
.
size
());
//
BOOST_CHECK_EQUAL(branch[0].atoms().size(), nagAtoms.size());
BOOST_CHECK
(
file
.
is_valid
());
//
BOOST_CHECK(file.is_valid());
file
.
save
(
gTestDir
/
"test-create_sugar_1.cif"
);
}
//
file.save(gTestDir / "test-create_sugar_1.cif");
//
}
// --------------------------------------------------------------------
//
//
--------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
create_sugar_2
)
{
using
namespace
cif
::
literals
;
//
BOOST_AUTO_TEST_CASE(create_sugar_2)
//
{
//
using namespace cif::literals;
const
std
::
filesystem
::
path
example
(
gTestDir
/
"1juh.cif.gz"
);
cif
::
file
file
(
example
.
string
());
cif
::
mm
::
structure
s
(
file
);
//
const std::filesystem::path example(gTestDir / "1juh.cif.gz");
//
cif::file file(example.string());
//
cif::mm::structure s(file);
// Get branch for H
auto
&
bH
=
s
.
get_branch_by_asym_id
(
"H"
);
//
// Get branch for H
//
auto &bH = s.get_branch_by_asym_id("H");
BOOST_CHECK_EQUAL
(
bH
.
size
(),
2
);
//
BOOST_CHECK_EQUAL(bH.size(), 2);
std
::
vector
<
cif
::
row_initializer
>
ai
[
2
];
//
std::vector<cif::row_initializer> ai[2];
auto
&
db
=
s
.
get_datablock
();
auto
&
as
=
db
[
"atom_site"
];
//
auto &db = s.get_datablock();
//
auto &as = db["atom_site"];
for
(
size_t
i
=
0
;
i
<
2
;
++
i
)
{
for
(
auto
r
:
as
.
find
(
"label_asym_id"
_key
==
"H"
and
"auth_seq_id"
_key
==
i
+
1
))
/*auto &ri = */
ai
[
i
].
emplace_back
(
r
);
}
//
for (size_t i = 0; i < 2; ++i)
//
{
//
for (auto r : as.find("label_asym_id"_key == "H" and "auth_seq_id"_key == i + 1))
//
/*auto &ri = */ai[i].emplace_back(r);
//
}
s
.
remove_branch
(
bH
);
//
s.remove_branch(bH);
BOOST_CHECK
(
file
.
is_valid
());
//
BOOST_CHECK(file.is_valid());
auto
&
bN
=
s
.
create_branch
(
ai
[
0
]);
s
.
extend_branch
(
bN
.
get_asym_id
(),
ai
[
1
],
1
,
"O4"
);
//
auto &bN = s.create_branch(ai[0]);
//
s.extend_branch(bN.get_asym_id(), ai[1], 1, "O4");
BOOST_CHECK_EQUAL
(
bN
.
name
(),
"2-acetamido-2-deoxy-beta-D-glucopyranose-(1-4)-2-acetamido-2-deoxy-beta-D-glucopyranose"
);
BOOST_CHECK_EQUAL
(
bN
.
size
(),
2
);
//
BOOST_CHECK_EQUAL(bN.name(), "2-acetamido-2-deoxy-beta-D-glucopyranose-(1-4)-2-acetamido-2-deoxy-beta-D-glucopyranose");
//
BOOST_CHECK_EQUAL(bN.size(), 2);
BOOST_CHECK
(
file
.
is_valid
());
//
BOOST_CHECK(file.is_valid());
file
.
save
(
gTestDir
/
"test-create_sugar_2.cif"
);
//
file.save(gTestDir / "test-create_sugar_2.cif");
BOOST_CHECK_NO_THROW
(
cif
::
mm
::
structure
s2
(
file
));
}
//
BOOST_CHECK_NO_THROW(cif::mm::structure s2(file));
//
}
// --------------------------------------------------------------------
...
...
test/unit-3d-test.cpp
View file @
15db026e
...
...
@@ -93,13 +93,13 @@ BOOST_AUTO_TEST_CASE(t1)
const
auto
&&
[
angle0
,
axis0
]
=
cif
::
quaternion_to_angle_axis
(
q
);
std
::
vector
<
cif
::
point
>
p1
{
{
16.979
,
13.301
,
44.555
},
{
18.150
,
13.525
,
43.680
},
{
18.656
,
14.966
,
43.784
},
{
17.890
,
15.889
,
44.078
},
{
17.678
,
13.270
,
42.255
},
{
16.248
,
13.734
,
42.347
},
{
15.762
,
13.216
,
43.724
}
{
16.979
f
,
13.301
f
,
44.555
f
},
{
18.150
f
,
13.525
f
,
43.680
f
},
{
18.656
f
,
14.966
f
,
43.784
f
},
{
17.890
f
,
15.889
f
,
44.078
f
},
{
17.678
f
,
13.270
f
,
42.255
f
},
{
16.248
f
,
13.734
f
,
42.347
f
},
{
15.762
f
,
13.216
f
,
43.724
f
}
};
auto
p2
=
p1
;
...
...
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(t1)
for
(
auto
&
p
:
p1
)
p
.
rotate
(
q2
);
float
rmsd
=
cif
::
RMSd
(
p1
,
p2
);
auto
rmsd
=
cif
::
RMSd
(
p1
,
p2
);
BOOST_TEST
(
rmsd
<
1e-5
);
...
...
@@ -175,27 +175,27 @@ BOOST_AUTO_TEST_CASE(dh_q_1)
float
angle
;
cif
::
point
pts
[
4
];
}
tests
[]
=
{
{
-
97.5
,
{
{
68.8649979
,
-
7.34800005
,
54.3769989
},
{
68.1350021
,
-
8.18700027
,
53.6489983
},
{
68.7760239
,
-
9.07335377
,
52.7140236
},
{
68.9000015
,
-
10.3944235
,
53.2217026
}
}
},
{
80.3
,
{
{
0.304512024
,
0.531184196
,
2.25860214
},
{
0.956512451
,
0.0321846008
,
1.07460022
},
{
-
97.5
f
,
{
{
68.8649979
f
,
-
7.34800005
f
,
54.3769989
f
},
{
68.1350021
f
,
-
8.18700027
f
,
53.6489983
f
},
{
68.7760239
f
,
-
9.07335377
f
,
52.7140236
f
},
{
68.9000015
f
,
-
10.3944235
f
,
53.2217026
f
}
}
},
{
80.3
f
,
{
{
0.304512024
f
,
0.531184196
f
,
2.25860214
f
},
{
0.956512451
f
,
0.0321846008
f
,
1.07460022
f
},
{
0
,
0
,
0
},
{
0.21336633
,
-
1.09552193
,
-
0.878999829
}
}
},
{
-
97.5
,
{
{
0.088973999
,
1.72535372
,
1.66297531
},
{
-
0.641021729
,
0.886353493
,
0.93497467
},
{
0.21336633
f
,
-
1.09552193
f
,
-
0.878999829
f
}
}
},
{
-
97.5
f
,
{
{
0.088973999
f
,
1.72535372
f
,
1.66297531
f
},
{
-
0.641021729
f
,
0.886353493
f
,
0.93497467
f
},
{
0
,
0
,
0
},
{
1.29433727
,
-
0.395142615
,
0.432300746
}
}
},
{
-
97.5
,
{
1.29433727
f
,
-
0.395142615
f
,
0.432300746
f
}
}
},
{
-
97.5
f
,
{
{
0.088973999
,
1.72535372
,
1.66297531
},
{
-
0.641021729
,
0.886353493
,
0.93497467
},
{
0.088973999
f
,
1.72535372
f
,
1.66297531
f
},
{
-
0.641021729
f
,
0.886353493
f
,
0.93497467
f
},
{
0
,
0
,
0
},
{
1.33983064
,
0.384027064
,
-
0.275154471
},
{
1.33983064
f
,
0.384027064
f
,
-
0.275154471
f
},
}
}
};
...
...
test/unit-v2-test.cpp
View file @
15db026e
...
...
@@ -78,23 +78,23 @@ bool init_unit_test()
BOOST_AUTO_TEST_CASE
(
cc_1
)
{
std
::
tuple
<
std
::
string_view
,
float
,
char
>
tests
[]
=
{
{
"1.0"
,
1.0
,
0
},
{
"1.0e10"
,
1.0e10
,
0
},
{
"-1.1e10"
,
-
1.1e10
,
0
},
{
"-.2e11"
,
-
.2e11
,
0
},
{
"1.3e-10"
,
1.3e-10
,
0
},
{
"1.0 "
,
1.0
,
' '
},
{
"1.0e10 "
,
1.0e10
,
' '
},
{
"-1.1e10 "
,
-
1.1e10
,
' '
},
{
"-.2e11 "
,
-
.2e11
,
' '
},
{
"1.3e-10 "
,
1.3e-10
,
' '
},
{
"3.0"
,
3.0
,
0
},
{
"3.0 "
,
3.0
,
' '
},
{
"3.000000"
,
3.0
,
0
},
{
"3.000000 "
,
3.0
,
' '
},
{
"1.0"
,
1.0
f
,
0
},
{
"1.0e10"
,
1.0e10
f
,
0
},
{
"-1.1e10"
,
-
1.1e10
f
,
0
},
{
"-.2e11"
,
-
.2e11
f
,
0
},
{
"1.3e-10"
,
1.3e-10
f
,
0
},
{
"1.0 "
,
1.0
f
,
' '
},
{
"1.0e10 "
,
1.0e10
f
,
' '
},
{
"-1.1e10 "
,
-
1.1e10
f
,
' '
},
{
"-.2e11 "
,
-
.2e11
f
,
' '
},
{
"1.3e-10 "
,
1.3e-10
f
,
' '
},
{
"3.0"
,
3.0
f
,
0
},
{
"3.0 "
,
3.0
f
,
' '
},
{
"3.000000"
,
3.0
f
,
0
},
{
"3.000000 "
,
3.0
f
,
' '
},
};
for
(
const
auto
&
[
txt
,
val
,
ch
]
:
tests
)
...
...
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(cc_1)
BOOST_AUTO_TEST_CASE
(
cc_2
)
{
std
::
tuple
<
float
,
int
,
std
::
string_view
>
tests
[]
=
{
{
1.1
,
1
,
"1.1"
}
{
1.1
f
,
1
,
"1.1"
}
};
for
(
const
auto
&
[
val
,
prec
,
test
]
:
tests
)
...
...
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(item_1)
using
namespace
cif
;
item
i1
(
"1"
,
"1"
);
item
i2
(
"2"
,
2.0
);
item
i2
(
"2"
,
2.0
f
);
item
i3
(
"3"
,
'3'
);
item
ci1
(
i1
);
...
...
@@ -163,23 +163,23 @@ BOOST_AUTO_TEST_CASE(r_1)
c
.
emplace
({
{
"f-1"
,
1
},
{
"f-2"
,
"two"
},
{
"f-3"
,
3.0
,
3
},
{
"f-3"
,
3.0
f
,
3
},
});
auto
row
=
c
.
front
();
BOOST_CHECK_EQUAL
(
row
[
"f-1"
].
compare
(
1
),
0
);
BOOST_CHECK_EQUAL
(
row
[
"f-2"
].
compare
(
"two"
),
0
);
BOOST_CHECK_EQUAL
(
row
[
"f-3"
].
compare
(
3.0
),
0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
row
[
"f-3"
].
compare
(
3.0
f
),
0
);
// This fails when running in valgrind... sigh
const
auto
&
[
f1
,
f2
,
f3
]
=
row
.
get
<
int
,
std
::
string
,
float
>
(
"f-1"
,
"f-2"
,
"f-3"
);
BOOST_CHECK_EQUAL
(
f1
,
1
);
BOOST_CHECK_EQUAL
(
f2
,
"two"
);
BOOST_CHECK_EQUAL
(
f3
,
3.0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
f3
,
3.0
f
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
row
.
get
<
int
>
(
"f-1"
),
1
);
BOOST_CHECK_EQUAL
(
row
.
get
<
std
::
string
>
(
"f-2"
),
"two"
);
BOOST_CHECK_EQUAL
(
row
.
get
<
float
>
(
"f-3"
),
3.0
);
BOOST_CHECK_EQUAL
(
row
.
get
<
float
>
(
"f-3"
),
3.0
f
);
int
f_1
;
std
::
string
f_2
;
...
...
@@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(r_1)
BOOST_CHECK_EQUAL
(
f_1
,
1
);
BOOST_CHECK_EQUAL
(
f_2
,
"two"
);
BOOST_CHECK_EQUAL
(
f_3
,
3.0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
f_3
,
3.0
f
);
// This fails when running in valgrind... sigh
}
BOOST_AUTO_TEST_CASE
(
r_2
)
...
...
@@ -486,14 +486,14 @@ _test.value
BOOST_CHECK_EQUAL
(
++
n
,
1
);
BOOST_CHECK_EQUAL
(
r
[
"id"
].
as
<
int
>
(),
1
);
BOOST_CHECK_EQUAL
(
r
[
"name"
].
as
<
std
::
string
>
(),
"aap"
);
BOOST_CHECK_EQUAL
(
r
[
"value"
].
as
<
float
>
(),
1.0
);
BOOST_CHECK_EQUAL
(
r
[
"value"
].
as
<
float
>
(),
1.0
f
);
}
auto
t
=
test
.
find
(
cif
::
key
(
"id"
)
==
1
);
BOOST_CHECK
(
not
t
.
empty
());
BOOST_CHECK_EQUAL
(
t
.
front
()[
"name"
].
as
<
std
::
string
>
(),
"aap"
);
auto
t2
=
test
.
find
(
cif
::
key
(
"value"
)
==
1.2
);
auto
t2
=
test
.
find
(
cif
::
key
(
"value"
)
==
1.2
f
);
BOOST_CHECK
(
not
t2
.
empty
());
BOOST_CHECK_EQUAL
(
t2
.
front
()[
"name"
].
as
<
std
::
string
>
(),
"mies"
);
}
...
...
tools/update-libcifpp-data.in
View file @
15db026e
...
...
@@ -2,7 +2,10 @@
set
-e
if
[
"
$EUID
"
-ne
0
]
# Get the effective UID, but do so in a compatible way (we may be running dash)
euid
=
${
EUID
:-$(
id
-u
)}
if
[
"
${
euid
}
"
-ne
0
]
;
then
then
echo
"Please run as root"
exit
fi
...
...
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