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
1c02a451
Unverified
Commit
1c02a451
authored
May 16, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved has_atom_id
added couple of comparison operators to sym_op class
parent
448855a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
14 deletions
+57
-14
CMakeLists.txt
+20
-7
include/cif++/symmetry.hpp
+14
-0
src/model.cpp
+23
-7
No files found.
CMakeLists.txt
View file @
1c02a451
...
...
@@ -35,14 +35,15 @@ include(CheckIncludeFiles)
include
(
CheckLibraryExists
)
include
(
CMakePackageConfigHelpers
)
include
(
CheckCXXSourceCompiles
)
include
(
Dart
)
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"
)
elseif
(
MSVC
)
...
...
@@ -102,11 +103,22 @@ if(MSVC)
add_compile_options
(
/permissive-
)
macro
(
get_WIN32_WINNT version
)
if
(
WIN32 AND
CMAKE_SYSTEM_VERSION
)
if
(
CMAKE_SYSTEM_VERSION
)
set
(
ver
${
CMAKE_SYSTEM_VERSION
}
)
string
(
REGEX MATCH
"^([0-9]+).([0-9])"
ver
${
ver
}
)
string
(
REGEX MATCH
"^([0-9]+)"
verMajor
${
ver
}
)
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
if
(
"
${
verMajor
}
"
MATCHES
"10"
)
set
(
verMajor
"A"
)
string
(
REGEX REPLACE
"^([0-9]+)"
${
verMajor
}
ver
${
ver
}
)
endif
()
# Remove all remaining '.' characters.
string
(
REPLACE
"."
""
ver
${
ver
}
)
string
(
REGEX REPLACE
"([0-9])"
"0
\\
1"
ver
${
ver
}
)
# Prepend each digit with a zero.
string
(
REGEX REPLACE
"([0-9A-Z])"
"0
\\
1"
ver
${
ver
}
)
set
(
${
version
}
"0x
${
ver
}
"
)
endif
()
endmacro
()
...
...
@@ -157,15 +169,16 @@ if(MSVC)
set
(
_ZLIB_x86
"(x86)"
)
set
(
_ZLIB_SEARCH_NORMAL
PATHS
"[HKEY_LOCAL_MACHINE
\\
SOFTWARE
\\
GnuWin32
\\
Zlib;InstallPath]"
"$ENV{ProgramFiles}/zlib"
"$ENV{ProgramFiles
${
_ZLIB_x86
}
}/zlib"
)
"$ENV{ProgramFiles}/zlib"
"$ENV{ProgramFiles
${
_ZLIB_x86
}
}/zlib"
)
unset
(
_ZLIB_x86
)
list
(
APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL
)
foreach
(
search
${
_ZLIB_SEARCHES
}
)
find_library
(
ZLIB_LIBRARY NAMES zlibstatic NAMES_PER_DIR
${${
search
}}
PATH_SUFFIXES lib
)
find_library
(
ZLIB_LIBRARY NAMES zlibstatic NAMES_PER_DIR
${${
search
}}
PATH_SUFFIXES lib
)
endforeach
()
endif
()
find_package
(
ZLIB REQUIRED
)
find_package
(
Eigen3 REQUIRED
)
...
...
@@ -448,7 +461,7 @@ endif()
if
(
CIFPP_INSTALL_UPDATE_SCRIPT
)
if
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Linux"
)
set
(
CIFPP_CRON_DIR
"
${
CIFPP_ETC_DIR
}
/cron.weekly"
)
elseif
(
UNIX
)
# assume all others are like FreeBSD...
elseif
(
UNIX
)
# assume all others are like FreeBSD...
set
(
CIFPP_CRON_DIR
"
${
CIFPP_ETC_DIR
}
/periodic/weekly"
)
else
()
message
(
FATAL_ERROR
"Don't know where to install the update script"
)
...
...
include/cif++/symmetry.hpp
View file @
1c02a451
...
...
@@ -216,6 +216,20 @@ struct sym_op
std
::
string
string
()
const
;
#if defined(__cpp_impl_three_way_comparison)
constexpr
auto
operator
<=>
(
const
sym_op
&
rhs
)
const
=
default
;
#else
constexpr
bool
operator
==
(
const
sym_op
&
rhs
)
const
{
return
m_nr
==
rhs
.
m_nr
and
m_ta
==
rhs
.
m_ta
and
m_tb
==
rhs
.
m_tb
and
m_tc
==
rhs
.
m_tc
;
}
constexpr
bool
operator
!=
(
const
sym_op
&
rhs
)
const
{
return
not
operator
==
(
rhs
);
}
#endif
uint8_t
m_nr
;
uint8_t
m_ta
,
m_tb
,
m_tc
;
};
...
...
src/model.cpp
View file @
1c02a451
...
...
@@ -1545,15 +1545,31 @@ EntityType structure::get_entity_type_for_asym_id(const std::string asym_id) con
bool
structure
::
has_atom_id
(
const
std
::
string
&
id
)
const
{
bool
result
=
true
;
try
{
get_atom_by_id
(
id
);
}
catch
(...
)
assert
(
m_atoms
.
size
()
==
m_atom_index
.
size
())
;
bool
result
=
false
;
int
L
=
0
,
R
=
static_cast
<
int
>
(
m_atoms
.
size
()
-
1
);
while
(
L
<=
R
)
{
result
=
false
;
int
i
=
(
L
+
R
)
/
2
;
const
atom
&
atom
=
m_atoms
[
m_atom_index
[
i
]];
int
d
=
atom
.
id
().
compare
(
id
);
if
(
d
==
0
)
{
result
=
true
;
break
;
}
if
(
d
<
0
)
L
=
i
+
1
;
else
R
=
i
-
1
;
}
return
result
;
}
...
...
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