openchemlib-extended
Advanced tools
Comparing version 1.14.3 to 1.14.4
{ | ||
"name": "openchemlib-extended", | ||
"version": "1.14.3", | ||
"version": "1.14.4", | ||
"description": "Openchemlib extended", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -90,4 +90,14 @@ # openchemlib-extended | ||
* mass: put the rounded mass on the diagonal (default: false) | ||
* atomicNo: put the atomic number on the diagonal (default: false) | ||
Example using npm: | ||
``` | ||
var OCLE = require('openchemlib-extended'); | ||
var molecule = OCLE.Molecule.fromSmiles('c1ccccc1'); | ||
var matrix = molecule.getConnectivityMatrix({mass: true, sdt: true}); | ||
console.log(matrix); | ||
``` | ||
### getMF() | ||
@@ -94,0 +104,0 @@ |
@@ -5,7 +5,7 @@ 'use strict'; | ||
module.exports = function getConnectivityMatrix(options={}) { | ||
var { | ||
sdt, | ||
mass | ||
} = options; | ||
module.exports = function getConnectivityMatrix(options) { | ||
var options = options || {}; | ||
var sdt=options.sdt; | ||
var mass=options.mass; | ||
var atomicNo=options.atomicNo; | ||
@@ -17,3 +17,8 @@ this.ensureHelperArrays(OCL.Molecule.cHelperNeighbours); | ||
result[i]=new Array(nbAtoms).fill(0); | ||
result[i][i]=(mass) ? OCL.Molecule.cRoundedMass[this.getAtomicNo(i)] : 1; | ||
if (atomicNo) { | ||
result[i][i]=this.getAtomicNo(i); | ||
} else { | ||
result[i][i]=(mass) ? OCL.Molecule.cRoundedMass[this.getAtomicNo(i)] : 1; | ||
} | ||
} | ||
@@ -20,0 +25,0 @@ |
Sorry, the diff of this file is not supported yet
225969
926
120