Skip to content

Commit

Permalink
Merge pull request #12620 from kenkiku1021/PDBLoader-fix
Browse files Browse the repository at this point in the history
fixed to read "serial" field in PDB files.
  • Loading branch information
mrdoob authored Nov 15, 2017
2 parents 8ae9ff7 + 6fee41c commit c359414
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/js/loaders/PDBLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ THREE.PDBLoader.prototype = {

var bhash = {};

var x, y, z, e;
var x, y, z, index, e;

// parse

Expand All @@ -165,6 +165,7 @@ THREE.PDBLoader.prototype = {
x = parseFloat( lines[ i ].substr( 30, 7 ) );
y = parseFloat( lines[ i ].substr( 38, 7 ) );
z = parseFloat( lines[ i ].substr( 46, 7 ) );
index = parseInt( lines[ i ].substr( 6, 5 ) ) - 1;

e = trim( lines[ i ].substr( 76, 2 ) ).toLowerCase();

Expand All @@ -174,7 +175,7 @@ THREE.PDBLoader.prototype = {

}

atoms.push( [ x, y, z, CPK[ e ], capitalize( e ) ] );
atoms[ index ] = [ x, y, z, CPK[ e ], capitalize( e ) ];

if ( histogram[ e ] === undefined ) {

Expand Down

0 comments on commit c359414

Please sign in to comment.