openchemlib-utils
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -0,1 +1,11 @@ | ||
# [0.3.0](https://github.com/cheminfo/openchemlib-utils/compare/v0.2.1...v0.3.0) (2020-02-21) | ||
### Features | ||
* add negative atomicNo option ([44f812f](https://github.com/cheminfo/openchemlib-utils/commit/44f812fbd237240592f89485e4f39e655af6281b)) | ||
* add sdta for getConnectivityMatrix ([9fe9640](https://github.com/cheminfo/openchemlib-utils/commit/9fe9640f4e5ab23e2f5837249eff528a2da8bdd6)) | ||
## 0.0.1 (2020-01-21) | ||
@@ -2,0 +12,0 @@ |
@@ -504,3 +504,5 @@ 'use strict'; | ||
* @param {boolean} [options.atomicNo=false] set the atomic number of the atom on diagonal | ||
* @param {boolean} [options.negativeAtomicNo=false] set the atomic number * -1 of the atom on diagonal | ||
* @param {boolean} [options.sdt=false] set 1, 2 or 3 depending if single, double or triple bond | ||
* @param {boolean} [options.sdta=false] set 1, 2, 3 or 4 depending if single, double, triple or aromatic bond | ||
*/ | ||
@@ -520,2 +522,6 @@ function getConnectivityMatrix(molecule, options = {}) { | ||
} | ||
} else if (options.negativeAtomicNo) { | ||
for (let i = 0; i < nbAtoms; i++) { | ||
result[i][i] = -molecule.getAtomicNo(i); | ||
} | ||
} else if (options.mass) { | ||
@@ -539,2 +545,17 @@ for (let i = 0; i < nbAtoms; i++) { | ||
} | ||
} else if (options.sdta) { | ||
for (let i = 0; i < nbAtoms; i++) { | ||
let l = molecule.getAllConnAtoms(i); | ||
for (let j = 0; j < l; j++) { | ||
let bondNumber = molecule.getConnBond(i, j); | ||
if (molecule.isAromaticBond(bondNumber)) { | ||
result[i][molecule.getConnAtom(i, j)] = 4; | ||
} else { | ||
result[i][molecule.getConnAtom(i, j)] = molecule.getConnBondOrder( | ||
i, | ||
j, | ||
); | ||
} | ||
} | ||
} | ||
} else { | ||
@@ -541,0 +562,0 @@ for (let i = 0; i < nbAtoms; i++) { |
{ | ||
"name": "openchemlib-utils", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -13,3 +13,5 @@ import floydWarshall from 'ml-floyd-warshall'; | ||
* @param {boolean} [options.atomicNo=false] set the atomic number of the atom on diagonal | ||
* @param {boolean} [options.negativeAtomicNo=false] set the atomic number * -1 of the atom on diagonal | ||
* @param {boolean} [options.sdt=false] set 1, 2 or 3 depending if single, double or triple bond | ||
* @param {boolean} [options.sdta=false] set 1, 2, 3 or 4 depending if single, double, triple or aromatic bond | ||
*/ | ||
@@ -29,2 +31,6 @@ export function getConnectivityMatrix(molecule, options = {}) { | ||
} | ||
} else if (options.negativeAtomicNo) { | ||
for (let i = 0; i < nbAtoms; i++) { | ||
result[i][i] = -molecule.getAtomicNo(i); | ||
} | ||
} else if (options.mass) { | ||
@@ -48,2 +54,17 @@ for (let i = 0; i < nbAtoms; i++) { | ||
} | ||
} else if (options.sdta) { | ||
for (let i = 0; i < nbAtoms; i++) { | ||
let l = molecule.getAllConnAtoms(i); | ||
for (let j = 0; j < l; j++) { | ||
let bondNumber = molecule.getConnBond(i, j); | ||
if (molecule.isAromaticBond(bondNumber)) { | ||
result[i][molecule.getConnAtom(i, j)] = 4; | ||
} else { | ||
result[i][molecule.getConnAtom(i, j)] = molecule.getConnBondOrder( | ||
i, | ||
j, | ||
); | ||
} | ||
} | ||
} | ||
} else { | ||
@@ -50,0 +71,0 @@ for (let i = 0; i < nbAtoms; i++) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61874
1683