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
faef95a8
Commit
faef95a8
authored
Oct 19, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new layout of symop table to work around compiler alignment issues
parent
25dfdd2f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
47 deletions
+117
-47
include/cif++/Structure.hpp
+3
-3
include/cif++/Symmetry.hpp
+80
-0
src/PDB2Cif.cpp
+4
-0
src/Structure.cpp
+15
-4
src/SymOpTable_data.cpp
+0
-0
src/Symmetry.cpp
+3
-2
tools/symop-map-generator.cpp
+12
-38
No files found.
include/cif++/Structure.hpp
View file @
faef95a8
...
@@ -67,7 +67,7 @@ class Atom
...
@@ -67,7 +67,7 @@ class Atom
Atom
(
const
Atom
&
rhs
);
Atom
(
const
Atom
&
rhs
);
// a special constructor to create symmetry copies
// a special constructor to create symmetry copies
Atom
(
const
Atom
&
rhs
,
const
Point
&
symmmetry_location
);
Atom
(
const
Atom
&
rhs
,
const
Point
&
symmmetry_location
,
const
std
::
string
&
symmetry_operation
);
~
Atom
();
~
Atom
();
...
@@ -89,8 +89,8 @@ class Atom
...
@@ -89,8 +89,8 @@ class Atom
const
cif
::
Row
getRowAniso
()
const
;
const
cif
::
Row
getRowAniso
()
const
;
// Atom symmetryCopy(const Point& d, const clipper::RTop_orth& rt);
// Atom symmetryCopy(const Point& d, const clipper::RTop_orth& rt);
//
bool isSymmetryCopy() const;
bool
isSymmetryCopy
()
const
;
//
std::string symmetry() const;
std
::
string
symmetry
()
const
;
// const clipper::RTop_orth& symop() const;
// const clipper::RTop_orth& symop() const;
const
Compound
&
comp
()
const
;
const
Compound
&
comp
()
const
;
...
...
include/cif++/Symmetry.hpp
View file @
faef95a8
...
@@ -26,9 +26,89 @@
...
@@ -26,9 +26,89 @@
#pragma once
#pragma once
#include <cstdint>
#include <array>
namespace
mmcif
namespace
mmcif
{
{
// --------------------------------------------------------------------
struct
Spacegroup
{
const
char
*
name
;
const
char
*
xHM
;
const
char
*
Hall
;
int
nr
;
};
extern
const
Spacegroup
kSpaceGroups
[];
extern
const
std
::
size_t
kNrOfSpaceGroups
;
// --------------------------------------------------------------------
struct
SymopData
{
constexpr
SymopData
(
const
std
::
array
<
int
,
15
>&
data
)
:
m_packed
((
static_cast
<
uint64_t
>
(
data
[
0
])
&
0x03
)
<<
34
bitor
(
static_cast
<
uint64_t
>
(
data
[
1
])
&
0x03
)
<<
32
bitor
(
static_cast
<
uint64_t
>
(
data
[
2
])
&
0x03
)
<<
30
bitor
(
static_cast
<
uint64_t
>
(
data
[
3
])
&
0x03
)
<<
28
bitor
(
static_cast
<
uint64_t
>
(
data
[
4
])
&
0x03
)
<<
26
bitor
(
static_cast
<
uint64_t
>
(
data
[
5
])
&
0x03
)
<<
24
bitor
(
static_cast
<
uint64_t
>
(
data
[
6
])
&
0x03
)
<<
22
bitor
(
static_cast
<
uint64_t
>
(
data
[
7
])
&
0x03
)
<<
20
bitor
(
static_cast
<
uint64_t
>
(
data
[
8
])
&
0x03
)
<<
18
bitor
(
static_cast
<
uint64_t
>
(
data
[
9
])
&
0x07
)
<<
15
bitor
(
static_cast
<
uint64_t
>
(
data
[
10
])
&
0x07
)
<<
12
bitor
(
static_cast
<
uint64_t
>
(
data
[
11
])
&
0x07
)
<<
9
bitor
(
static_cast
<
uint64_t
>
(
data
[
12
])
&
0x07
)
<<
6
bitor
(
static_cast
<
uint64_t
>
(
data
[
13
])
&
0x07
)
<<
3
bitor
(
static_cast
<
uint64_t
>
(
data
[
14
])
&
0x07
)
<<
0
)
{
}
bool
operator
==
(
const
SymopData
&
rhs
)
const
{
return
m_packed
==
rhs
.
m_packed
;
}
private
:
friend
struct
SymopDataBlock
;
const
uint64_t
kPackMask
=
(
~
0UL
>>
(
64
-
36
));
SymopData
(
uint64_t
v
)
:
m_packed
(
v
bitand
kPackMask
)
{}
uint64_t
m_packed
;
};
struct
SymopDataBlock
{
constexpr
SymopDataBlock
(
int
spacegroup
,
int
rotational_number
,
const
std
::
array
<
int
,
15
>&
rt_data
)
:
m_v
((
spacegroup
&
0xffffULL
)
<<
48
bitor
(
rotational_number
&
0xffULL
)
<<
40
bitor
SymopData
(
rt_data
).
m_packed
)
{
}
uint16_t
spacegroup
()
const
{
return
m_v
>>
48
;
}
SymopData
symop
()
const
{
return
SymopData
(
m_v
);
}
uint8_t
rotational_number
()
const
{
return
(
m_v
>>
40
)
bitand
0xff
;
}
private
:
uint64_t
m_v
;
};
static_assert
(
sizeof
(
SymopDataBlock
)
==
sizeof
(
uint64_t
),
"Size of SymopData is wrong"
);
extern
const
SymopDataBlock
kSymopNrTable
[];
extern
const
std
::
size_t
kSymopNrTableSize
;
// --------------------------------------------------------------------
int
GetSpacegroupNumber
(
std
::
string
spacegroup
);
// alternative for clipper's parsing code
int
GetSpacegroupNumber
(
std
::
string
spacegroup
);
// alternative for clipper's parsing code
}
}
src/PDB2Cif.cpp
View file @
faef95a8
...
@@ -1230,6 +1230,9 @@ void PDBFileParser::PreParseInput(std::istream& is)
...
@@ -1230,6 +1230,9 @@ void PDBFileParser::PreParseInput(std::istream& is)
std
::
cerr
<<
"Dropped unsupported records: "
<<
ba
::
join
(
dropped
,
", "
)
<<
std
::
endl
;
std
::
cerr
<<
"Dropped unsupported records: "
<<
ba
::
join
(
dropped
,
", "
)
<<
std
::
endl
;
}
}
if
(
mData
==
nullptr
)
throw
std
::
runtime_error
(
"Empty file?"
);
mRec
=
mData
;
mRec
=
mData
;
}
}
...
@@ -1247,6 +1250,7 @@ void PDBFileParser::GetNextRecord()
...
@@ -1247,6 +1250,7 @@ void PDBFileParser::GetNextRecord()
void
PDBFileParser
::
Match
(
const
std
::
string
&
expected
,
bool
throwIfMissing
)
void
PDBFileParser
::
Match
(
const
std
::
string
&
expected
,
bool
throwIfMissing
)
{
{
assert
(
mRec
);
if
(
mRec
->
mName
!=
expected
)
if
(
mRec
->
mName
!=
expected
)
{
{
if
(
throwIfMissing
)
if
(
throwIfMissing
)
...
...
src/Structure.cpp
View file @
faef95a8
...
@@ -216,13 +216,13 @@ struct AtomImpl
...
@@ -216,13 +216,13 @@ struct AtomImpl
// mLocation -= d;
// mLocation -= d;
// }
// }
AtomImpl
(
const
AtomImpl
&
impl
,
const
Point
&
loc
)
AtomImpl
(
const
AtomImpl
&
impl
,
const
Point
&
loc
,
const
std
::
string
&
sym_op
)
:
mFile
(
impl
.
mFile
),
mID
(
impl
.
mID
),
mType
(
impl
.
mType
),
mAtomID
(
impl
.
mAtomID
)
:
mFile
(
impl
.
mFile
),
mID
(
impl
.
mID
),
mType
(
impl
.
mType
),
mAtomID
(
impl
.
mAtomID
)
,
mCompID
(
impl
.
mCompID
),
mAsymID
(
impl
.
mAsymID
),
mSeqID
(
impl
.
mSeqID
)
,
mCompID
(
impl
.
mCompID
),
mAsymID
(
impl
.
mAsymID
),
mSeqID
(
impl
.
mSeqID
)
,
mAltID
(
impl
.
mAltID
),
mLocation
(
loc
),
mRefcount
(
1
)
,
mAltID
(
impl
.
mAltID
),
mLocation
(
loc
),
mRefcount
(
1
)
,
mRow
(
impl
.
mRow
),
mCompound
(
impl
.
mCompound
),
mRadius
(
impl
.
mRadius
)
,
mRow
(
impl
.
mRow
),
mCompound
(
impl
.
mCompound
),
mRadius
(
impl
.
mRadius
)
,
mCachedProperties
(
impl
.
mCachedProperties
)
,
mCachedProperties
(
impl
.
mCachedProperties
)
,
mSymmetryCopy
(
true
)
,
mSymmetryCopy
(
true
)
,
mSymmetryOperator
(
sym_op
)
{
{
}
}
...
@@ -378,6 +378,7 @@ struct AtomImpl
...
@@ -378,6 +378,7 @@ struct AtomImpl
bool
mSymmetryCopy
=
false
;
bool
mSymmetryCopy
=
false
;
bool
mClone
=
false
;
bool
mClone
=
false
;
std
::
string
mSymmetryOperator
;
// clipper::RTop_orth mRTop;
// clipper::RTop_orth mRTop;
// Point mD;
// Point mD;
// int32_t mRTix;
// int32_t mRTix;
...
@@ -418,8 +419,8 @@ Atom Atom::clone() const
...
@@ -418,8 +419,8 @@ Atom Atom::clone() const
return
Atom
(
mImpl_
?
new
AtomImpl
(
*
mImpl_
)
:
nullptr
);
return
Atom
(
mImpl_
?
new
AtomImpl
(
*
mImpl_
)
:
nullptr
);
}
}
Atom
::
Atom
(
const
Atom
&
rhs
,
const
Point
&
loc
)
Atom
::
Atom
(
const
Atom
&
rhs
,
const
Point
&
loc
,
const
std
::
string
&
sym_op
)
:
mImpl_
(
new
AtomImpl
(
*
rhs
.
mImpl_
,
loc
))
:
mImpl_
(
new
AtomImpl
(
*
rhs
.
mImpl_
,
loc
,
sym_op
))
{
{
}
}
...
@@ -629,6 +630,16 @@ void Atom::location(Point p)
...
@@ -629,6 +630,16 @@ void Atom::location(Point p)
// return clipper::Symop(impl()->mRTop).format() + "\n" + impl()->mRTop.format();
// return clipper::Symop(impl()->mRTop).format() + "\n" + impl()->mRTop.format();
// }
// }
bool
Atom
::
isSymmetryCopy
()
const
{
return
mImpl_
->
mSymmetryCopy
;
}
std
::
string
Atom
::
symmetry
()
const
{
return
mImpl_
->
mSymmetryOperator
;
}
// const clipper::RTop_orth& Atom::symop() const
// const clipper::RTop_orth& Atom::symop() const
// {
// {
// return impl()->mRTop;
// return impl()->mRTop;
...
...
src/SymOpTable_data.cpp
View file @
faef95a8
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/Symmetry.cpp
View file @
faef95a8
...
@@ -53,7 +53,7 @@ int GetSpacegroupNumber(std::string spacegroup)
...
@@ -53,7 +53,7 @@ int GetSpacegroupNumber(std::string spacegroup)
int
result
=
0
;
int
result
=
0
;
const
size_t
N
=
sizeof
(
kSpaceGroups
)
/
sizeof
(
Spacegroup
)
;
const
size_t
N
=
kNrOfSpaceGroups
;
int32_t
L
=
0
,
R
=
static_cast
<
int32_t
>
(
N
-
1
);
int32_t
L
=
0
,
R
=
static_cast
<
int32_t
>
(
N
-
1
);
while
(
L
<=
R
)
while
(
L
<=
R
)
{
{
...
@@ -75,8 +75,9 @@ int GetSpacegroupNumber(std::string spacegroup)
...
@@ -75,8 +75,9 @@ int GetSpacegroupNumber(std::string spacegroup)
// not found, see if we can find a match based on xHM name
// not found, see if we can find a match based on xHM name
if
(
result
==
0
)
if
(
result
==
0
)
{
{
for
(
auto
&
sp
:
kSpaceGroups
)
for
(
size_t
i
=
0
;
i
<
kNrOfSpaceGroups
;
++
i
)
{
{
auto
&
sp
=
kSpaceGroups
[
i
];
if
(
sp
.
xHM
==
spacegroup
)
if
(
sp
.
xHM
==
spacegroup
)
{
{
result
=
sp
.
nr
;
result
=
sp
.
nr
;
...
...
tools/symop-map-generator.cpp
View file @
faef95a8
...
@@ -350,13 +350,9 @@ int main()
...
@@ -350,13 +350,9 @@ int main()
// and $CLIBD/syminfo.lib using symop-map-generator,
// and $CLIBD/syminfo.lib using symop-map-generator,
// part of the PDB-REDO suite of programs.
// part of the PDB-REDO suite of programs.
struct Spacegroup
#include "cif++/Symmetry.hpp"
{
const char* name;
const Spacegroup kSpaceGroups[] =
const char* xHM;
const char* Hall;
int nr;
} kSpaceGroups[] =
{
{
)"
;
)"
;
...
@@ -390,35 +386,9 @@ struct Spacegroup
...
@@ -390,35 +386,9 @@ struct Spacegroup
cout
<<
R"(
cout
<<
R"(
};
};
union SymopData
const size_t kNrOfSpaceGroups = sizeof(kSpaceGroups) / sizeof(Spacegroup);
{
struct
{
int rot_0_0:2;
int rot_0_1:2;
int rot_0_2:2;
int rot_1_0:2;
int rot_1_1:2;
int rot_1_2:2;
int rot_2_0:2;
int rot_2_1:2;
int rot_2_2:2;
unsigned int trn_0_0:3;
unsigned int trn_0_1:3;
unsigned int trn_1_0:3;
unsigned int trn_1_1:3;
unsigned int trn_2_0:3;
unsigned int trn_2_1:3;
};
uint64_t iv:36;
};
struct SymopDataBlock
const SymopDataBlock kSymopNrTable[] = {
{
uint16_t spacegroupNr;
uint8_t rotationalNr;
SymopData rt;
} kSymopNrTable[] = {
)"
<<
endl
;
)"
<<
endl
;
int
spacegroupNr
=
0
;
int
spacegroupNr
=
0
;
...
@@ -432,13 +402,17 @@ struct SymopDataBlock
...
@@ -432,13 +402,17 @@ struct SymopDataBlock
spacegroupNr
=
sp
;
spacegroupNr
=
sp
;
cout
<<
" { "
<<
setw
(
3
)
<<
sp
cout
<<
" { "
<<
setw
(
3
)
<<
sp
<<
", "
<<
setw
(
3
)
<<
o
<<
", {
{
"
;
<<
", "
<<
setw
(
3
)
<<
o
<<
", { "
;
for
(
auto
i
:
get
<
2
>
(
sd
))
for
(
auto
i
:
get
<
2
>
(
sd
))
cout
<<
setw
(
2
)
<<
i
<<
','
;
cout
<<
setw
(
2
)
<<
i
<<
','
;
cout
<<
" } }
}
,"
<<
endl
;
cout
<<
" } },"
<<
endl
;
}
}
cout
<<
"};"
<<
endl
;
cout
<<
R"(};
const size_t kSymopNrTableSize = sizeof(kSymopNrTable) / sizeof(SymopDataBlock);
)"
<<
endl
;
}
}
catch
(
const
exception
&
ex
)
catch
(
const
exception
&
ex
)
{
{
...
...
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