Compare commits

..

2 Commits

Author SHA1 Message Date
Maarten L. Hekkelman
c767e89a5d Fixed symmetry operator table generator 2021-10-06 12:57:18 +02:00
Maarten L. Hekkelman
b78a603dca run tests before installation 2021-10-05 11:49:54 +02:00
5 changed files with 1395 additions and 1334 deletions

View File

@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16)
# set the project name
project(cifpp VERSION 2.0.0 LANGUAGES CXX)
project(cifpp VERSION 2.0.1 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -98,7 +98,7 @@ else()
message("Not trying to recreate SymOpTable_data.hpp since CCP4 is not defined")
endif()
set(CMAKE_DEBUG_POSTFIX d)
# set(CMAKE_DEBUG_POSTFIX d)
if(MSVC)
# make msvc standards compliant...

View File

@@ -1,3 +1,6 @@
Version 2.0.1
- Fixed the generator for the symmetry operator table
Version 2.0.0
- New API interface for accessing query results
- Removed bzip2 support

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,22 @@ cif::File operator""_cf(const char* text, size_t length)
// --------------------------------------------------------------------
std::filesystem::path gTestDir = std::filesystem::current_path();
BOOST_AUTO_TEST_CASE(init)
{
// not a test, just initialize test dir
if (boost::unit_test::framework::master_test_suite().argc == 2)
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// initialize CCD location
if (std::filesystem::exists(gTestDir / ".."/"data"/"components.cif"))
cif::addFileResource("components.cif", gTestDir / ".."/"data"/"components.cif");
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(create_nonpoly_1)
{
cif::VERBOSE = 1;

View File

@@ -181,6 +181,50 @@ class SymopParser
int m_trn[3][2] = {};
};
std::array<int,15> move_symop(std::array<int,15> symop, const std::array<int,15>& cenop)
{
for (int i = 9; i < 15; i += 2)
{
if (cenop[i] == 0)
continue;
assert(cenop[i + 1] != 0);
if (symop[i] == 0)
{
assert(symop[i + 1] == 0);
symop[i] = cenop[i];
symop[i + 1] = cenop[i + 1];
continue;
}
if (symop[i + 1] == cenop[i + 1])
symop[i] += cenop[i];
else
{
int d = symop[i + 1] * cenop[i + 1];
int n = symop[i] * cenop[i + 1] + symop[i + 1] * cenop[i];
symop[i] = n;
symop[i + 1] = d;
}
for (int j = 5; j > 1; --j)
if (symop[i] % j == 0 and symop[i + 1] % j == 0)
{
symop[i] /= j;
symop[i + 1] /= j;
}
symop[i] = (symop[i] + symop[i + 1]) % symop[i + 1];
if (symop[i] == 0)
symop[i + 1] = 0;
}
return symop;
}
int main(int argc, char* const argv[])
{
using namespace std::literals;
@@ -225,7 +269,6 @@ int main(int argc, char* const argv[])
if (not out.is_open())
throw std::runtime_error("Failed to open output file");
// --------------------------------------------------------------------
// store symop data here
@@ -311,8 +354,7 @@ int main(int argc, char* const argv[])
{
for (auto symop: symops)
{
for (size_t i = 9; i < 15; ++i)
symop[i] += cenop[i];
symop = move_symop(symop, cenop);
data.emplace_back(cur.nr, symopnr, symop);
++symopnr;