<commit_before>'use strict';

// web workers need this imported especially
if(self.importScripts)
	self.importScripts('../lib/three.r74.min.js');

// web workers don't have a window object
try {
	window.THREE = window.THREE || {};
}
catch(e){
	var window = {
		THREE: self.THREE,
		console: {
			log: function(){
				self.postMessage({type: 'log', message: Array.prototype.slice.call(arguments).join(' ')});
			}
		}
	};
}


(function(THREE)
{
	var covalentRadius = {h:31, he:28, li:128, be:96, b:84, c:73, n:71, o:66, f:57, na:166, mg:141, al:121, si:111, p:107, s:105, cl:102, k:203, ca:176, sc:170, ti:160, v:153, cr:139, mn:139, fe:132, co:126, ni:124, cu:132, zn:122, ga:122, ge:120, as:119, se:120, br:120};

	// atomic colors
	var CPK = {"h":16777215,"he":14286847,"li":13402367,"be":12779264,"b":16758197,"c":9474192,"n":3166456,"o":16715021,"f":9494608,"ne":11789301,"na":11230450,"mg":9109248,"al":12560038,"si":15780000,"p":16744448,"s":16777008,"cl":2093087,"ar":8442339,"k":9388244,"ca":4062976,"sc":15132390,"ti":12567239,"v":10921643,"cr":9083335,"mn":10255047,"fe":14706227,"co":15765664,"ni":5296208,"cu":13140019,"zn":8224944,"ga":12750735,"ge":6721423,"as":12419299,"se":16752896,"br":10889513,"kr":6076625,"rb":7351984,"sr":65280,"y":9764863,"zr":9756896,"nb":7586505,"mo":5551541,"tc":3907230,"ru":2396047,"rh":687500,"pd":27013,"ag":12632256,"cd":16767375,"in":10909043,"sn":6717568,"sb":10380213,"te":13924864,"i":9699476,"xe":4366000,"cs":5707663,"ba":51456,"la":7394559,"ce":16777159,"pr":14286791,"nd":13107143,"pm":10747847,"sm":9437127,"eu":6422471,"gd":4587463,"tb":3211207,"dy":2097095,"ho":65436,"er":58997,"tm":54354,"yb":48952,"lu":43812,"hf":5096191,"ta":5089023,"w":2200790,"re":2522539,"os":2516630,"ir":1528967,"pt":13684960,"au":16765219,"hg":12105936,"tl":10900557,"pb":5724513,"bi":10375093,"po":11230208,"at":7688005,"rn":4358806,"fr":4325478,"ra":32000,"ac":7384058,"th":47871,"pa":41471,"u":36863,"np":33023,"pu":27647,"am":5528818,"cm":7888099,"bk":9064419,"cf":10565332,"es":11739092,"fm":11739066,"md":11734438,"no":12389767,"lr":13041766,"rf":13369433,"db":13697103,"sg":14221381,"bh":14680120,"hs":15073326,"mt":15400998,"ds":15400998,"rg":15400998,"cn":15400998,"uut":15400998,"uuq":15400998,"uup":15400998,"uuh":15400998,"uus":15400998,"uuo":15400998};

	// amino acid residue colors
	var residueColors = {
		ASP: 0xe60a0a, GLU: 0xe60a0a, // bright red
		CYS: 0xe6e600, MET: 0xe6e600, // yellow
		LYS: 0x145aff, ARG: 0x145aff, // blue
		SER: 0xfa9600, THR: 0xfa9600, // orange
		PHE: 0x3232aa, TYR: 0x3232aa, // mid blue
		ASN: 0x00dcdc, GLN: 0x00dcdc, // cyan
		GLY: 0xebebeb, // light grey
		LEU: 0x0f820f, VAL: 0x0f820f, ILE: 0x0f820f, // green
		ALA: 0xc8c8c8, // dark grey
		TRP: 0xb45ab4, // pink
		HIS: 0x8282d2, //pale blue
		PRO: 0xdc9682 // flesh
	};

	// chain colors:  blue, red,      grey,    orange,   yellow,   tan,     silver,   green, white,    pink,     cyan,    purple,   lime
	var chainColors = [255, 16711680, 5855577, 16744192, 16776960, 8355635, 10066329, 65280, 16777215, 16751001, 4177855, 10813605, 8381798];

	// structure colors:
	var structureColors = {
		helix: {
			default: 10813605, // purple
			1: 10813605, // purple
			5: 255, // blue
			3: 16711680 // red
		},
		sheet: 8381798, // lime
		other: 16777215 // white
	};


	THREE.PDBLoader = function ( manager ) {
		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
	};

	THREE.PDBLoader.prototype = {

		constructor: THREE.PDBLoader,

		load: function ( url, options, onLoad, onProgress, onError ) {

			var scope = this;

			if(window.Worker)
			{
				window.console.log('spinning up worker');
				var worker = new Worker('js/PDBLoaderImproved.js');

				worker.postMessage({
					url: /^http/.test(url) ? url : '../'+url,
					options: options
				});

				worker.onmessage = function(msg)
				{
					var payload = msg.data;

					if(payload.type === 'log')
						window.console.log(payload.message);
					else if(payload.type === 'model')
					{
						var model = deserialize(payload.data);
						onLoad(model, model.userData);
						worker.terminate();
					}
					else if(payload.type === 'error')
					{
						onError(payload.message);
					}
				};
			}
			else
			{
				var loader = new THREE.XHRLoader( scope.manager );
				loader.load( url, function (text)
				{
					var t0 = performance.now();
					var json = scope.parsePDB(text);
					var model = scope.createStickBallModels(json, options);
					var t1 = performance.now();
					window.console.log((t1-t0)+'ms to load');

					onLoad(model, json);
				}, undefined, onError );
			}
		},


		parsePDB: function(text)
		{<commit_msg>Fixed timing feature<commit_after>'use strict';

// web workers need this imported especially
if(self.importScripts)
	self.importScripts('../lib/three.r74.min.js');

// web workers don't have a window object
try {
	window.THREE = window.THREE || {};
}
catch(e){
	var window = {
		THREE: self.THREE,
		console: {
			log: function(){
				self.postMessage({type: 'log', message: Array.prototype.slice.call(arguments).join(' ')});
			}
		}
	};
}


(function(THREE)
{
	var covalentRadius = {h:31, he:28, li:128, be:96, b:84, c:73, n:71, o:66, f:57, na:166, mg:141, al:121, si:111, p:107, s:105, cl:102, k:203, ca:176, sc:170, ti:160, v:153, cr:139, mn:139, fe:132, co:126, ni:124, cu:132, zn:122, ga:122, ge:120, as:119, se:120, br:120};

	// atomic colors
	var CPK = {"h":16777215,"he":14286847,"li":13402367,"be":12779264,"b":16758197,"c":9474192,"n":3166456,"o":16715021,"f":9494608,"ne":11789301,"na":11230450,"mg":9109248,"al":12560038,"si":15780000,"p":16744448,"s":16777008,"cl":2093087,"ar":8442339,"k":9388244,"ca":4062976,"sc":15132390,"ti":12567239,"v":10921643,"cr":9083335,"mn":10255047,"fe":14706227,"co":15765664,"ni":5296208,"cu":13140019,"zn":8224944,"ga":12750735,"ge":6721423,"as":12419299,"se":16752896,"br":10889513,"kr":6076625,"rb":7351984,"sr":65280,"y":9764863,"zr":9756896,"nb":7586505,"mo":5551541,"tc":3907230,"ru":2396047,"rh":687500,"pd":27013,"ag":12632256,"cd":16767375,"in":10909043,"sn":6717568,"sb":10380213,"te":13924864,"i":9699476,"xe":4366000,"cs":5707663,"ba":51456,"la":7394559,"ce":16777159,"pr":14286791,"nd":13107143,"pm":10747847,"sm":9437127,"eu":6422471,"gd":4587463,"tb":3211207,"dy":2097095,"ho":65436,"er":58997,"tm":54354,"yb":48952,"lu":43812,"hf":5096191,"ta":5089023,"w":2200790,"re":2522539,"os":2516630,"ir":1528967,"pt":13684960,"au":16765219,"hg":12105936,"tl":10900557,"pb":5724513,"bi":10375093,"po":11230208,"at":7688005,"rn":4358806,"fr":4325478,"ra":32000,"ac":7384058,"th":47871,"pa":41471,"u":36863,"np":33023,"pu":27647,"am":5528818,"cm":7888099,"bk":9064419,"cf":10565332,"es":11739092,"fm":11739066,"md":11734438,"no":12389767,"lr":13041766,"rf":13369433,"db":13697103,"sg":14221381,"bh":14680120,"hs":15073326,"mt":15400998,"ds":15400998,"rg":15400998,"cn":15400998,"uut":15400998,"uuq":15400998,"uup":15400998,"uuh":15400998,"uus":15400998,"uuo":15400998};

	// amino acid residue colors
	var residueColors = {
		ASP: 0xe60a0a, GLU: 0xe60a0a, // bright red
		CYS: 0xe6e600, MET: 0xe6e600, // yellow
		LYS: 0x145aff, ARG: 0x145aff, // blue
		SER: 0xfa9600, THR: 0xfa9600, // orange
		PHE: 0x3232aa, TYR: 0x3232aa, // mid blue
		ASN: 0x00dcdc, GLN: 0x00dcdc, // cyan
		GLY: 0xebebeb, // light grey
		LEU: 0x0f820f, VAL: 0x0f820f, ILE: 0x0f820f, // green
		ALA: 0xc8c8c8, // dark grey
		TRP: 0xb45ab4, // pink
		HIS: 0x8282d2, //pale blue
		PRO: 0xdc9682 // flesh
	};

	// chain colors:  blue, red,      grey,    orange,   yellow,   tan,     silver,   green, white,    pink,     cyan,    purple,   lime
	var chainColors = [255, 16711680, 5855577, 16744192, 16776960, 8355635, 10066329, 65280, 16777215, 16751001, 4177855, 10813605, 8381798];

	// structure colors:
	var structureColors = {
		helix: {
			default: 10813605, // purple
			1: 10813605, // purple
			5: 255, // blue
			3: 16711680 // red
		},
		sheet: 8381798, // lime
		other: 16777215 // white
	};


	THREE.PDBLoader = function ( manager ) {
		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
	};

	THREE.PDBLoader.prototype = {

		constructor: THREE.PDBLoader,

		load: function ( url, options, onLoad, onProgress, onError ) {

			var scope = this;

			if(window.Worker)
			{
				window.console.log('spinning up worker');
				var worker = new Worker('js/PDBLoaderImproved.js');

				worker.postMessage({
					url: /^http/.test(url) ? url : '../'+url,
					options: options
				});

				worker.onmessage = function(msg)
				{
					var payload = msg.data;

					if(payload.type === 'log')
						window.console.log(payload.message);
					else if(payload.type === 'model')
					{
						var model = deserialize(payload.data);
						onLoad(model, model.userData);
						worker.terminate();
					}
					else if(payload.type === 'error')
					{
						onError(payload.message);
					}
				};
			}
			else
			{
				var loader = new THREE.XHRLoader( scope.manager );
				loader.load( url, function (text)
				{
					var t0 = Date.now();
					var json = scope.parsePDB(text);
					var model = scope.createStickBallModels(json, options);
					var t1 = Date.now();
					window.console.log((t1-t0)+'ms to load');

					onLoad(model, json);
				}, undefined, onError );
			}
		},


		parsePDB: function(text)
		{
{'fraction_non_alphanumeric': 0.2062453052902672, 'fraction_numerical': 0.25260221053761134, 'mean_word_length': 4.850596359070935, 'pattern_counts': {'":': 236, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2607410', 'n_tokens_mistral': 5641, 'n_tokens_neox': 3850, 'n_words': 558}