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
7f820449
Unverified
Commit
7f820449
authored
Dec 08, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting
parent
ecb2cf5f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
193 additions
and
189 deletions
+193
-189
include/cif++/AtomType.hpp
+166
-162
include/cif++/BondMap.hpp
+27
-27
src/AtomType.cpp
+0
-0
src/BondMap.cpp
+0
-0
No files found.
include/cif++/AtomType.hpp
View file @
7f820449
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (c) 2020 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
...
...
@@ -29,150 +29,151 @@
#pragma once
#include <cstdint>
#include <string>
#include <stdexcept>
#include <string>
namespace
mmcif
{
enum
AtomType
:
uint8_t
{
Nn
=
0
,
// Unknown
H
=
1
,
// Hydrogen
He
=
2
,
// Helium
Li
=
3
,
// Lithium
Be
=
4
,
// Beryllium
B
=
5
,
// Boron
C
=
6
,
// Carbon
N
=
7
,
// Nitrogen
O
=
8
,
// Oxygen
F
=
9
,
// Fluorine
Ne
=
10
,
// Neon
Na
=
11
,
// Sodium
Mg
=
12
,
// Magnesium
Al
=
13
,
// Aluminium
Si
=
14
,
// Silicon
P
=
15
,
// Phosphorus
S
=
16
,
// Sulfur
Cl
=
17
,
// Chlorine
Ar
=
18
,
// Argon
K
=
19
,
// Potassium
Ca
=
20
,
// Calcium
Sc
=
21
,
// Scandium
Ti
=
22
,
// Titanium
V
=
23
,
// Vanadium
Cr
=
24
,
// Chromium
Mn
=
25
,
// Manganese
Fe
=
26
,
// Iron
Co
=
27
,
// Cobalt
Ni
=
28
,
// Nickel
Cu
=
29
,
// Copper
Zn
=
30
,
// Zinc
Ga
=
31
,
// Gallium
Ge
=
32
,
// Germanium
As
=
33
,
// Arsenic
Se
=
34
,
// Selenium
Br
=
35
,
// Bromine
Kr
=
36
,
// Krypton
Rb
=
37
,
// Rubidium
Sr
=
38
,
// Strontium
Y
=
39
,
// Yttrium
Zr
=
40
,
// Zirconium
Nb
=
41
,
// Niobium
Mo
=
42
,
// Molybdenum
Tc
=
43
,
// Technetium
Ru
=
44
,
// Ruthenium
Rh
=
45
,
// Rhodium
Pd
=
46
,
// Palladium
Ag
=
47
,
// Silver
Cd
=
48
,
// Cadmium
In
=
49
,
// Indium
Sn
=
50
,
// Tin
Sb
=
51
,
// Antimony
Te
=
52
,
// Tellurium
I
=
53
,
// Iodine
Xe
=
54
,
// Xenon
Cs
=
55
,
// Caesium
Ba
=
56
,
// Barium
La
=
57
,
// Lanthanum
Hf
=
72
,
// Hafnium
Ta
=
73
,
// Tantalum
W
=
74
,
// Tungsten
Re
=
75
,
// Rhenium
Os
=
76
,
// Osmium
Ir
=
77
,
// Iridium
Pt
=
78
,
// Platinum
Au
=
79
,
// Gold
Hg
=
80
,
// Mercury
Tl
=
81
,
// Thallium
Pb
=
82
,
// Lead
Bi
=
83
,
// Bismuth
Po
=
84
,
// Polonium
At
=
85
,
// Astatine
Rn
=
86
,
// Radon
Fr
=
87
,
// Francium
Ra
=
88
,
// Radium
Ac
=
89
,
// Actinium
Rf
=
104
,
// Rutherfordium
Db
=
105
,
// Dubnium
Sg
=
106
,
// Seaborgium
Bh
=
107
,
// Bohrium
Hs
=
108
,
// Hassium
Mt
=
109
,
// Meitnerium
Ds
=
110
,
// Darmstadtium
Rg
=
111
,
// Roentgenium
Cn
=
112
,
// Copernicium
Nh
=
113
,
// Nihonium
Fl
=
114
,
// Flerovium
Mc
=
115
,
// Moscovium
Lv
=
116
,
// Livermorium
Ts
=
117
,
// Tennessine
Og
=
118
,
// Oganesson
Ce
=
58
,
// Cerium
Pr
=
59
,
// Praseodymium
Nd
=
60
,
// Neodymium
Pm
=
61
,
// Promethium
Sm
=
62
,
// Samarium
Eu
=
63
,
// Europium
Gd
=
64
,
// Gadolinium
Tb
=
65
,
// Terbium
Dy
=
66
,
// Dysprosium
Ho
=
67
,
// Holmium
Er
=
68
,
// Erbium
Tm
=
69
,
// Thulium
Yb
=
70
,
// Ytterbium
Lu
=
71
,
// Lutetium
Th
=
90
,
// Thorium
Pa
=
91
,
// Protactinium
U
=
92
,
// Uranium
Np
=
93
,
// Neptunium
Pu
=
94
,
// Plutonium
Am
=
95
,
// Americium
Cm
=
96
,
// Curium
Bk
=
97
,
// Berkelium
Cf
=
98
,
// Californium
Es
=
99
,
// Einsteinium
Fm
=
100
,
// Fermium
Md
=
101
,
// Mendelevium
No
=
102
,
// Nobelium
Lr
=
103
,
// Lawrencium
D
=
129
,
// Deuterium
Nn
=
0
,
// Unknown
H
=
1
,
// Hydrogen
He
=
2
,
// Helium
Li
=
3
,
// Lithium
Be
=
4
,
// Beryllium
B
=
5
,
// Boron
C
=
6
,
// Carbon
N
=
7
,
// Nitrogen
O
=
8
,
// Oxygen
F
=
9
,
// Fluorine
Ne
=
10
,
// Neon
Na
=
11
,
// Sodium
Mg
=
12
,
// Magnesium
Al
=
13
,
// Aluminium
Si
=
14
,
// Silicon
P
=
15
,
// Phosphorus
S
=
16
,
// Sulfur
Cl
=
17
,
// Chlorine
Ar
=
18
,
// Argon
K
=
19
,
// Potassium
Ca
=
20
,
// Calcium
Sc
=
21
,
// Scandium
Ti
=
22
,
// Titanium
V
=
23
,
// Vanadium
Cr
=
24
,
// Chromium
Mn
=
25
,
// Manganese
Fe
=
26
,
// Iron
Co
=
27
,
// Cobalt
Ni
=
28
,
// Nickel
Cu
=
29
,
// Copper
Zn
=
30
,
// Zinc
Ga
=
31
,
// Gallium
Ge
=
32
,
// Germanium
As
=
33
,
// Arsenic
Se
=
34
,
// Selenium
Br
=
35
,
// Bromine
Kr
=
36
,
// Krypton
Rb
=
37
,
// Rubidium
Sr
=
38
,
// Strontium
Y
=
39
,
// Yttrium
Zr
=
40
,
// Zirconium
Nb
=
41
,
// Niobium
Mo
=
42
,
// Molybdenum
Tc
=
43
,
// Technetium
Ru
=
44
,
// Ruthenium
Rh
=
45
,
// Rhodium
Pd
=
46
,
// Palladium
Ag
=
47
,
// Silver
Cd
=
48
,
// Cadmium
In
=
49
,
// Indium
Sn
=
50
,
// Tin
Sb
=
51
,
// Antimony
Te
=
52
,
// Tellurium
I
=
53
,
// Iodine
Xe
=
54
,
// Xenon
Cs
=
55
,
// Caesium
Ba
=
56
,
// Barium
La
=
57
,
// Lanthanum
Hf
=
72
,
// Hafnium
Ta
=
73
,
// Tantalum
W
=
74
,
// Tungsten
Re
=
75
,
// Rhenium
Os
=
76
,
// Osmium
Ir
=
77
,
// Iridium
Pt
=
78
,
// Platinum
Au
=
79
,
// Gold
Hg
=
80
,
// Mercury
Tl
=
81
,
// Thallium
Pb
=
82
,
// Lead
Bi
=
83
,
// Bismuth
Po
=
84
,
// Polonium
At
=
85
,
// Astatine
Rn
=
86
,
// Radon
Fr
=
87
,
// Francium
Ra
=
88
,
// Radium
Ac
=
89
,
// Actinium
Rf
=
104
,
// Rutherfordium
Db
=
105
,
// Dubnium
Sg
=
106
,
// Seaborgium
Bh
=
107
,
// Bohrium
Hs
=
108
,
// Hassium
Mt
=
109
,
// Meitnerium
Ds
=
110
,
// Darmstadtium
Rg
=
111
,
// Roentgenium
Cn
=
112
,
// Copernicium
Nh
=
113
,
// Nihonium
Fl
=
114
,
// Flerovium
Mc
=
115
,
// Moscovium
Lv
=
116
,
// Livermorium
Ts
=
117
,
// Tennessine
Og
=
118
,
// Oganesson
Ce
=
58
,
// Cerium
Pr
=
59
,
// Praseodymium
Nd
=
60
,
// Neodymium
Pm
=
61
,
// Promethium
Sm
=
62
,
// Samarium
Eu
=
63
,
// Europium
Gd
=
64
,
// Gadolinium
Tb
=
65
,
// Terbium
Dy
=
66
,
// Dysprosium
Ho
=
67
,
// Holmium
Er
=
68
,
// Erbium
Tm
=
69
,
// Thulium
Yb
=
70
,
// Ytterbium
Lu
=
71
,
// Lutetium
Th
=
90
,
// Thorium
Pa
=
91
,
// Protactinium
U
=
92
,
// Uranium
Np
=
93
,
// Neptunium
Pu
=
94
,
// Plutonium
Am
=
95
,
// Americium
Cm
=
96
,
// Curium
Bk
=
97
,
// Berkelium
Cf
=
98
,
// Californium
Es
=
99
,
// Einsteinium
Fm
=
100
,
// Fermium
Md
=
101
,
// Mendelevium
No
=
102
,
// Nobelium
Lr
=
103
,
// Lawrencium
D
=
129
,
// Deuterium
};
// --------------------------------------------------------------------
// AtomTypeInfo
enum
RadiusType
{
enum
RadiusType
{
eRadiusCalculated
,
eRadiusEmpirical
,
eRadiusCovalentEmpirical
,
...
...
@@ -188,12 +189,12 @@ enum RadiusType {
struct
AtomTypeInfo
{
AtomType
type
;
std
::
string
name
;
std
::
string
symbol
;
float
weight
;
bool
metal
;
float
radii
[
eRadiusTypeCount
];
AtomType
type
;
std
::
string
name
;
std
::
string
symbol
;
float
weight
;
bool
metal
;
float
radii
[
eRadiusTypeCount
];
};
extern
const
AtomTypeInfo
kKnownAtoms
[];
...
...
@@ -205,25 +206,25 @@ class AtomTypeTraits
{
public
:
AtomTypeTraits
(
AtomType
a
);
AtomTypeTraits
(
const
std
::
string
&
symbol
);
AtomType
type
()
const
{
return
mInfo
->
type
;
}
std
::
string
name
()
const
{
return
mInfo
->
name
;
}
std
::
string
symbol
()
const
{
return
mInfo
->
symbol
;
}
float
weight
()
const
{
return
mInfo
->
weight
;
}
bool
isMetal
()
const
{
return
mInfo
->
metal
;
}
static
bool
isElement
(
const
std
::
string
&
symbol
);
static
bool
isMetal
(
const
std
::
string
&
symbol
);
AtomTypeTraits
(
const
std
::
string
&
symbol
);
AtomType
type
()
const
{
return
mInfo
->
type
;
}
std
::
string
name
()
const
{
return
mInfo
->
name
;
}
std
::
string
symbol
()
const
{
return
mInfo
->
symbol
;
}
float
weight
()
const
{
return
mInfo
->
weight
;
}
bool
isMetal
()
const
{
return
mInfo
->
metal
;
}
static
bool
isElement
(
const
std
::
string
&
symbol
);
static
bool
isMetal
(
const
std
::
string
&
symbol
);
float
radius
(
RadiusType
type
=
eRadiusSingleBond
)
const
{
if
(
type
>=
eRadiusTypeCount
)
throw
std
::
invalid_argument
(
"invalid radius requested"
);
return
mInfo
->
radii
[
type
]
/
100.
f
;
}
// data type encapsulating the Waasmaier & Kirfel scattering factors
// in a simplified form (only a and b).
// Added the electrion scattering factors as well
...
...
@@ -231,15 +232,18 @@ class AtomTypeTraits
{
double
a
[
6
],
b
[
6
];
};
// to get the Cval and Siva values, use this constant as charge:
enum
{
kWKSFVal
=
-
99
};
const
SFData
&
wksf
(
int
charge
=
0
)
const
;
const
SFData
&
elsf
()
const
;
enum
{
kWKSFVal
=
-
99
};
const
SFData
&
wksf
(
int
charge
=
0
)
const
;
const
SFData
&
elsf
()
const
;
private
:
const
struct
AtomTypeInfo
*
mInfo
;
const
struct
AtomTypeInfo
*
mInfo
;
};
}
}
// namespace mmcif
include/cif++/BondMap.hpp
View file @
7f820449
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (c) 2020 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
...
...
@@ -26,9 +26,9 @@
#pragma once
#include <unordered_map>
#include <filesystem>
#include <stdexcept>
#include <unordered_map>
#include "cif++/Structure.hpp"
...
...
@@ -38,39 +38,40 @@ namespace mmcif
class
BondMapException
:
public
std
::
runtime_error
{
public
:
BondMapException
(
const
std
::
string
&
msg
)
:
runtime_error
(
msg
)
{}
BondMapException
(
const
std
::
string
&
msg
)
:
runtime_error
(
msg
)
{
}
};
class
BondMap
{
public
:
BondMap
(
const
Structure
&
p
);
BondMap
(
const
BondMap
&
)
=
delete
;
BondMap
&
operator
=
(
const
BondMap
&
)
=
delete
;
BondMap
(
const
Structure
&
p
);
BondMap
(
const
BondMap
&
)
=
delete
;
BondMap
&
operator
=
(
const
BondMap
&
)
=
delete
;
bool
operator
()(
const
Atom
&
a
,
const
Atom
&
b
)
const
bool
operator
()(
const
Atom
&
a
,
const
Atom
&
b
)
const
{
return
isBonded
(
index
.
at
(
a
.
id
()),
index
.
at
(
b
.
id
()));
}
bool
is1_4
(
const
Atom
&
a
,
const
Atom
&
b
)
const
bool
is1_4
(
const
Atom
&
a
,
const
Atom
&
b
)
const
{
uint32_t
ixa
=
index
.
at
(
a
.
id
());
uint32_t
ixb
=
index
.
at
(
b
.
id
());
return
bond_1_4
.
count
(
key
(
ixa
,
ixb
));
}
// links coming from the struct_conn records:
std
::
vector
<
std
::
string
>
linked
(
const
Atom
&
a
)
const
;
std
::
vector
<
std
::
string
>
linked
(
const
Atom
&
a
)
const
;
// This list of atomID's is comming from either CCD or the CCP4 dictionaries loaded
static
std
::
vector
<
std
::
string
>
atomIDsForCompound
(
const
std
::
string
&
compoundID
);
private
:
static
std
::
vector
<
std
::
string
>
atomIDsForCompound
(
const
std
::
string
&
compoundID
);
private
:
bool
isBonded
(
uint32_t
ai
,
uint32_t
bi
)
const
{
return
bond
.
count
(
key
(
ai
,
bi
))
!=
0
;
...
...
@@ -82,20 +83,19 @@ class BondMap
std
::
swap
(
a
,
b
);
return
static_cast
<
uint64_t
>
(
a
)
|
(
static_cast
<
uint64_t
>
(
b
)
<<
32
);
}
std
::
tuple
<
uint32_t
,
uint32_t
>
dekey
(
uint64_t
k
)
const
std
::
tuple
<
uint32_t
,
uint32_t
>
dekey
(
uint64_t
k
)
const
{
return
std
::
make_tuple
(
static_cast
<
uint32_t
>
(
k
>>
32
),
static_cast
<
uint32_t
>
(
k
)
);
static_cast
<
uint32_t
>
(
k
));
}
uint32_t
dim
;
std
::
unordered_map
<
std
::
string
,
uint32_t
>
index
;
std
::
unordered_map
<
std
::
string
,
uint32_t
>
index
;
std
::
set
<
uint64_t
>
bond
,
bond_1_4
;
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>>
link
;
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>>
link
;
};
}
}
// namespace mmcif
src/AtomType.cpp
View file @
7f820449
This diff is collapsed.
Click to expand it.
src/BondMap.cpp
View file @
7f820449
This diff is collapsed.
Click to expand it.
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