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
510ce62d
Unverified
Commit
510ce62d
authored
Feb 27, 2024
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reconstruction fixes
parent
be738e7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
31 deletions
+28
-31
src/datablock.cpp
+21
-28
src/pdb/reconstruct.cpp
+7
-3
No files found.
src/datablock.cpp
View file @
510ce62d
...
...
@@ -282,7 +282,11 @@ void datablock::write(std::ostream &os) const
cat_order_t
cat_order
;
for
(
auto
&
cat
:
*
this
)
{
if
(
cat
.
name
()
==
"entry"
or
cat
.
name
()
==
"audit_conform"
)
continue
;
cat_order
.
emplace_back
(
cat
.
name
(),
-
1
,
false
);
}
for
(
auto
i
=
cat_order
.
begin
();
i
!=
cat_order
.
end
();
++
i
)
calculate_cat_order
(
cat_order
,
i
,
*
m_validator
);
...
...
@@ -292,25 +296,18 @@ void datablock::write(std::ostream &os) const
const
auto
&
[
cat_a
,
count_a
,
on_stack_a
]
=
a
;
const
auto
&
[
cat_b
,
count_b
,
on_stack_b
]
=
b
;
int
d
=
0
;
if
(
cat_a
==
"audit_conform"
)
d
=
-
1
;
else
if
(
cat_b
==
"audit_conform"
)
d
=
1
;
else
if
(
cat_a
==
"entry"
)
d
=
-
1
;
else
if
(
cat_b
==
"entry"
)
d
=
1
;
else
{
d
=
std
::
get
<
1
>
(
a
)
-
std
::
get
<
1
>
(
b
);
if
(
d
==
0
)
d
=
cat_b
.
compare
(
cat_a
);
}
int
d
=
std
::
get
<
1
>
(
a
)
-
std
::
get
<
1
>
(
b
);
if
(
d
==
0
)
d
=
cat_b
.
compare
(
cat_a
);
return
d
<
0
;
});
if
(
auto
entry
=
get
(
"entry"
);
entry
!=
nullptr
)
entry
->
write
(
os
);
if
(
auto
audit_conform
=
get
(
"audit_conform"
);
audit_conform
!=
nullptr
)
audit_conform
->
write
(
os
);
for
(
auto
&&
[
cat
,
count
,
on_stack
]
:
cat_order
)
get
(
cat
)
->
write
(
os
);
}
...
...
@@ -320,20 +317,13 @@ void datablock::write(std::ostream &os) const
// and if it exists, _AND_ we have a Validator, write out the
// audit_conform record.
for
(
auto
&
cat
:
*
this
)
{
if
(
cat
.
name
()
!=
"entry"
)
continue
;
cat
.
write
(
os
);
break
;
}
if
(
auto
entry
=
get
(
"entry"
);
entry
!=
nullptr
)
entry
->
write
(
os
);
// If the dictionary declares an audit_conform category, put it in,
// but only if it does not exist already!
if
(
get
(
"audit_conform"
)
)
get
(
"audit_conform"
)
->
write
(
os
);
if
(
auto
audit_conform
=
get
(
"audit_conform"
);
audit_conform
!=
nullptr
)
audit_conform
->
write
(
os
);
for
(
auto
&
cat
:
*
this
)
{
...
...
@@ -348,7 +338,7 @@ void datablock::write(std::ostream &os, const std::vector<std::string> &item_nam
os
<<
"data_"
<<
m_name
<<
'\n'
<<
"#
\n
"
;
std
::
vector
<
std
::
string
>
cat_order
;
std
::
vector
<
std
::
string
>
cat_order
{
"entry"
,
"audit_conform"
}
;
for
(
auto
&
o
:
item_name_order
)
{
std
::
string
cat_name
,
item_name
;
...
...
@@ -360,6 +350,9 @@ void datablock::write(std::ostream &os, const std::vector<std::string> &item_nam
for
(
auto
&
c
:
cat_order
)
{
if
(
c
==
"entry"
or
c
==
"audit_conform"
)
continue
;
auto
cat
=
get
(
c
);
if
(
cat
==
nullptr
)
continue
;
...
...
src/pdb/reconstruct.cpp
View file @
510ce62d
...
...
@@ -386,12 +386,16 @@ void checkAtomRecords(datablock &db)
auto
chem_comp_entry
=
chem_comp
.
find_first
(
"id"
_key
==
comp_id
);
std
::
optional
<
bool
>
non_std
;
if
(
cf
.
is_monomer
(
comp_id
))
non_std
=
cf
.
is_std_monomer
(
comp_id
);
if
(
not
chem_comp_entry
)
{
chem_comp
.
emplace
({
//
{
"id"
,
comp_id
},
{
"type"
,
compound
->
type
()
},
{
"mon_nstd_flag"
,
cf
.
is_std_monomer
(
comp_id
)
?
"y"
:
"n"
},
{
"mon_nstd_flag"
,
non_std
},
{
"name"
,
compound
->
name
()
},
{
"formula"
,
compound
->
formula
()
},
{
"formula_weight"
,
compound
->
formula_weight
()
}
});
...
...
@@ -402,8 +406,8 @@ void checkAtomRecords(datablock &db)
if
(
not
chem_comp_entry
[
"type"
])
items
.
emplace_back
(
item
{
"type"
,
compound
->
type
()
});
if
(
not
chem_comp_entry
[
"mon_nstd_flag"
])
items
.
emplace_back
(
item
{
"mon_nstd_flag"
,
cf
.
is_std_monomer
(
comp_id
)
?
"y"
:
"n"
});
if
(
not
chem_comp_entry
[
"mon_nstd_flag"
]
and
non_std
.
has_value
()
)
items
.
emplace_back
(
item
{
"mon_nstd_flag"
,
non_std
});
if
(
not
chem_comp_entry
[
"name"
])
items
.
emplace_back
(
item
{
"name"
,
compound
->
name
()
});
if
(
not
chem_comp_entry
[
"formula"
])
...
...
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