biasmv / pv

WebGL protein viewer

Home Page:https://pv.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Structure creation by hand

theasjblog opened this issue · comments

Hi,
I am trying to create some structures by hand, and I started from the sample code provided in the documentation:

var structure = new pv.mol.Mol();
var chain = structure.addChain('A');
for (var i = 0; i < 10; ++i) {
var residue = chain.addResidue('ABC', i);
residue.addAtom('X', [i, 0, 0], 'C');
}

This should give a molecule with 10 atoms, but it rather seems to create 10 individual atoms. Is there any way to 'link' atoms?

There is a connect in mol.mol, but you need the two atom objects/views to do the connection. There is also a magical deriveConnectivity function in mol.mol that does some bond-guessing by distance, which could work without the objects because it does the guessing for the entire chain.