Skip to content

Commit

Permalink
Merge pull request #1779 from epam/1778-fix-nan-in-mol-files
Browse files Browse the repository at this point in the history
Ketcher creates invalid molfiles with "NaN"
  • Loading branch information
evgeniiFrolov1 authored Oct 20, 2022
2 parents 9f19226 + 3c5c457 commit 7526c0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/ketcher-core/src/domain/serializers/mol/molfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ export class Molfile {
)
this.writePaddedNumber(isAbsFlag ? 1 : 0, 3)
this.writePaddedNumber(0, 3)
this.writeWhiteSpace(12)
this.writePaddedNumber(0, 3)
this.writePaddedNumber(0, 3)
this.writePaddedNumber(0, 3)
this.writePaddedNumber(0, 3)
this.writePaddedNumber(999, 3)
this.writeCR(' V2000')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ function toAtom(atom) {
const conv = Object.assign({}, atom, {
label: capitalize(atom.label),
alias: atom.alias || null,
exactChangeFlag: +atom.exactChangeFlag,
unsaturatedAtom: +atom.unsaturatedAtom
exactChangeFlag: +(atom.exactChangeFlag ?? false),
unsaturatedAtom: +(atom.unsaturatedAtom ?? false)
})
if (charge !== undefined) conv.charge = charge
return conv
Expand Down

0 comments on commit 7526c0c

Please sign in to comment.