src/mol/mol.js
function() {
    console.time('Mol.deriveConnectivity');
    var thisStructure = this;
    var prevResidue = null;
    this.eachResidue(function(res) {
      var sqrDist;
      var atoms = res.atoms();
      var numAtoms = atoms.length;
      for (var i = 0; i < numAtoms; i+=1) {
        var atomI = atoms[i];
        var posI = atomI.pos();
        var covalentI = covalentRadius(atomI.element());
        for (var j = 0; j < i; j+=1) {
          var atomJ = atoms[j];
          var covalentJ = covalentRadius(atomJ.element());
          sqrDist = vec3.sqrDist(posI, atomJ.pos());
          var lower = covalentI+covalentJ-0.30;
          var upper = covalentI+covalentJ+0.30;
          if (sqrDist < upper*upper && sqrDist > lower*lower) {
            thisStructure.connect(atomI, atomJ);
          }
        }
      }
      res._deduceType();
      if (prevResidue !== null) {
        if (res.isAminoacid() && prevResidue.isAminoacid()) {
          connectPeptides(thisStructure, prevResidue, res);
        }
        if (res.isNucleotide() && prevResidue.isNucleotide()) {
          connectNucleotides(thisStructure, prevResidue, res);
        }
      }
      prevResidue = res;
    });
    console.timeEnd('Mol.deriveConnectivity');
  }
function() {
    console.time('Mol.deriveConnectivity');
    var thisStructure = this;
    var prevResidue = null;
    this.eachResidue(function(res) {
      var sqrDist;
      var atoms = res.atoms();
      var numAtoms = atoms.length;
      for (var i = 0; i < numAtoms; i+=1) {
        var atomI = atoms[i];
        var posI = atomI.pos();
        var covalentI = covalentRadius(atomI.element());
        for (var j = 0; j < i; j+=1) {
          var atomJ = atoms[j];
          var covalentJ = covalentRadius(atomJ.element());
          sqrDist = vec3.sqrDist(posI, atomJ.pos());
          var lower = covalentI+covalentJ-0.30;
          var upper = covalentI+covalentJ+0.30;
          if (sqrDist < upper*upper && sqrDist > lower*lower) {
            thisStructure.connect(atomI, atomJ);
          }
        }
      }
      res._deduceType();
      if (prevResidue !== null) {
        if (res.isAminoacid() && prevResidue.isAminoacid()) {
          connectPeptides(thisStructure, prevResidue, res);
        }
        if (res.isNucleotide() && prevResidue.isNucleotide()) {
          connectNucleotides(thisStructure, prevResidue, res);
        }
      }
      prevResidue = res;
    });
    console.timeEnd('Mol.deriveConnectivity');
  }
function ( ) { console . time ( 'Mol.deriveConnectivity' ) ; var thisStructure = this ; var prevResidue = null ; this . eachResidue ( function ( res ) { var sqrDist ; var atoms = res . atoms ( ) ; var numAtoms = atoms . length ; for ( var i = 0 ; i < numAtoms ; i += 1 ) { var atomI = atoms [ i ] ; var posI = atomI . pos ( ) ; var covalentI = covalentRadius ( atomI . element ( ) ) ; for ( var j = 0 ; j < i ; j += 1 ) { var atomJ = atoms [ j ] ; var covalentJ = covalentRadius ( atomJ . element ( ) ) ; sqrDist = vec3 . sqrDist ( posI , atomJ . pos ( ) ) ; var lower = covalentI + covalentJ - 0.30 ; var upper = covalentI + covalentJ + 0.30 ; if ( sqrDist < upper * upper && sqrDist > lower * lower ) { thisStructure . connect ( atomI , atomJ ) ; } } } res . _deduceType ( ) ; if ( prevResidue !== null ) { if ( res . isAminoacid ( ) && prevResidue . isAminoacid ( ) ) { connectPeptides ( thisStructure , prevResidue , res ) ; } if ( res . isNucleotide ( ) && prevResidue . isNucleotide ( ) ) { connectNucleotides ( thisStructure , prevResidue , res ) ; } } prevResidue = res ; } ) ; console . timeEnd ( 'Mol.deriveConnectivity' ) ; }
determine connectivity structure. for simplicity only connects atoms of the same residue, peptide bonds and nucleotides
determine connectivity structure . for simplicity only connects atoms of the same residue peptide bonds and nucleotides